1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Minor compatibility fix

This commit is contained in:
Yang Tse 2006-08-04 17:35:05 +00:00
parent cca00a6378
commit 646a6b604f
2 changed files with 5 additions and 5 deletions

View File

@ -135,7 +135,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
long base; long base;
long len; long len;
} best, cur; } best, cur;
unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ]; unsigned long words[NS_IN6ADDRSZ / NS_INT16SZ];
int i; int i;
/* /*
@ -143,7 +143,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
* Copy the input (bytewise) array into a wordwise array. * Copy the input (bytewise) array into a wordwise array.
* Find the longest run of 0x00's in src[] for :: shorthanding. * Find the longest run of 0x00's in src[] for :: shorthanding.
*/ */
memset(words, '\0', sizeof words); memset(words, '\0', sizeof(words));
for (i = 0; i < NS_IN6ADDRSZ; i++) for (i = 0; i < NS_IN6ADDRSZ; i++)
words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
@ -200,12 +200,12 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
if (i == 6 && best.base == 0 && if (i == 6 && best.base == 0 &&
(best.len == 6 || (best.len == 5 && words[5] == 0xffff))) (best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
{ {
if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) if (!inet_ntop4(src+12, tp, sizeof(tmp) - (tp - tmp)))
return (NULL); return (NULL);
tp += strlen(tp); tp += strlen(tp);
break; break;
} }
tp += SPRINTF((tp, "%x", words[i])); tp += SPRINTF((tp, "%lx", words[i]));
} }
/* Was it a trailing run of 0x00's? */ /* Was it a trailing run of 0x00's? */

View File

@ -119,7 +119,7 @@ static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size)
* Copy the input (bytewise) array into a wordwise array. * Copy the input (bytewise) array into a wordwise array.
* Find the longest run of 0x00's in src[] for :: shorthanding. * Find the longest run of 0x00's in src[] for :: shorthanding.
*/ */
memset(words, 0, sizeof(words)); memset(words, '\0', sizeof(words));
for (i = 0; i < IN6ADDRSZ; i++) for (i = 0; i < IN6ADDRSZ; i++)
words[i/2] |= (src[i] << ((1 - (i % 2)) << 3)); words[i/2] |= (src[i] << ((1 - (i % 2)) << 3));