mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-14 21:36:13 +01:00
gsocket: fix -Wsign-compare warnings when socklen_t is signed
under cygwin socklen_t is signed which leads to warnings like: warning: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘socklen_t’ {aka ‘int’} [-Wsign-compare] In both cases we compare against some small fixed sizes, so cast them to socklen_t.
This commit is contained in:
parent
e31c6accc5
commit
60ab0737df
@ -503,7 +503,7 @@ g_socket_details_from_fd (GSocket *socket)
|
|||||||
if (addrlen > 0)
|
if (addrlen > 0)
|
||||||
{
|
{
|
||||||
g_assert (G_STRUCT_OFFSET (struct sockaddr, sa_family) +
|
g_assert (G_STRUCT_OFFSET (struct sockaddr, sa_family) +
|
||||||
sizeof address.storage.ss_family <= addrlen);
|
(socklen_t) sizeof address.storage.ss_family <= addrlen);
|
||||||
family = address.storage.ss_family;
|
family = address.storage.ss_family;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4679,7 +4679,7 @@ input_message_from_msghdr (const struct msghdr *msg,
|
|||||||
GPtrArray *my_messages = NULL;
|
GPtrArray *my_messages = NULL;
|
||||||
struct cmsghdr *cmsg;
|
struct cmsghdr *cmsg;
|
||||||
|
|
||||||
if (msg->msg_controllen >= sizeof (struct cmsghdr))
|
if (msg->msg_controllen >= (socklen_t) sizeof (struct cmsghdr))
|
||||||
{
|
{
|
||||||
g_assert (message->control_messages != NULL);
|
g_assert (message->control_messages != NULL);
|
||||||
for (cmsg = CMSG_FIRSTHDR (msg);
|
for (cmsg = CMSG_FIRSTHDR (msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user