From e0a02705b2df4c8e8aae88f67f9c513584fa44c5 Mon Sep 17 00:00:00 2001 From: Aiman Ismail Date: Fri, 28 Feb 2020 18:06:04 +0100 Subject: [PATCH] examples/dtls-sock: change unsupported %zd to %d --- examples/dtls-sock/dtls-client.c | 4 ++-- examples/dtls-sock/dtls-server.c | 8 ++++---- pkg/tinydtls/contrib/sock_dtls.c | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/dtls-sock/dtls-client.c b/examples/dtls-sock/dtls-client.c index 0203549609..76c524a86b 100644 --- a/examples/dtls-sock/dtls-client.c +++ b/examples/dtls-sock/dtls-client.c @@ -118,13 +118,13 @@ static int client_send(char *addr_str, char *data, size_t datalen) res = credman_add(&credential); if (res < 0 && res != CREDMAN_EXIST) { /* ignore duplicate credentials */ - printf("Error cannot add credential to system: %zd\n", res); + printf("Error cannot add credential to system: %d\n", (int)res); return -1; } res = sock_dtls_session_create(&dtls_sock, &remote, &session); if (res < 0) { - printf("Error creating session: %zd\n", res); + printf("Error creating session: %d\n", (int)res); sock_dtls_close(&dtls_sock); sock_udp_close(&udp_sock); return -1; diff --git a/examples/dtls-sock/dtls-server.c b/examples/dtls-sock/dtls-server.c index 66a95f84e6..b2c5004c01 100644 --- a/examples/dtls-sock/dtls-server.c +++ b/examples/dtls-sock/dtls-server.c @@ -103,7 +103,7 @@ void *dtls_server_wrapper(void *arg) res = credman_add(&credential); if (res < 0 && res != CREDMAN_EXIST) { /* ignore duplicate credentials */ - printf("Error cannot add credential to system: %zd\n", res); + printf("Error cannot add credential to system: %d\n", (int)res); return NULL; } @@ -116,14 +116,14 @@ void *dtls_server_wrapper(void *arg) 10 * US_PER_SEC); if (res < 0) { if (res != -ETIMEDOUT) { - printf("Error receiving UDP over DTLS %zd", res); + printf("Error receiving UDP over DTLS %d", (int)res); } continue; } - printf("Received %zd bytes -- (echo!)\n", res); + printf("Received %d bytes -- (echo!)\n", (int)res); res = sock_dtls_send(&sock, &session, rcv, (size_t)res); if (res < 0) { - printf("Error resending DTLS message: %zd", res); + printf("Error resending DTLS message: %d", (int)res); } } } diff --git a/pkg/tinydtls/contrib/sock_dtls.c b/pkg/tinydtls/contrib/sock_dtls.c index dade37af73..a255d31259 100644 --- a/pkg/tinydtls/contrib/sock_dtls.c +++ b/pkg/tinydtls/contrib/sock_dtls.c @@ -98,7 +98,7 @@ static int _write(struct dtls_context_t *ctx, session_t *session, uint8_t *buf, ssize_t res = sock_udp_send(sock->udp_sock, buf, len, &remote); if (res < 0) { - DEBUG("sock_dtls: failed to send DTLS record: %zd\n", res); + DEBUG("sock_dtls: failed to send DTLS record: %d\n", (int)res); } return res; } @@ -287,7 +287,7 @@ int sock_dtls_session_create(sock_dtls_t *sock, const sock_udp_ep_t *ep, DEBUG("sock_dtls: starting handshake\n"); res = dtls_connect(sock->dtls_ctx, &remote->dtls_session); if (res < 0) { - DEBUG("sock_dtls: error establishing a session: %zd\n", res); + DEBUG("sock_dtls: error establishing a session: %d\n", (int)res); return -ENOMEM; } else if (res == 0) { @@ -301,7 +301,7 @@ int sock_dtls_session_create(sock_dtls_t *sock, const sock_udp_ep_t *ep, res = sock_udp_recv(sock->udp_sock, rcv_buffer, sizeof(rcv_buffer), DTLS_HANDSHAKE_TIMEOUT, &remote->ep); if (res <= 0) { - DEBUG("sock_dtls: error receiving handshake messages: %zd\n", res); + DEBUG("sock_dtls: error receiving handshake messages: %d\n", (int)res); /* deletes peer created in dtls_connect() */ dtls_peer_t *peer = dtls_get_peer(sock->dtls_ctx, &remote->dtls_session); @@ -397,7 +397,7 @@ ssize_t sock_dtls_recv(sock_dtls_t *sock, sock_dtls_session_t *remote, ssize_t res = sock_udp_recv(sock->udp_sock, data, max_len, timeout, &remote->ep); if (res <= 0) { - DEBUG("sock_dtls: error receiving UDP packet: %zd\n", res); + DEBUG("sock_dtls: error receiving UDP packet: %d\n", (int)res); return res; }