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

pkg: Use size_t print format specifier

This commit is contained in:
Frederik Haxel 2023-12-19 11:35:00 +01:00
parent ec7fe8d598
commit 1182de16fd
8 changed files with 24 additions and 22 deletions

View File

@ -349,8 +349,8 @@ static ssize_t _write(vfs_file_t *filp, const void *src, size_t nbytes)
mutex_lock(&fs->lock);
DEBUG("littlefs: write: filp=%p, fp=%p, src=%p, nbytes=%u\n",
(void *)filp, (void *)fp, (void *)src, (unsigned)nbytes);
DEBUG("littlefs: write: filp=%p, fp=%p, src=%p, nbytes=%" PRIuSIZE "\n",
(void *)filp, (void *)fp, (void *)src, nbytes);
ssize_t ret = lfs_file_write(&fs->fs, fp, src, nbytes);
mutex_unlock(&fs->lock);
@ -365,8 +365,8 @@ static ssize_t _read(vfs_file_t *filp, void *dest, size_t nbytes)
mutex_lock(&fs->lock);
DEBUG("littlefs: read: filp=%p, fp=%p, dest=%p, nbytes=%u\n",
(void *)filp, (void *)fp, (void *)dest, (unsigned)nbytes);
DEBUG("littlefs: read: filp=%p, fp=%p, dest=%p, nbytes=%" PRIuSIZE "\n",
(void *)filp, (void *)fp, (void *)dest, nbytes);
ssize_t ret = lfs_file_read(&fs->fs, fp, dest, nbytes);
mutex_unlock(&fs->lock);

View File

@ -354,8 +354,8 @@ static ssize_t _write(vfs_file_t *filp, const void *src, size_t nbytes)
mutex_lock(&fs->lock);
DEBUG("littlefs: write: filp=%p, fp=%p, src=%p, nbytes=%u\n",
(void *)filp, (void *)fp, (void *)src, (unsigned)nbytes);
DEBUG("littlefs: write: filp=%p, fp=%p, src=%p, nbytes=%" PRIuSIZE "\n",
(void *)filp, (void *)fp, (void *)src, nbytes);
ssize_t ret = lfs_file_write(&fs->fs, fp, src, nbytes);
mutex_unlock(&fs->lock);
@ -370,8 +370,8 @@ static ssize_t _read(vfs_file_t *filp, void *dest, size_t nbytes)
mutex_lock(&fs->lock);
DEBUG("littlefs: read: filp=%p, fp=%p, dest=%p, nbytes=%u\n",
(void *)filp, (void *)fp, (void *)dest, (unsigned)nbytes);
DEBUG("littlefs: read: filp=%p, fp=%p, dest=%p, nbytes=%" PRIuSIZE "\n",
(void *)filp, (void *)fp, (void *)dest, nbytes);
ssize_t ret = lfs_file_read(&fs->fs, fp, dest, nbytes);
mutex_unlock(&fs->lock);

View File

