Fix build for Android with android-clang

kernel/qnetworkinterface_linux.cpp:172:18: error: comparison of integers of different signs: '__u32' (aka 'unsigned int') and 'qsizetype' (aka 'int') [-Werror,-Wsign-compare]
                if (!NLMSG_OK(hdr, len))
                     ^~~~~~~~~~~~~~~~~~
    kernel/qnetworkinterface_linux.cpp:197:26: error: comparison of integers of different signs: '__u32' (aka 'unsigned int') and 'qsizetype' (aka 'int') [-Werror,-Wsign-compare]
                    } while (NLMSG_OK(hdr, len));
                             ^~~~~~~~~~~~~~~~~~

Change-Id: I3d0a4efc9fc42dd9b0726f2b62ff494220b8026e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
Liang Qi 2018-05-15 17:22:59 +02:00
parent 5349cb9d3c
commit 09cb23f342

View File

@ -169,7 +169,7 @@ template <typename Lambda> struct ProcessNetlinkRequest
forever {
qsizetype len = recv(sock, buf, bufsize, 0);
hdr = reinterpret_cast<struct nlmsghdr *>(buf);
if (!NLMSG_OK(hdr, len))
if (!NLMSG_OK(hdr, quint32(len)))
return;
auto arg = reinterpret_cast<FirstArgument>(NLMSG_DATA(hdr));
@ -194,7 +194,7 @@ template <typename Lambda> struct ProcessNetlinkRequest
hdr = NLMSG_NEXT(hdr, len);
arg = reinterpret_cast<FirstArgument>(NLMSG_DATA(hdr));
payloadLen = NLMSG_PAYLOAD(hdr, 0);
} while (NLMSG_OK(hdr, len));
} while (NLMSG_OK(hdr, quint32(len)));
if (len == 0)
continue; // get new datagram