From 2949cfa7c81a5b21121e3f1dbc44b3adefb09f9a Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Mon, 18 May 2020 14:18:07 +0200 Subject: Fix format strings as reported by cpp-check. --- programs/rtcweb.c | 8 ++++---- programs/st_client.c | 8 ++++---- programs/tsctp.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'programs') diff --git a/programs/rtcweb.c b/programs/rtcweb.c index e0d3684a..d064b852 100644 --- a/programs/rtcweb.c +++ b/programs/rtcweb.c @@ -619,7 +619,7 @@ handle_open_request_message(struct peer_connection *pc, uint8_t unordered; if ((channel = find_channel_by_i_stream(pc, i_stream))) { - printf("handle_open_request_message: channel %d is in state %d instead of CLOSED.\n", + printf("handle_open_request_message: channel %u is in state %u instead of CLOSED.\n", channel->id, channel->state); /* XXX: some error handling */ return; @@ -707,12 +707,12 @@ handle_open_response_message(struct peer_connection *pc, } if (channel->state != DATA_CHANNEL_CONNECTING) { /* XXX: improve error handling */ - printf("handle_open_response_message: Channel with id %d for outgoing steam %d is in state %d.\n", channel->id, o_stream, channel->state); + printf("handle_open_response_message: Channel with id %u for outgoing steam %u is in state %u.\n", channel->id, o_stream, channel->state); return; } if (find_channel_by_i_stream(pc, i_stream)) { /* XXX: improve error handling */ - printf("handle_open_response_message: Channel collision for channel with id %d and streams (in/out) = (%d/%d).\n", channel->id, i_stream, o_stream); + printf("handle_open_response_message: Channel collision for channel with id %u and streams (in/out) = (%u/%u).\n", channel->id, i_stream, o_stream); return; } channel->i_stream = i_stream; @@ -778,7 +778,7 @@ handle_data_message(struct peer_connection *pc, } else { /* Assuming DATA_CHANNEL_PPID_DOMSTRING */ /* XXX: Protect for non 0 terminated buffer */ - printf("Message received of length %zu on channel with id %d: %.*s\n", + printf("Message received of length %zu on channel with id %u: %.*s\n", length, channel->id, (int)length, buffer); } return; diff --git a/programs/st_client.c b/programs/st_client.c index 49250bce..f0b8b946 100644 --- a/programs/st_client.c +++ b/programs/st_client.c @@ -182,7 +182,7 @@ on_socket_readable(struct socket* s) { if (flags & MSG_NOTIFICATION) { printf("Notification of length %d received.\n", (int)retval); } else { - printf("Msg of length %d received via %p:%u on stream %d with SSN %u and TSN %u, PPID %d, context %u.\n", + printf("Msg of length %d received via %p:%u on stream %d with SSN %u and TSN %u, PPID %u, context %u.\n", (int)retval, addr.sconn.sconn_addr, ntohs(addr.sconn.sconn_port), @@ -281,7 +281,7 @@ main(int argc, char *argv[]) /* set up a connected UDP socket */ #ifdef _WIN32 if ((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == INVALID_SOCKET) { - printf("socket() failed with error: %ld\n", WSAGetLastError()); + printf("socket() failed with error: %d\n", WSAGetLastError()); return (-1); } #else @@ -302,7 +302,7 @@ main(int argc, char *argv[]) } #ifdef _WIN32 if (bind(fd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in)) == SOCKET_ERROR) { - printf("bind() failed with error: %ld\n", WSAGetLastError()); + printf("bind() failed with error: %d\n", WSAGetLastError()); return (-1); } #else @@ -323,7 +323,7 @@ main(int argc, char *argv[]) } #ifdef _WIN32 if (connect(fd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in)) == SOCKET_ERROR) { - printf("connect() failed with error: %ld\n", WSAGetLastError()); + printf("connect() failed with error: %d\n", WSAGetLastError()); return (-1); } #else diff --git a/programs/tsctp.c b/programs/tsctp.c index c2fa4aed..fa4d9989 100644 --- a/programs/tsctp.c +++ b/programs/tsctp.c @@ -793,7 +793,7 @@ int main(int argc, char **argv) gettimeofday(&time_now, NULL); timersub(&time_now, &time_start, &time_diff); seconds = time_diff.tv_sec + (double)time_diff.tv_usec/1000000; - printf("%s of %ld messages of length %u took %f seconds.\n", + printf("%s of %lu messages of length %u took %f seconds.\n", "Sending", messages, length, seconds); throughput = (double)messages * (double)length / seconds; printf("Throughput was %f Byte/sec.\n", throughput); -- cgit v1.2.3