albfan / miraclecast

Connect external monitors to your system via Wifi-Display specification also known as Miracast
Other
3.86k stars 414 forks source link

Errors and warnings while building #515

Closed jiapei100 closed 3 months ago

jiapei100 commented 3 months ago

Errors and warnings while building

[ 15%] Building C object src/shared/CMakeFiles/miracle-shared.dir/shl_util.c.o
cd ....../miraclecast/build/src/shared && /usr/local/bin/cmake -E __run_co_compile --cppcheck="/usr/bin/cppcheck;--enable=warning;--inline-suppr;--std=c11;-D__SIZEOF_POINTER__=8" --source=....../miraclecast/src/shared/wpas.c -- /usr/bin/cc -DBUILD_ENABLE_DEBUG -D_GNU_SOURCE  -std=gnu11 -O3 -DNDEBUG -MD -MT src/shared/CMakeFiles/miracle-shared.dir/wpas.c.o -MF CMakeFiles/miracle-shared.dir/wpas.c.o.d -o CMakeFiles/miracle-shared.dir/wpas.c.o -c ....../miraclecast/src/shared/wpas.c
cd ....../miraclecast/build/src/shared && /usr/local/bin/cmake -E __run_co_compile --cppcheck="/usr/bin/cppcheck;--enable=warning;--inline-suppr;--std=c11;-D__SIZEOF_POINTER__=8" --source=....../miraclecast/src/shared/shl_htable.c -- /usr/bin/cc -DBUILD_ENABLE_DEBUG -D_GNU_SOURCE  -std=gnu11 -O3 -DNDEBUG -MD -MT src/shared/CMakeFiles/miracle-shared.dir/shl_htable.c.o -MF CMakeFiles/miracle-shared.dir/shl_htable.c.o.d -o CMakeFiles/miracle-shared.dir/shl_htable.c.o -c ....../miraclecast/src/shared/shl_htable.c
cd ....../miraclecast/build/src/shared && /usr/local/bin/cmake -E __run_co_compile --cppcheck="/usr/bin/cppcheck;--enable=warning;--inline-suppr;--std=c11;-D__SIZEOF_POINTER__=8" --source=....../miraclecast/src/shared/shl_log.c -- /usr/bin/cc -DBUILD_ENABLE_DEBUG -D_GNU_SOURCE  -std=gnu11 -O3 -DNDEBUG -MD -MT src/shared/CMakeFiles/miracle-shared.dir/shl_log.c.o -MF CMakeFiles/miracle-shared.dir/shl_log.c.o.d -o CMakeFiles/miracle-shared.dir/shl_log.c.o -c ....../miraclecast/src/shared/shl_log.c
cd ....../miraclecast/build/src/shared && /usr/local/bin/cmake -E __run_co_compile --cppcheck="/usr/bin/cppcheck;--enable=warning;--inline-suppr;--std=c11;-D__SIZEOF_POINTER__=8" --source=....../miraclecast/src/shared/shl_ring.c -- /usr/bin/cc -DBUILD_ENABLE_DEBUG -D_GNU_SOURCE  -std=gnu11 -O3 -DNDEBUG -MD -MT src/shared/CMakeFiles/miracle-shared.dir/shl_ring.c.o -MF CMakeFiles/miracle-shared.dir/shl_ring.c.o.d -o CMakeFiles/miracle-shared.dir/shl_ring.c.o -c ....../miraclecast/src/shared/shl_ring.c
cd ....../miraclecast/build/src/shared && /usr/local/bin/cmake -E __run_co_compile --cppcheck="/usr/bin/cppcheck;--enable=warning;--inline-suppr;--std=c11;-D__SIZEOF_POINTER__=8" --source=....../miraclecast/src/shared/shl_util.c -- /usr/bin/cc -DBUILD_ENABLE_DEBUG -D_GNU_SOURCE  -std=gnu11 -O3 -DNDEBUG -MD -MT src/shared/CMakeFiles/miracle-shared.dir/shl_util.c.o -MF CMakeFiles/miracle-shared.dir/shl_util.c.o.d -o CMakeFiles/miracle-shared.dir/shl_util.c.o -c ....../miraclecast/src/shared/shl_util.c
Checking ....../miraclecast/src/shared/rtsp.c ...
....../miraclecast/src/shared/shl_htable.h:113:0: error: #error "'size_t' is smaller than 'unsigned int'" [preprocessorErrorDirective]
#  error "'size_t' is smaller than 'unsigned int'"
^
Checking ....../miraclecast/src/shared/shl_htable.c ...
....../miraclecast/src/shared/shl_htable.h:113:0: error: #error "'size_t' is smaller than 'unsigned int'" [preprocessorErrorDirective]
#  error "'size_t' is smaller than 'unsigned int'"
^
Checking ....../miraclecast/src/shared/shl_ring.c ...
Checking ....../miraclecast/src/shared/shl_ring.c: __SIZEOF_POINTER__=8;BUILD_ENABLE_DEBUG=1;_GNU_SOURCE=1;NDEBUG=1...
Checking ....../miraclecast/src/shared/shl_log.c ...
Checking ....../miraclecast/src/shared/shl_log.c: __SIZEOF_POINTER__=8;BUILD_ENABLE_DEBUG=1;_GNU_SOURCE=1;NDEBUG=1...
Checking ....../miraclecast/src/shared/shl_util.c ...
Checking ....../miraclecast/src/shared/shl_util.c: __SIZEOF_POINTER__=8;BUILD_ENABLE_DEBUG=1;_GNU_SOURCE=1;NDEBUG=1...
....../miraclecast/src/shared/shl_util.c:837:6: warning: Obsolete function 'alloca' called. In C99 and later it is recommended to use a variable length array instead. [allocaCalled]
 t = alloca(strlen(path) + 1);
     ^
