mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-23 18:14:29 +08:00
Clean up some stuff.
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.
This commit is contained in:
parent
a9bf782e96
commit
d1a2d18539
10
addrtostr.c
10
addrtostr.c
@ -110,11 +110,11 @@ addrtostr6 (const void *src, char *dst, size_t size)
|
||||
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.
|
||||
@ -128,7 +128,7 @@ addrtostr6 (const void *src, char *dst, size_t size)
|
||||
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)
|
||||
{
|
||||
@ -161,7 +161,7 @@ addrtostr6 (const void *src, char *dst, size_t size)
|
||||
*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?
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user