@ -118,7 +118,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: %d\n", (int)res);
DEBUG("sock_dtls: failed to send DTLS record: %" PRIdSIZE "\n", res);
}
return res;
}
@ -793,7 +793,7 @@ ssize_t sock_dtls_recv_aux(sock_dtls_t *sock, sock_dtls_session_t *remote,
res = sock_udp_recv_aux(sock->udp_sock, data, max_len, timeout,
&ep, (sock_udp_aux_rx_t *)aux);
if (res <= 0) {
DEBUG("sock_dtls: error receiving UDP packet: %d\n", (int)res);
DEBUG("sock_dtls: error receiving UDP packet: %" PRIdSIZE "\n", res);
return res;
}
@ -858,7 +858,7 @@ ssize_t sock_dtls_recv_buf_aux(sock_dtls_t *sock, sock_dtls_session_t *remote,
continue;
}
if (res < 0) {
DEBUG("sock_dtls: error receiving UDP packet: %d\n", (int)res);
DEBUG("sock_dtls: error receiving UDP packet: %" PRIdSIZE "\n", res);
return res;
}
@ -974,7 +974,7 @@ void _udp_cb(sock_udp_t *udp_sock, sock_async_flags_t flags, void *ctx)
ssize_t res = sock_udp_recv_buf(udp_sock, &data, &data_ctx, 0,
&remote_ep);
if (res <= 0) {
DEBUG("sock_dtls: error receiving UDP packet: %d\n", (int)res);
DEBUG("sock_dtls: error receiving UDP packet: %" PRIdSIZE "\n", res);
return;
}

View File

@ -6,6 +6,7 @@
* directory for more details.
*/
#include "architecture.h"
#include "vcdiff_mtd.h"
#include "assert.h"
#include <string.h>
@ -71,7 +72,7 @@ static int _align_write (vcdiff_mtd_t *mtd, uint8_t **src, size_t *len)
mtd->offset += copy_len;
*len -= copy_len;
*src += copy_len;
DEBUG("_align_write: buffered %zuB for alignment\n", copy_len);
DEBUG("_align_write: buffered %" PRIuSIZE "B for alignment\n", copy_len);
if (alignment_offset < CONFIG_TINYVCDIFF_MTD_WRITE_SIZE) {
/* we haven't collected enough bytes, yet */
@ -99,7 +100,7 @@ static int _write (void *dev, uint8_t *src, size_t offset, size_t len)
assert(offset == mtd->offset);
DEBUG("_write: 0x%zx + %zuB\n", mtd->offset, len);
DEBUG("_write: 0x%" PRIxSIZE " + %" PRIuSIZE "B\n", mtd->offset, len);
/* align writes */
rc = _align_write(dev, &src, &len);
@ -132,7 +133,7 @@ static int _write (void *dev, uint8_t *src, size_t offset, size_t len)
/* copy remaining bytes into write_buffer */
memcpy(mtd->write_buffer, src, len);
mtd->offset += len;
DEBUG("_write: buffered %zuB for alignment\n", len);
DEBUG("_write: buffered %" PRIuSIZE "B for alignment\n", len);
return rc;
}
@ -150,7 +151,7 @@ static int _flush (void *dev)
return 0;
}
DEBUG("_flush: write last %zuB\n", alignment_offset);
DEBUG("_flush: write last %" PRIuSIZE "B\n", alignment_offset);
/* get present bytes from MTD to pad alignment */
rc = mtd_read_page(mtd->dev, buf, 0, mtd->offset - alignment_offset,

View File

@ -46,7 +46,8 @@ tlsf_t _tlsf_get_global_control(void)
void tlsf_size_walker(void* ptr, size_t size, int used, void* user)
{
printf("\t%p %s size: %u (%p)\n", ptr, used ? "used" : "free", (unsigned int)size, ptr);
printf("\t%p %s size: %" PRIuSIZE " (%p)\n", ptr, used ? "used" : "free",
size, ptr);
if (used) {
((tlsf_size_container_t *)user)->used += (unsigned int)size;

View File

@ -182,7 +182,7 @@ static void *_lwm2m_client_run(void *arg)
lwm2m_client_connection_t *conn = lwm2m_client_connection_find(
_client_data->conn_list, &remote);
if (conn) {
DEBUG("lwm2m_connection_handle_packet(%i)\n", (int)rcv_len);
DEBUG("lwm2m_connection_handle_packet(%" PRIiSIZE ")\n", rcv_len);
int result = lwm2m_connection_handle_packet(conn, rcv_buf,
rcv_len,
_client_data);
@ -196,10 +196,10 @@ static void *_lwm2m_client_run(void *arg)
}
else if ((rcv_len < 0) &&
((rcv_len != -EAGAIN) && (rcv_len != -ETIMEDOUT))) {
DEBUG("Unexpected sock_udp_recv error code %i\n", (int)rcv_len);
DEBUG("Unexpected sock_udp_recv error code %" PRIiSIZE "\n", rcv_len);
}
else {
DEBUG("UDP error code: %i\n", (int)rcv_len);
DEBUG("UDP error code: %" PRIiSIZE "\n", rcv_len);
}
}
return NULL;

View File

@ -214,7 +214,7 @@ static int _connection_send(lwm2m_client_connection_t *conn, uint8_t *buffer,
ssize_t sent_bytes = sock_udp_send(&(client_data->sock), buffer,
buffer_size, &(conn->remote));
if (sent_bytes <= 0) {
DEBUG("[_connection_send] Could not send UDP packet: %i\n", (int)sent_bytes);
DEBUG("[_connection_send] Could not send UDP packet: %" PRIiSIZE "\n", sent_bytes);
return -1;
}
conn->last_send = lwm2m_gettime();

View File

@ -50,7 +50,7 @@ typedef struct {
static void _tlsf_size_walker(void* ptr, size_t size, int used, void* user)
{
printf("\t%p %s size: %u (%p)\n", ptr, used ? "used" : "free", (unsigned int)size, ptr);
printf("\t%p %s size: %" PRIuSIZE " (%p)\n", ptr, used ? "used" : "free", size, ptr);
if (used) {
((_tlsf_size_container_t *)user)->used += (unsigned int)size;