Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
netperf: 64 bit compilation issues with size_t
Browse files Browse the repository at this point in the history
Change-Id: Ic7f3d7837c9fb1538032cb7d887aca672c87820d
  • Loading branch information
Mark Salyzyn committed Apr 25, 2014
1 parent ee5fe13 commit 1a75dd0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions netlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ allocate_buffer_ring(int width, int buffer_size, int alignment, int offset)
/* get the ring element */
temp_link = (struct ring_elt *)malloc(sizeof(struct ring_elt));
if (temp_link == NULL) {
printf("malloc(%u) failed!\n", sizeof(struct ring_elt));
printf("malloc(%zu) failed!\n", sizeof(struct ring_elt));
exit(1);
}
/* remember the first one so we can close the ring at the end */
Expand Down Expand Up @@ -1676,10 +1676,10 @@ alloc_sendfile_buf_ring(int width,
void
dump_request()
{
int counter = 0;
size_t counter = 0;
fprintf(where,"request contents:\n");
for (counter = 0; counter < ((sizeof(netperf_request)/4)-3); counter += 4) {
fprintf(where,"%d:\t%8x %8x %8x %8x \t|%4.4s| |%4.4s| |%4.4s| |%4.4s|\n",
fprintf(where,"%zu:\t%8x %8x %8x %8x \t|%4.4s| |%4.4s| |%4.4s| |%4.4s|\n",
counter,
request_array[counter],
request_array[counter+1],
Expand Down Expand Up @@ -1707,11 +1707,11 @@ fflush(where);
void
dump_response()
{
int counter = 0;
size_t counter = 0;

fprintf(where,"response contents\n");
for (counter = 0; counter < ((sizeof(netperf_response)/4)-3); counter += 4) {
fprintf(where,"%d:\t%8x %8x %8x %8x \t>%4.4s< >%4.4s< >%4.4s< >%4.4s<\n",
fprintf(where,"%zu:\t%8x %8x %8x %8x \t>%4.4s< >%4.4s< >%4.4s< >%4.4s<\n",
counter,
response_array[counter],
response_array[counter+1],
Expand Down Expand Up @@ -2113,7 +2113,7 @@ set_nonblock (SOCKET sock)
void
send_request()
{
int counter=0;
size_t counter=0;

/* display the contents of the request if the debug level is high */
/* enough. otherwise, just send the darned thing ;-) */
Expand Down Expand Up @@ -2144,7 +2144,7 @@ send_request()
dump_request();

fprintf(where,
"\nsend_request: about to send %u bytes from %p\n",
"\nsend_request: about to send %zu bytes from %p\n",
sizeof(netperf_request),
&netperf_request);
fflush(where);
Expand Down Expand Up @@ -2175,15 +2175,15 @@ send_request()
void
send_response()
{
int counter=0;
size_t counter=0;
int bytes_sent;

/* display the contents of the request if the debug level is high */
/* enough. otherwise, just send the darned thing ;-) */

if (debug > 1) {
fprintf(where,
"send_response: contents of %u ints before htonl\n",
"send_response: contents of %zu ints before htonl\n",
sizeof(netperf_response)/4);
dump_response();
}
Expand All @@ -2203,7 +2203,7 @@ send_response()
"send_response: contents after htonl\n");
dump_response();
fprintf(where,
"about to send %u bytes from %p\n",
"about to send %zu bytes from %p\n",
sizeof(netperf_response),
&netperf_response);
fflush(where);
Expand Down Expand Up @@ -2241,7 +2241,7 @@ int tot_bytes_recvd,
bytes_left;
char *buf = (char *)&netperf_request;
int buflen = sizeof(netperf_request);
int counter;
size_t counter;

tot_bytes_recvd = 0;
bytes_recvd = 0; /* nt_lint; bytes_recvd uninitialized if buflen == 0 */
Expand Down Expand Up @@ -2352,7 +2352,7 @@ int tot_bytes_recvd,
bytes_left;
char *buf = (char *)&netperf_response;
int buflen = sizeof(netperf_response);
int counter;
size_t counter;

/* stuff for select, use fd_set for better compliance */
fd_set readfds;
Expand Down Expand Up @@ -2392,7 +2392,7 @@ if ((counter = select(FD_SETSIZE,
0,
&timeout)) != 1) {
fprintf(where,
"netperf: receive_response: no response received. errno %d counter %d\n",
"netperf: receive_response: no response received. errno %d counter %zu\n",
errno,
counter);
exit(1);
Expand Down
2 changes: 1 addition & 1 deletion netserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ main(int argc, char *argv[])
/* Save away the program name */
program = (char *)malloc(strlen(argv[0]) + 1);
if (program == NULL) {
printf("malloc(%d) failed!\n", strlen(argv[0]) + 1);
printf("malloc(%zu) failed!\n", strlen(argv[0]) + 1);
return 1 ;
}
strcpy(program, argv[0]);
Expand Down
2 changes: 1 addition & 1 deletion netsh.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ scan_cmd_line(int argc, char *argv[])

program = (char *)malloc(strlen(argv[0]) + 1);
if (program == NULL) {
printf("malloc(%d) failed!\n", strlen(argv[0]) + 1);
printf("malloc(%zu) failed!\n", strlen(argv[0]) + 1);
exit(1);
}
strcpy(program, argv[0]);
Expand Down

0 comments on commit 1a75dd0

Please sign in to comment.