Skip to content

Commit a45744d

Browse files
author
Aiman Ismail
committed
examples/dtls-sock: change unsupported %zd to %d
1 parent 629607f commit a45744d

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

examples/dtls-sock/dtls-client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ static int client_send(char *addr_str, char *data, size_t datalen)
118118
res = credman_add(&credential);
119119
if (res < 0 && res != CREDMAN_EXIST) {
120120
/* ignore duplicate credentials */
121-
printf("Error cannot add credential to system: %zd\n", res);
121+
printf("Error cannot add credential to system: %d\n", (int)res);
122122
return -1;
123123
}
124124

125125
res = sock_dtls_session_create(&dtls_sock, &remote, &session);
126126
if (res < 0) {
127-
printf("Error creating session: %zd\n", res);
127+
printf("Error creating session: %d\n", (int)res);
128128
sock_dtls_close(&dtls_sock);
129129
sock_udp_close(&udp_sock);
130130
return -1;

examples/dtls-sock/dtls-server.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void *dtls_server_wrapper(void *arg)
103103
res = credman_add(&credential);
104104
if (res < 0 && res != CREDMAN_EXIST) {
105105
/* ignore duplicate credentials */
106-
printf("Error cannot add credential to system: %zd\n", res);
106+
printf("Error cannot add credential to system: %d\n", (int)res);
107107
return NULL;
108108
}
109109

@@ -116,14 +116,14 @@ void *dtls_server_wrapper(void *arg)
116116
10 * US_PER_SEC);
117117
if (res < 0) {
118118
if (res != -ETIMEDOUT) {
119-
printf("Error receiving UDP over DTLS %zd", res);
119+
printf("Error receiving UDP over DTLS %d", (int)res);
120120
}
121121
continue;
122122
}
123-
printf("Received %zd bytes -- (echo!)\n", res);
123+
printf("Received %d bytes -- (echo!)\n", (int)res);
124124
res = sock_dtls_send(&sock, &session, rcv, (size_t)res);
125125
if (res < 0) {
126-
printf("Error resending DTLS message: %zd", res);
126+
printf("Error resending DTLS message: %d", (int)res);
127127
}
128128
}
129129
}

pkg/tinydtls/contrib/sock_dtls.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static int _write(struct dtls_context_t *ctx, session_t *session, uint8_t *buf,
110110

111111
ssize_t res = sock_udp_send(sock->udp_sock, buf, len, &remote);
112112
if (res < 0) {
113-
DEBUG("sock_dtls: failed to send DTLS record: %zd\n", res);
113+
DEBUG("sock_dtls: failed to send DTLS record: %d\n", (int)res);
114114
}
115115
return res;
116116
}
@@ -298,7 +298,7 @@ int sock_dtls_session_create(sock_dtls_t *sock, const sock_udp_ep_t *ep,
298298
DEBUG("sock_dtls: starting handshake\n");
299299
res = dtls_connect(sock->dtls_ctx, &remote->dtls_session);
300300
if (res < 0) {
301-
DEBUG("sock_dtls: error establishing a session: %zd\n", res);
301+
DEBUG("sock_dtls: error establishing a session: %d\n", (int)res);
302302
return -ENOMEM;
303303
}
304304
else if (res == 0) {
@@ -312,7 +312,7 @@ int sock_dtls_session_create(sock_dtls_t *sock, const sock_udp_ep_t *ep,
312312
res = sock_udp_recv(sock->udp_sock, rcv_buffer, sizeof(rcv_buffer),
313313
DTLS_HANDSHAKE_TIMEOUT, &remote->ep);
314314
if (res <= 0) {
315-
DEBUG("sock_dtls: error receiving handshake messages: %zd\n", res);
315+
DEBUG("sock_dtls: error receiving handshake messages: %d\n", (int)res);
316316
/* deletes peer created in dtls_connect() */
317317
dtls_peer_t *peer = dtls_get_peer(sock->dtls_ctx,
318318
&remote->dtls_session);
@@ -399,7 +399,7 @@ ssize_t sock_dtls_recv(sock_dtls_t *sock, sock_dtls_session_t *remote,
399399
ssize_t res = sock_udp_recv(sock->udp_sock, data, max_len, timeout,
400400
&remote->ep);
401401
if (res <= 0) {
402-
DEBUG("sock_dtls: error receiving UDP packet: %zd\n", res);
402+
DEBUG("sock_dtls: error receiving UDP packet: %d\n", (int)res);
403403
return res;
404404
}
405405

0 commit comments

Comments
 (0)