summaryrefslogtreecommitdiff
path: root/inet_net_pton.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-10-09 14:06:38 (GMT)
committerYang Tse <yangsita@gmail.com>2009-10-09 14:06:38 (GMT)
commit590e697792b8544e66311b93e9dd67a129bbf753 (patch)
tree85e8725b917f89c77a2e1510662d52e12ef43d75 /inet_net_pton.c
parentf3346ca16b7c87d6cfe0c1605321dbf0a706e57a (diff)
downloadc-ares-590e697792b8544e66311b93e9dd67a129bbf753.zip
c-ares-590e697792b8544e66311b93e9dd67a129bbf753.tar.gz
c-ares-590e697792b8544e66311b93e9dd67a129bbf753.tar.bz2
Fix compiler warning
Diffstat (limited to 'inet_net_pton.c')
-rw-r--r--inet_net_pton.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/inet_net_pton.c b/inet_net_pton.c
index a3e9338..84a1dc5 100644
--- a/inet_net_pton.c
+++ b/inet_net_pton.c
@@ -81,7 +81,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
&& ISXDIGIT(src[1])) {
/* Hexadecimal: Eat nybble string. */
- if (size <= 0U)
+ if (!size)
goto emsgsize;
dirty = 0;
src++; /* skip x or X. */
@@ -94,14 +94,14 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
else
tmp = (tmp << 4) | n;
if (++dirty == 2) {
- if (size-- <= 0U)
+ if (!size--)
goto emsgsize;
*dst++ = (unsigned char) tmp;
dirty = 0;
}
}
if (dirty) { /* Odd trailing nybble? */
- if (size-- <= 0U)
+ if (!size--)
goto emsgsize;
*dst++ = (unsigned char) (tmp << 4);
}
@@ -117,7 +117,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
goto enoent;
} while ((ch = *src++) != '\0' &&
ISDIGIT(ch));
- if (size-- <= 0U)
+ if (!size--)
goto emsgsize;
*dst++ = (unsigned char) tmp;
if (ch == '\0' || ch == '/')
@@ -179,7 +179,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
}
/* Extend network to cover the actual mask. */
while (bits > ((dst - odst) * 8)) {
- if (size-- <= 0U)
+ if (!size--)
goto emsgsize;
*dst++ = '\0';
}
@@ -426,7 +426,8 @@ ares_inet_net_pton(int af, const char *src, void *dst, size_t size)
#ifndef HAVE_INET_PTON
int ares_inet_pton(int af, const char *src, void *dst)
{
- int size, result;
+ int result;
+ size_t size;
if (af == AF_INET)
size = sizeof(struct in_addr);