diff --git a/src/iperf.h b/src/iperf.h index b656784..f55994f 100755 --- a/src/iperf.h +++ b/src/iperf.h @@ -46,6 +46,18 @@ #include #endif /* HAVE_CPUSET_SETAFFINITY */ +#if defined(HAVE_INTTYPES_H) +# include +#else +# ifndef PRIu64 +# if sizeof(long) == 8 +# define PRIu64 "lu" +# else +# define PRIu64 "llu" +# endif +# endif +#endif + #include "timer.h" #include "queue.h" #include "cjson.h" diff --git a/src/iperf_api.c b/src/iperf_api.c index 4af8e50..8cf0eb4 100755 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -2486,7 +2486,7 @@ iperf_print_intermediate(struct iperf_test *test) double interval_len = timeval_diff(&irp->interval_start_time, &irp->interval_end_time); if (test->debug) { - printf("interval_len %f bytes_transferred %lu\n", interval_len, irp->bytes_transferred); + printf("interval_len %f bytes_transferred %" PRIu64 "\n", interval_len, irp->bytes_transferred); } /* diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c index 94beeeb..737cd8a 100644 --- a/src/iperf_client_api.c +++ b/src/iperf_client_api.c @@ -53,7 +53,10 @@ int iperf_create_streams(struct iperf_test *test) { - int i, s, saved_errno; + int i, s; +#if defined(HAVE_TCP_CONGESTION) + int saved_errno; +#endif /* HAVE_TCP_CONGESTION */ struct iperf_stream *sp; int orig_bind_port = test->bind_port; diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index 4283dc3..5fa1dd7 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -385,7 +385,10 @@ cleanup_server(struct iperf_test *test) int iperf_run_server(struct iperf_test *test) { - int result, s, streams_accepted, saved_errno; + int result, s, streams_accepted; +#if defined(HAVE_TCP_CONGESTION) + int saved_errno; +#endif /* HAVE_TCP_CONGESTION */ fd_set read_set, write_set; struct iperf_stream *sp; struct timeval now; diff --git a/src/iperf_tcp.c b/src/iperf_tcp.c index 6f86d5d..8dbe74a 100644 --- a/src/iperf_tcp.c +++ b/src/iperf_tcp.c @@ -42,12 +42,6 @@ #include "net.h" #include "cjson.h" -#if defined(HAVE_INTTYPES_H) -# include -#else -# define PRIu64 "llu" -#endif - #if defined(HAVE_FLOWLABEL) #include "flowlabel.h" #endif /* HAVE_FLOWLABEL */