From 25e56a5e837173a567a0873bd5a9ccc126cff333 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Tue, 25 Dec 2012 19:21:40 +0100 Subject: [PATCH] Add some more casts in assert() statemens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the following warning messages of gcc 4.5.3 on Cygwin when building with debug code enabled: ng_ipaddr.c: In function ‘ng_ipaddr_init’: ng_ipaddr.c:52:2: warning: comparison between signed and unsigned integer expressions ng_ipaddr.c:53:20: warning: comparison between signed and unsigned integer expressions resolve.c: In function ‘ForwardLookup’: resolve.c:271:3: warning: comparison between signed and unsigned integer expressions --- src/ipaddr/ng_ipaddr.c | 4 ++-- src/ngircd/resolve.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ipaddr/ng_ipaddr.c b/src/ipaddr/ng_ipaddr.c index 05ef6ecb..9cf35ec9 100644 --- a/src/ipaddr/ng_ipaddr.c +++ b/src/ipaddr/ng_ipaddr.c @@ -49,8 +49,8 @@ ng_ipaddr_init(ng_ipaddr_t *addr, const char *ip_str, UINT16 port) if (ret != 0) return false; - assert(sizeof(*addr) >= res0->ai_addrlen); - if (sizeof(*addr) >= res0->ai_addrlen) + assert(sizeof(*addr) >= (size_t)res0->ai_addrlen); + if (sizeof(*addr) >= (size_t)res0->ai_addrlen) memcpy(addr, res0->ai_addr, res0->ai_addrlen); else ret = -1; diff --git a/src/ngircd/resolve.c b/src/ngircd/resolve.c index 3f99b3a9..6078da8b 100644 --- a/src/ngircd/resolve.c +++ b/src/ngircd/resolve.c @@ -268,7 +268,7 @@ ForwardLookup(const char *hostname, array *IpAddr, int af) } for (a = ai_results; a != NULL; a = a->ai_next) { - assert(a->ai_addrlen <= sizeof(addr)); + assert((size_t)a->ai_addrlen <= sizeof(addr)); if ((size_t)a->ai_addrlen > sizeof(addr)) continue;