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
This commit is contained in:
Alexander Barton 2012-12-25 19:21:40 +01:00
parent 1e5a7aac87
commit 25e56a5e83
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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;