Loading ares/inet_net_pton.c +353 −347 Original line number Diff line number Diff line Loading @@ -68,7 +68,8 @@ * Paul Vixie (ISC), June 1996 */ static int inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { static const char xdigits[] = "0123456789abcdef"; static const char digits[] = "0123456789"; int n, ch, tmp = 0, dirty, bits; Loading @@ -86,7 +87,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { while ((ch = *src++) != '\0' && isascii(ch) && isxdigit(ch)) { if (isupper(ch)) ch = tolower(ch); n = strchr(xdigits, ch) - xdigits; n = (int)(strchr(xdigits, ch) - xdigits); if (dirty == 0) tmp = n; else Loading @@ -108,7 +109,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { for (;;) { tmp = 0; do { n = strchr(digits, ch) - digits; n = (int)(strchr(digits, ch) - digits); tmp *= 10; tmp += n; if (tmp > 255) Loading Loading @@ -136,7 +137,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { ch = *src++; /* Skip over the /. */ bits = 0; do { n = strchr(digits, ch) - digits; n = (int)(strchr(digits, ch) - digits); bits *= 10; bits += n; } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); Loading Loading @@ -167,7 +168,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { bits = 8; /* If imputed mask is narrower than specified octets, widen. */ if (bits < ((dst - odst) * 8)) bits = (dst - odst) * 8; bits = (int)(dst - odst) * 8; /* * If there are no additional bits specified for a class D * address adjust bits to 4. Loading @@ -193,7 +194,8 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { } static int getbits(const char *src, int *bitsp) { getbits(const char *src, int *bitsp) { static const char digits[] = "0123456789"; int n; int val; Loading Loading @@ -223,7 +225,8 @@ getbits(const char *src, int *bitsp) { } static int getv4(const char *src, unsigned char *dst, int *bitsp) { getv4(const char *src, unsigned char *dst, int *bitsp) { static const char digits[] = "0123456789"; unsigned char *odst = dst; int n; Loading Loading @@ -266,7 +269,8 @@ getv4(const char *src, unsigned char *dst, int *bitsp) { } static int inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size) { inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size) { static const char xdigits_l[] = "0123456789abcdef", xdigits_u[] = "0123456789ABCDEF"; unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; Loading Loading @@ -355,7 +359,7 @@ inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size) { * Since some memmove()'s erroneously fail to handle * overlapping regions, we'll do the shift by hand. */ const int n = tp - colonp; const int n = (int)(tp - colonp); int i; if (tp == endp) Loading Loading @@ -398,7 +402,8 @@ inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size) { * Paul Vixie (ISC), June 1996 */ int ares_inet_net_pton(int af, const char *src, void *dst, size_t size) { ares_inet_net_pton(int af, const char *src, void *dst, size_t size) { switch (af) { case AF_INET: return (inet_net_pton_ipv4(src, dst, size)); Loading @@ -413,7 +418,8 @@ ares_inet_net_pton(int af, const char *src, void *dst, size_t size) { #endif #if !defined(HAVE_INET_PTON) || !defined(HAVE_INET_PTON_IPV6) int ares_inet_pton(int af, const char *src, void *dst) { int ares_inet_pton(int af, const char *src, void *dst) { int size, result; if (af == AF_INET) Loading Loading
ares/inet_net_pton.c +353 −347 Original line number Diff line number Diff line Loading @@ -68,7 +68,8 @@ * Paul Vixie (ISC), June 1996 */ static int inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { static const char xdigits[] = "0123456789abcdef"; static const char digits[] = "0123456789"; int n, ch, tmp = 0, dirty, bits; Loading @@ -86,7 +87,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { while ((ch = *src++) != '\0' && isascii(ch) && isxdigit(ch)) { if (isupper(ch)) ch = tolower(ch); n = strchr(xdigits, ch) - xdigits; n = (int)(strchr(xdigits, ch) - xdigits); if (dirty == 0) tmp = n; else Loading @@ -108,7 +109,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { for (;;) { tmp = 0; do { n = strchr(digits, ch) - digits; n = (int)(strchr(digits, ch) - digits); tmp *= 10; tmp += n; if (tmp > 255) Loading Loading @@ -136,7 +137,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { ch = *src++; /* Skip over the /. */ bits = 0; do { n = strchr(digits, ch) - digits; n = (int)(strchr(digits, ch) - digits); bits *= 10; bits += n; } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); Loading Loading @@ -167,7 +168,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { bits = 8; /* If imputed mask is narrower than specified octets, widen. */ if (bits < ((dst - odst) * 8)) bits = (dst - odst) * 8; bits = (int)(dst - odst) * 8; /* * If there are no additional bits specified for a class D * address adjust bits to 4. Loading @@ -193,7 +194,8 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) { } static int getbits(const char *src, int *bitsp) { getbits(const char *src, int *bitsp) { static const char digits[] = "0123456789"; int n; int val; Loading Loading @@ -223,7 +225,8 @@ getbits(const char *src, int *bitsp) { } static int getv4(const char *src, unsigned char *dst, int *bitsp) { getv4(const char *src, unsigned char *dst, int *bitsp) { static const char digits[] = "0123456789"; unsigned char *odst = dst; int n; Loading Loading @@ -266,7 +269,8 @@ getv4(const char *src, unsigned char *dst, int *bitsp) { } static int inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size) { inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size) { static const char xdigits_l[] = "0123456789abcdef", xdigits_u[] = "0123456789ABCDEF"; unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; Loading Loading @@ -355,7 +359,7 @@ inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size) { * Since some memmove()'s erroneously fail to handle * overlapping regions, we'll do the shift by hand. */ const int n = tp - colonp; const int n = (int)(tp - colonp); int i; if (tp == endp) Loading Loading @@ -398,7 +402,8 @@ inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size) { * Paul Vixie (ISC), June 1996 */ int ares_inet_net_pton(int af, const char *src, void *dst, size_t size) { ares_inet_net_pton(int af, const char *src, void *dst, size_t size) { switch (af) { case AF_INET: return (inet_net_pton_ipv4(src, dst, size)); Loading @@ -413,7 +418,8 @@ ares_inet_net_pton(int af, const char *src, void *dst, size_t size) { #endif #if !defined(HAVE_INET_PTON) || !defined(HAVE_INET_PTON_IPV6) int ares_inet_pton(int af, const char *src, void *dst) { int ares_inet_pton(int af, const char *src, void *dst) { int size, result; if (af == AF_INET) Loading