Module: ngircd.git Branch: master Commit: 25e56a5e837173a567a0873bd5a9ccc126cff333 URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=25e56...
Author: Alexander Barton alex@barton.de Date: Tue Dec 25 19:21:40 2012 +0100
Add some more casts in assert() statemens
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 05ef6ec..9cf35ec 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 3f99b3a..6078da8 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;