....../miraclecast/src/shared/shl_util.c:345:15: error: va_list 'args' was opened but not closed by va_end(). [va_end_missing]
   return NULL;
              ^
Checking ....../miraclecast/src/shared/wpas.c ...
Checking ....../miraclecast/src/shared/wpas.c: __SIZEOF_POINTER__=8;BUILD_ENABLE_DEBUG=1;_GNU_SOURCE=1;NDEBUG=1...
....../miraclecast/src/shared/wpas.c:137:3: error: Memory leak: m [memleak]
  return -ENOMEM;
  ^
....../miraclecast/src/shared/wpas.c:145:4: error: Memory leak: m [memleak]
   return -ENOMEM;
   ^
....../miraclecast/src/shared/wpas.c:1127:3: error: Memory leak: w [memleak]
  return -ENOMEM;
  ^
....../miraclecast/src/shared/wpas.c:1136:3: error: Memory leak: w [memleak]
  return w->fd;
  ^
....../miraclecast/src/shared/wpas.c:1625:2: error: Memory leak: match [memleak]
 return 0;
 ^

Checking ....../miraclecast/test/test_valgrind.c ...
....../miraclecast/src/shared/shl_htable.h:113:0: error: #error "'size_t' is smaller than 'unsigned int'" [preprocessorErrorDirective]
#  error "'size_t' is smaller than 'unsigned int'"
^
Checking ....../miraclecast/src/miracled.c ...
Checking ....../miraclecast/src/miracled.c: __SIZEOF_POINTER__=8;BUILD_ENABLE_DEBUG=1;_GNU_SOURCE=1;NDEBUG=1...
Checking ....../miraclecast/test/test_wpas.c ...
....../miraclecast/src/shared/shl_htable.h:113:0: error: #error "'size_t' is smaller than 'unsigned int'" [preprocessorErrorDirective]
#  error "'size_t' is smaller than 'unsigned int'"
^
Checking ....../miraclecast/test/test_rtsp.c ...
....../miraclecast/src/shared/shl_htable.h:113:0: error: #error "'size_t' is smaller than 'unsigned int'" [preprocessorErrorDirective]
#  error "'size_t' is smaller than 'unsigned int'"
^
Checking ....../miraclecast/src/ctl/ctl-cli.c ...
Checking ....../miraclecast/src/ctl/ctl-cli.c: __SIZEOF_POINTER__=8;BUILD_ENABLE_DEBUG=1;HAVE_READLINE=1;_GNU_SOURCE=1;NDEBUG=1...
Checking ....../miraclecast/src/ctl/ctl-cli.c ...
Checking ....../miraclecast/src/ctl/ctl-cli.c: __SIZEOF_POINTER__=8;BUILD_ENABLE_DEBUG=1;HAVE_READLINE=1;_GNU_SOURCE=1;NDEBUG=1...
Checking ....../miraclecast/src/wifi/wifid.c ...
....../miraclecast/src/shared/shl_htable.h:113:0: error: #error "'size_t' is smaller than 'unsigned int'" [preprocessorErrorDirective]
#  error "'size_t' is smaller than 'unsigned int'"
^
Checking ....../miraclecast/src/wifi/wifid-link.c ...
....../miraclecast/src/shared/shl_htable.h:113:0: error: #error "'size_t' is smaller than 'unsigned int'" [preprocessorErrorDirective]
#  error "'size_t' is smaller than 'unsigned int'"
^
Checking ....../miraclecast/src/wifi/wifid-dbus.c ...
....../miraclecast/src/shared/shl_htable.h:113:0: error: #error "'size_t' is smaller than 'unsigned int'" [preprocessorErrorDirective]
#  error "'size_t' is smaller than 'unsigned int'"
^

