getaddrinfo_test: fix -Wsign-compare warnings
MFC after: 3 days Sponsored by: Dell EMC Isilon
This commit is contained in:
parent
93936a0653
commit
905de51259
@ -164,30 +164,30 @@ sdump_addrinfo(struct addrinfo *ai, char *buffer, size_t buflen)
|
|||||||
ai->ai_flags, ai->ai_family, ai->ai_socktype, ai->ai_protocol,
|
ai->ai_flags, ai->ai_family, ai->ai_socktype, ai->ai_protocol,
|
||||||
ai->ai_addrlen);
|
ai->ai_addrlen);
|
||||||
buffer += written;
|
buffer += written;
|
||||||
if (written > buflen)
|
if (written > (int)buflen)
|
||||||
return;
|
return;
|
||||||
buflen -= written;
|
buflen -= written;
|
||||||
|
|
||||||
written = snprintf(buffer, buflen, "%s ",
|
written = snprintf(buffer, buflen, "%s ",
|
||||||
ai->ai_canonname == NULL ? "(null)" : ai->ai_canonname);
|
ai->ai_canonname == NULL ? "(null)" : ai->ai_canonname);
|
||||||
buffer += written;
|
buffer += written;
|
||||||
if (written > buflen)
|
if (written > (int)buflen)
|
||||||
return;
|
return;
|
||||||
buflen -= written;
|
buflen -= written;
|
||||||
|
|
||||||
if (ai->ai_addr == NULL) {
|
if (ai->ai_addr == NULL) {
|
||||||
written = snprintf(buffer, buflen, "(null)");
|
written = snprintf(buffer, buflen, "(null)");
|
||||||
buffer += written;
|
buffer += written;
|
||||||
if (written > buflen)
|
if (written > (int)buflen)
|
||||||
return;
|
return;
|
||||||
buflen -= written;
|
buflen -= written;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < ai->ai_addrlen; i++) {
|
for (i = 0; i < (int)ai->ai_addrlen; i++) {
|
||||||
written = snprintf(buffer, buflen,
|
written = snprintf(buffer, buflen,
|
||||||
i + 1 != ai->ai_addrlen ? "%d." : "%d",
|
i + 1 != (int)ai->ai_addrlen ? "%d." : "%d",
|
||||||
((unsigned char *)ai->ai_addr)[i]);
|
((unsigned char *)ai->ai_addr)[i]);
|
||||||
buffer += written;
|
buffer += written;
|
||||||
if (written > buflen)
|
if (written > (int)buflen)
|
||||||
return;
|
return;
|
||||||
buflen -= written;
|
buflen -= written;
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ sdump_addrinfo(struct addrinfo *ai, char *buffer, size_t buflen)
|
|||||||
if (ai->ai_next != NULL) {
|
if (ai->ai_next != NULL) {
|
||||||
written = snprintf(buffer, buflen, ":");
|
written = snprintf(buffer, buflen, ":");
|
||||||
buffer += written;
|
buffer += written;
|
||||||
if (written > buflen)
|
if (written > (int)buflen)
|
||||||
return;
|
return;
|
||||||
buflen -= written;
|
buflen -= written;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user