From: Florian Forster Date: Tue, 17 Feb 2009 13:52:33 +0000 (+0100) Subject: src/{lib,}oping.c: Don't cast `size_t' to `unsigned int' when printing. X-Git-Tag: liboping-1.0.0~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=b82a01374a7721d8613617e145c4e7339cfbbc2f;p=liboping.git src/{lib,}oping.c: Don't cast `size_t' to `unsigned int' when printing. Use the "%zu" format string instead. --- diff --git a/src/liboping.c b/src/liboping.c index 99d491a..e318145 100644 --- a/src/liboping.c +++ b/src/liboping.c @@ -394,7 +394,7 @@ static int ping_receive_one (int fd, pinghost_t *ph, struct timeval *now) return (-1); } - dprintf ("Read %u bytes from fd = %i\n", (unsigned int) buffer_len, fd); + dprintf ("Read %zu bytes from fd = %i\n", buffer_len, fd); if (sa.ss_family == AF_INET) { diff --git a/src/oping.c b/src/oping.c index 3201e85..0c759c1 100644 --- a/src/oping.c +++ b/src/oping.c @@ -196,16 +196,16 @@ void print_host (pingobj_iter_t *iter) if ((context->latency_min < 0.0) || (context->latency_min > latency)) context->latency_min = latency; - printf ("%u bytes from %s (%s): icmp_seq=%u time=%.2f ms\n", - (unsigned int) data_len, + printf ("%zu bytes from %s (%s): icmp_seq=%u time=%.2f ms\n", + data_len, context->host, context->addr, - (unsigned int) sequence, latency); + sequence, latency); } else { printf ("echo reply from %s (%s): icmp_seq=%u timeout\n", context->host, context->addr, - (unsigned int) sequence); + sequence); } } @@ -344,8 +344,8 @@ int main (int argc, char **argv) buffer_size = 0; ping_iterator_get_info (iter, PING_INFO_DATA, NULL, &buffer_size); - printf ("PING %s (%s) %u bytes of data.\n", - context->host, context->addr, (unsigned int) buffer_size); + printf ("PING %s (%s) %zu bytes of data.\n", + context->host, context->addr, buffer_size); ping_iterator_set_context (iter, (void *) context);