[ 84%] Building C object src/dhcp/CMakeFiles/miracle-dhcp.dir/client.c.o
cd ....../miraclecast/build/src/dhcp && /usr/local/bin/cmake -E __run_co_compile --cppcheck="/usr/bin/cppcheck;--enable=warning;--inline-suppr;--std=c11;-D__SIZEOF_POINTER__=8" --source=....../miraclecast/src/dhcp/client.c -- /usr/bin/cc -DBUILD_ENABLE_DEBUG -D_GNU_SOURCE -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I....../miraclecast/build -I....../miraclecast/src -I....../miraclecast/src/shared -std=gnu11 -std=gnu11  -O3 -DNDEBUG -MD -MT src/dhcp/CMakeFiles/miracle-dhcp.dir/client.c.o -MF CMakeFiles/miracle-dhcp.dir/client.c.o.d -o CMakeFiles/miracle-dhcp.dir/client.c.o -c ....../miraclecast/src/dhcp/client.c
Checking ....../miraclecast/src/uibc/miracle-uibcctl.c ...
Checking ....../miraclecast/src/uibc/miracle-uibcctl.c: __SIZEOF_POINTER__=8;BUILD_ENABLE_DEBUG=1;_GNU_SOURCE=1;NDEBUG=1...
....../miraclecast/src/uibc/miracle-uibcctl.c:332:19: warning: %X in format string (no. 1) requires 'unsigned int *' but the argument type is 'signed int *'. [invalidScanfArgType_int]
                  sscanf(*(splitedStr + i), " 0x%04X", &temp);
                  ^
....../miraclecast/src/uibc/miracle-uibcctl.c:344:19: warning: %X in format string (no. 1) requires 'unsigned int *' but the argument type is 'signed int *'. [invalidScanfArgType_int]
                  sscanf(*(splitedStr + i), " 0x%04X", &temp);
                  ^
....../miraclecast/src/uibc/miracle-uibcctl.c:280:27: error: Allocation with int2binary, fprintf doesn't release it. [leakNoVarFunctionCall]
    fprintf(stderr,"%s ", int2binary(*data, 8));
                          ^
....../miraclecast/src/uibc/miracle-uibcctl.c:95:3: warning: Size of pointer 'b' used instead of size of its data. [pointerSize]
  b = (char *)malloc (sizeof (char *) * padding + 1);
  ^
....../miraclecast/src/uibc/miracle-uibcctl.c:442:34: warning: Uninitialized variable: uibcBodyLen [uninitvar]
  uibcmessage->m_PacketDataLen = uibcBodyLen;
                                 ^
....../miraclecast/src/uibc/miracle-uibcctl.c:381:7: note: Assuming condition is false
  if (splitedStr) {
      ^
....../miraclecast/src/uibc/miracle-uibcctl.c:442:34: note: Uninitialized variable: uibcBodyLen
  uibcmessage->m_PacketDataLen = uibcBodyLen;
                                 ^
....../miraclecast/src/uibc/miracle-uibcctl.c:526:34: warning: Uninitialized variable: uibcBodyLen [uninitvar]
  uibcmessage->m_PacketDataLen = uibcBodyLen;
                                 ^
....../miraclecast/src/uibc/miracle-uibcctl.c:455:7: note: Assuming condition is false
  if (splitedStr) {
      ^
....../miraclecast/src/uibc/miracle-uibcctl.c:526:34: note: Uninitialized variable: uibcBodyLen
  uibcmessage->m_PacketDataLen = uibcBodyLen;
                                 ^
....../miraclecast/src/uibc/miracle-uibcctl.c:587:34: warning: Uninitialized variable: uibcBodyLen [uninitvar]
  uibcmessage->m_PacketDataLen = uibcBodyLen;
                                 ^
....../miraclecast/src/uibc/miracle-uibcctl.c:540:7: note: Assuming condition is false
  if (splitedStr) {
      ^
....../miraclecast/src/uibc/miracle-uibcctl.c:587:34: note: Uninitialized variable: uibcBodyLen
  uibcmessage->m_PacketDataLen = uibcBodyLen;
                                 ^

[ 92%] Linking C executable miracle-wifid
cd ....../miraclecast/build/src/wifi && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/miracle-wifid.dir/link.txt --verbose=1
/usr/bin/cc -std=gnu11 -std=gnu11  -O3 -DNDEBUG -rdynamic "CMakeFiles/miracle-wifid.dir/wifid.c.o" "CMakeFiles/miracle-wifid.dir/wifid-dbus.c.o" "CMakeFiles/miracle-wifid.dir/wifid-link.c.o" "CMakeFiles/miracle-wifid.dir/wifid-peer.c.o" "CMakeFiles/miracle-wifid.dir/wifid-supplicant.c.o" -o miracle-wifid  ../shared/libmiracle-shared.a -ludev -lm -lglib-2.0 -lsystemd
Checking ....../miraclecast/src/dhcp/client.c ...
Checking ....../miraclecast/src/dhcp/client.c: __SIZEOF_POINTER__=8;BUILD_ENABLE_DEBUG=1;_GNU_SOURCE=1;NDEBUG=1...
....../miraclecast/src/dhcp/client.c:2096:20: warning: Either the condition 'c' is redundant or there is overflow in pointer subtraction. [nullPointerArithmeticRedundantCheck]
  pos += (char *)c - dns_name + 1;
                   ^
....../miraclecast/src/dhcp/client.c:2089:10: note: Assuming that condition 'c' is not redundant
  while (c && *c) {
         ^
....../miraclecast/src/dhcp/client.c:2096:20: note: Null pointer subtraction
  pos += (char *)c - dns_name + 1;
                   ^
albfan commented 3 months ago

Yep, anyone can get those warnings just building.

Consider opening an issue only if you want to contribute and you're in doubt about a fix, or this cause you any problem.

If not in doubt, just submit a fix, PR always welcome!