1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

examples/dtls-sock: change unsupported %zd to %d

This commit is contained in:
Aiman Ismail 2020-02-28 18:06:04 +01:00
parent aa3cbacceb
commit e0a02705b2
3 changed files with 10 additions and 10 deletions

View File

@ -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;

View File

@ -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);
}
}
}

View File

@ -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;
}