Make the loop index an int, and just cast the (small) size of an IPv6
address, in units of two-byte chunks, to int.
Use int rather than long for the base and length; they'll never be large
enough to require a long.
size_t space_left, added_space;
int snprintfed;
struct {
- long base;
- long len;
+ int base;
+ int len;
} best, cur;
u_long words [IN6ADDRSZ / INT16SZ];
- u_int i;
+ int i;
/* Preprocess:
* Copy the input (bytewise) array into a wordwise array.
best.base = -1;
cur.len = 0;
cur.base = -1;
- for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++)
+ for (i = 0; i < (int)(IN6ADDRSZ / INT16SZ); i++)
{
if (words[i] == 0)
{
*dp++ = c; \
space_left--; \
}
- for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++)
+ for (i = 0; i < (int)(IN6ADDRSZ / INT16SZ); i++)
{
/* Are we inside the best run of 0x00's?
*/