Skip to content

Commit

Permalink
Merge pull request #1713 from neheb/patch-1
Browse files Browse the repository at this point in the history
fix crash under big endian musl
  • Loading branch information
bmah888 authored Aug 13, 2024
2 parents f89aee0 + d976d43 commit 67ca2c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/iperf_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -2085,14 +2085,14 @@ int test_is_authorized(struct iperf_test *test){
int ret = check_authentication(username, password, ts, test->server_authorized_users, test->server_skew_threshold);
if (ret == 0){
if (test->debug) {
iperf_printf(test, report_authentication_succeeded, username, ts);
iperf_printf(test, report_authentication_succeeded, username, (uint64_t)ts);
}
free(username);
free(password);
return 0;
} else {
if (test->debug) {
iperf_printf(test, report_authentication_failed, ret, username, ts);
iperf_printf(test, report_authentication_failed, ret, username, (uint64_t)ts);
}
free(username);
free(password);
Expand Down Expand Up @@ -3594,7 +3594,7 @@ iperf_print_intermediate(struct iperf_test *test)

iperf_size_t bytes = 0;
double bandwidth;
int retransmits = 0;
int64_t retransmits = 0;
double start_time, end_time;

int64_t total_packets = 0, lost_packets = 0;
Expand Down Expand Up @@ -3670,7 +3670,7 @@ iperf_print_intermediate(struct iperf_test *test)
if (test->sender_has_retransmits == 1 && stream_must_be_sender) {
/* Interval sum, TCP with retransmits. */
if (test->json_output)
cJSON_AddItemToObject(json_interval, sum_name, iperf_json_printf("start: %f end: %f seconds: %f bytes: %d bits_per_second: %f retransmits: %d omitted: %b sender: %b", (double) start_time, (double) end_time, (double) irp->interval_duration, (int64_t) bytes, bandwidth * 8, (int64_t) retransmits, irp->omitted, stream_must_be_sender)); /* XXX irp->omitted or test->omitting? */
cJSON_AddItemToObject(json_interval, sum_name, iperf_json_printf("start: %f end: %f seconds: %f bytes: %d bits_per_second: %f retransmits: %d omitted: %b sender: %b", (double) start_time, (double) end_time, (double) irp->interval_duration, (int64_t) bytes, bandwidth * 8, retransmits, irp->omitted, stream_must_be_sender)); /* XXX irp->omitted or test->omitting? */
else
iperf_printf(test, report_sum_bw_retrans_format, mbuf, start_time, end_time, ubuf, nbuf, retransmits, irp->omitted?report_omitted:""); /* XXX irp->omitted or test->omitting? */
} else {
Expand Down
16 changes: 8 additions & 8 deletions src/iperf_locale.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ const char test_start_time[] =
"Starting Test: protocol: %s, %d streams, %d byte blocks, omitting %d seconds, %d second test, tos %d\n";

const char test_start_bytes[] =
"Starting Test: protocol: %s, %d streams, %d byte blocks, omitting %d seconds, %llu bytes to send, tos %d\n";
"Starting Test: protocol: %s, %d streams, %d byte blocks, omitting %d seconds, %"PRIuFAST64" bytes to send, tos %d\n";

const char test_start_blocks[] =
"Starting Test: protocol: %s, %d streams, %d byte blocks, omitting %d seconds, %d blocks to send, tos %d\n";
"Starting Test: protocol: %s, %d streams, %d byte blocks, omitting %d seconds, %"PRIuFAST64" bytes to send, tos %d\n";


/* -------------------------------------------------------------------
Expand All @@ -309,10 +309,10 @@ const char report_connecting[] =
"Connecting to host %s, port %d\n";

const char report_authentication_succeeded[] =
"Authentication succeeded for user '%s' ts %ld\n";
"Authentication succeeded for user '%s' ts %" PRIu64 "\n";

const char report_authentication_failed[] =
"Authentication failed with return code %d for user '%s' ts %ld\n";
"Authentication failed with return code %d for user '%s' ts %" PRIu64 "\n";

const char report_reverse[] =
"Reverse mode, remote host %s is sending\n";
Expand Down Expand Up @@ -381,10 +381,10 @@ const char report_bw_format[] =
"[%3d]%s %6.2f-%-6.2f sec %ss %ss/sec %s\n";

const char report_bw_retrans_format[] =
"[%3d]%s %6.2f-%-6.2f sec %ss %ss/sec %3u %s\n";
"[%3d]%s %6.2f-%-6.2f sec %ss %ss/sec %3ld %s\n";

const char report_bw_retrans_cwnd_format[] =
"[%3d]%s %6.2f-%-6.2f sec %ss %ss/sec %3u %ss %s\n";
"[%3d]%s %6.2f-%-6.2f sec %ss %ss/sec %3ld %ss %s\n";

const char report_bw_udp_format[] =
"[%3d]%s %6.2f-%-6.2f sec %ss %ss/sec %5.3f ms %" PRId64 "/%" PRId64 " (%.2g%%) %s\n";
Expand All @@ -402,7 +402,7 @@ const char report_sum_bw_format[] =
"[SUM]%s %6.2f-%-6.2f sec %ss %ss/sec %s\n";

const char report_sum_bw_retrans_format[] =
"[SUM]%s %6.2f-%-6.2f sec %ss %ss/sec %3d %s\n";
"[SUM]%s %6.2f-%-6.2f sec %ss %ss/sec %3"PRId64" %s\n";

const char report_sum_bw_udp_format[] =
"[SUM]%s %6.2f-%-6.2f sec %ss %ss/sec %5.3f ms %" PRId64 "/%" PRId64 " (%.2g%%) %s\n";
Expand All @@ -419,7 +419,7 @@ const char report_outoforder[] =
"[%3d]%s %4.1f-%4.1f sec %d datagrams received out-of-order\n";

const char report_sum_outoforder[] =
"[SUM]%s %4.1f-%4.1f sec %d datagrams received out-of-order\n";
"[SUM]%s %4.1f-%4.1f sec %"PRIu64" datagrams received out-of-order\n";

const char report_peer[] =
"[%3d] local %s port %u connected with %s port %u\n";
Expand Down

0 comments on commit 67ca2c8

Please sign in to comment.