1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-28 23:29:45 +01:00

sys: Use size_t print format specifier

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
This commit is contained in:
Frederik Haxel 2023-12-19 11:30:50 +01:00
parent b5a43801fb
commit 64ba553d1f
38 changed files with 165 additions and 152 deletions

View File

@ -76,10 +76,10 @@ int conn_can_raw_set_filter(conn_can_raw_t *conn, struct can_filter *filter, siz
assert(conn != NULL);
assert(filter != NULL || count == 0);
DEBUG("conn_can_raw_set_filter: conn=%p, filter=%p, count=%u\n",
(void *)conn, (void *)filter, (unsigned)count);
DEBUG("conn_can_raw_set_filter: conn->filter=%p, conn->count=%u\n",
(void *)conn->filter, (unsigned)conn->count);
DEBUG("conn_can_raw_set_filter: conn=%p, filter=%p, count=%" PRIuSIZE "\n",
(void *)conn, (void *)filter, count);
DEBUG("conn_can_raw_set_filter: conn->filter=%p, conn->count=%" PRIuSIZE "\n",
(void *)conn->filter, conn->count);
/* unset previous filters */
if (conn->count) {

View File

@ -497,7 +497,8 @@ static void _isotp_fill_dataframe(struct isotp *isotp, struct can_frame *frame,
frame->can_id = isotp->opt.tx_id;
frame->can_dlc = num_bytes + pci_len;
DEBUG("_isotp_fill_dataframe: num_bytes=%d, pci_len=%d\n", (unsigned)num_bytes, (unsigned)pci_len);
DEBUG("_isotp_fill_dataframe: num_bytes=%" PRIuSIZE ", pci_len=%" PRIuSIZE "\n",
num_bytes, pci_len);
if (num_bytes < space) {
if (isotp->opt.flags & CAN_ISOTP_TX_PADDING) {

View File

@ -21,6 +21,7 @@
#include <string.h>
#include <stdio.h>
#include "architecture.h"
#include "clif.h"
#include "clif_internal.h"
@ -83,7 +84,7 @@ ssize_t clif_decode_link(clif_t *link, clif_attr_t *attrs, unsigned attrs_len,
link->attrs = attrs;
pos += size + 1; /* escape the '>' */
DEBUG("Found target (%u): %.*s\n", (unsigned)size, (unsigned)size,
DEBUG("Found target (%" PRIiSIZE "): %.*s\n", size, (unsigned)size,
link->target);
/* if there is no attr array iterate over the buffer, if not until all
@ -129,7 +130,7 @@ ssize_t clif_add_target_from_buffer(const char *target, size_t target_len, char
assert(target);
size_t pos = 0;
DEBUG("Adding target: %.*s, len: %d\n", target_len, target, target_len);
DEBUG("Adding target: %.*s, len: %" PRIuSIZE "\n", (int)target_len, target, target_len);
if (!buf) {
return target_len + 2; /* size after adding '<' and '>' */

View File

@ -19,6 +19,7 @@
*/
#include <string.h>
#include "architecture.h"
#include "bitfield.h"
#include "coding/xor.h"
@ -107,7 +108,7 @@ static bool _recover_byte(const uint8_t *in, size_t width, uint8_t height,
/* get index of neighbor byte in transposed matrix */
size_t idx_in = _transpose_idx(i, height, width);
if (!bf_isset(bitfield, idx_in / block_size)) {
DEBUG("missing chunk %u\n", idx_in / block_size);
DEBUG("missing chunk %" PRIuSIZE "\n", idx_in / block_size);
return false;
}
res ^= in[idx_in];
@ -133,7 +134,7 @@ static bool _recover_blocks(void *data, size_t len, const uint8_t *parity,
continue;
}
DEBUG("try to recover chunk %u / %u\n", i / block_size, num_data_blocks);
DEBUG("try to recover chunk %" PRIuSIZE " / %u\n", i / block_size, num_data_blocks);
for (size_t j = i; j < i + block_size; ++j) {
/* get original byte position */
@ -142,7 +143,7 @@ static bool _recover_blocks(void *data, size_t len, const uint8_t *parity,
/* we can only recover the byte if we have the matching parity block */
size_t parity_block = idx / (CONFIG_CODING_XOR_CHECK_BYTES * block_size);
if (!bf_isset(bitfield, num_data_blocks + parity_block)) {
DEBUG("missing parity block %u\n", parity_block);
DEBUG("missing parity block %" PRIuSIZE "\n", parity_block);
success = false;
goto next_block;
}
@ -191,7 +192,7 @@ bool coding_xor_recover(void *data, size_t len, uint8_t *parity,
continue;
}
DEBUG("regenerate parity block %u\n", i);
DEBUG("regenerate parity block %" PRIuSIZE "\n", i);
size_t data_len = block_size * CONFIG_CODING_XOR_CHECK_BYTES;
_gen_parity((uint8_t *)data + i * data_len,
data_len, parity + i * block_size);

View File

@ -26,6 +26,7 @@
#include <fcntl.h>
#include <errno.h>
#include "architecture.h"
#include "fs/constfs.h"
#include "vfs.h"
@ -187,7 +188,7 @@ static int constfs_open(vfs_file_t *filp, const char *name, int flags, mode_t mo
static ssize_t constfs_read(vfs_file_t *filp, void *dest, size_t nbytes)
{
constfs_file_t *fp = filp->private_data.ptr;
DEBUG("constfs_read: %p, %p, %lu\n", (void *)filp, dest, (unsigned long)nbytes);
DEBUG("constfs_read: %p, %p, %" PRIuSIZE "\n", (void *)filp, dest, nbytes);
if ((size_t)filp->pos >= fp->size) {
/* Current offset is at or beyond end of file */
return 0;
@ -197,7 +198,7 @@ static ssize_t constfs_read(vfs_file_t *filp, void *dest, size_t nbytes)
nbytes = fp->size - filp->pos;
}
memcpy(dest, (const uint8_t *)fp->data + filp->pos, nbytes);
DEBUG("constfs_read: read %lu bytes\n", (long unsigned)nbytes);
DEBUG("constfs_read: read %" PRIuSIZE " bytes\n", nbytes);
filp->pos += nbytes;
return nbytes;
}

View File

@ -43,8 +43,8 @@ void __attribute__((used)) *__wrap_malloc(size_t size)
void *ptr = __real_malloc(size);
mutex_unlock(&_lock);
if (IS_USED(MODULE_MALLOC_TRACING)) {
printf("malloc(%u) @ 0x%" PRIxTXTPTR " returned %p\n",
(unsigned)size, pc, ptr);
printf("malloc(%" PRIuSIZE ") @ 0x%" PRIxTXTPTR " returned %p\n",
size, pc, ptr);
}
return ptr;
}
@ -73,8 +73,8 @@ void * __attribute__((used)) __wrap_calloc(size_t nmemb, size_t size)
size_t total_size;
if (__builtin_mul_overflow(nmemb, size, &total_size)) {
if (IS_USED(MODULE_MALLOC_TRACING)) {
printf("calloc(%u, %u) @ 0x%" PRIxTXTPTR " overflowed\n",
(unsigned)nmemb, (unsigned)size, pc);
printf("calloc(%" PRIuSIZE ", %" PRIuSIZE ") @ 0x%" PRIxTXTPTR " overflowed\n",
nmemb, size, pc);
}
return NULL;
}
@ -87,8 +87,8 @@ void * __attribute__((used)) __wrap_calloc(size_t nmemb, size_t size)
}
if (IS_USED(MODULE_MALLOC_TRACING)) {
printf("calloc(%u, %u) @ 0x%" PRIxTXTPTR " returned %p\n",
(unsigned)nmemb, (unsigned)size, pc, res);
printf("calloc(%" PRIuSIZE ", %" PRIuSIZE ") @ 0x%" PRIxTXTPTR " returned %p\n",
nmemb, size, pc, res);
}
return res;
@ -107,8 +107,8 @@ void * __attribute__((used))__wrap_realloc(void *ptr, size_t size)
mutex_unlock(&_lock);
if (IS_USED(MODULE_MALLOC_TRACING)) {
printf("realloc(%p, %u) @0x%" PRIxTXTPTR " returned %p\n",
ptr, (unsigned)size, pc, new);
printf("realloc(%p, %" PRIuSIZE ") @0x%" PRIxTXTPTR " returned %p\n",
ptr, size, pc, new);
}
return new;
}

View File

@ -10,6 +10,7 @@
#include <assert.h>
#include <string.h>
#include "architecture.h"
#include "memarray.h"
#define ENABLE_DEBUG 0
@ -20,8 +21,8 @@ void memarray_init(memarray_t *mem, void *data, size_t size, size_t num)
assert((mem != NULL) && (data != NULL) && (size >= sizeof(void *)) &&
(num != 0));
DEBUG("memarray: Initialize memarray of %u times %u Bytes at %p\n",
(unsigned)num, (unsigned)size, data);
DEBUG("memarray: Initialize memarray of %" PRIuSIZE " times %" PRIuSIZE " Bytes at %p\n",
num, size, data);
mem->free_data = NULL;
mem->size = size;
@ -62,8 +63,8 @@ int memarray_reduce(memarray_t *mem, void *data, size_t num)
/* Save the element */
memarray_element_t *found_element = *element_ptr;
DEBUG("memarray: Found %p in %p, at %u\n",
(void*)found_element, data, (unsigned)remaining);
DEBUG("memarray: Found %p in %p, at %" PRIuSIZE "\n",
(void*)found_element, data, remaining);
/* Copy pointer over to previous element remove it from the pool
* free list */

View File

@ -246,7 +246,7 @@ static int _send_rd_init_req(coap_pkt_t *pkt, const sock_udp_ep_t *remote,
ssize_t pkt_len = coap_opt_finish(pkt, COAP_OPT_FINISH_NONE);
if (pkt_len < 0) {
DEBUG("cord_lc: error coap_opt_finish() %zd\n", pkt_len);
DEBUG("cord_lc: error coap_opt_finish() %" PRIdSIZE "\n", pkt_len);
return CORD_LC_ERR;
}
@ -289,7 +289,7 @@ int cord_lc_rd_init(cord_lc_rd_t *rd, void *buf, size_t maxlen,
_result_buf + parsed_len,
_result_buf_len - parsed_len);
if (ret < 0) {
DEBUG("cord_lc: error decoding payload %zd\n", ret);
DEBUG("cord_lc: error decoding payload %" PRIdSIZE "\n", ret);
retval = CORD_LC_ERR;
goto end;
}

View File

@ -184,7 +184,7 @@ static void on_publish(size_t len, size_t pos)
if (rbuf[pos + 1] & EMCUTE_QOS_1) {
sock_udp_send(&sock, &buf, 7, &gateway);
}
DEBUG("[emcute] on pub: got %i bytes of data\n", (int)(len - pos - 6));
DEBUG("[emcute] on pub: got %" PRIiSIZE " bytes of data\n", len - pos - 6);
size_t dat_len = (len - pos - 6);
void *dat = (dat_len > 0) ? &rbuf[pos + 6] : NULL;
sub->cb(&sub->topic, dat, dat_len);

View File

@ -549,7 +549,7 @@ static int _do_block(coap_pkt_t *pdu, const sock_udp_ep_t *remote,
coap_block1_finish(&slicer);
if ((len = _send(pdu->hdr, len, remote, slicer.start == 0, context, tl_type)) <= 0) {
DEBUG("gcoap_dns: msg send failed: %d\n", (int)len);
DEBUG("gcoap_dns: msg send failed: %" PRIdSIZE "\n", len);
return len;
}
return len;
@ -679,7 +679,7 @@ static void _resp_handler(const gcoap_request_memo_t *memo, coap_pkt_t *pdu,
if ((block.offset + pdu->payload_len) > CONFIG_DNS_MSG_LEN) {
DEBUG("gcoap_dns: No buffer space for block-wise transfer "
"(%lu + %u) > %u\n", (long unsigned)block.offset,
"(%" PRIuSIZE " + %u) > %u\n", block.offset,
pdu->payload_len, CONFIG_DNS_MSG_LEN);
context->res = -ENOBUFS;
goto unlock;

View File

@ -214,7 +214,7 @@ static void _on_sock_dtls_evt(sock_dtls_t *sock, sock_async_flags_t type, void *
_listen_buf, sizeof(_listen_buf),
CONFIG_GCOAP_DTLS_HANDSHAKE_TIMEOUT_MSEC);
if (res != -SOCK_DTLS_HANDSHAKE) {
DEBUG("gcoap: could not establish DTLS session: %zd\n", res);
DEBUG("gcoap: could not establish DTLS session: %" PRIdSIZE "\n", res);
sock_dtls_session_destroy(sock, &socket.ctx_dtls_session);
return;
}
@ -277,7 +277,7 @@ static void _on_sock_dtls_evt(sock_dtls_t *sock, sock_async_flags_t type, void *
ssize_t res = sock_dtls_recv(sock, &socket.ctx_dtls_session, _listen_buf,
sizeof(_listen_buf), 0);
if (res <= 0) {
DEBUG("gcoap: DTLS recv failure: %d\n", (int)res);
DEBUG("gcoap: DTLS recv failure: %" PRIdSIZE "\n", res);
return;
}
sock_udp_ep_t ep;
@ -331,7 +331,7 @@ static void _on_sock_udp_evt(sock_udp_t *sock, sock_async_flags_t type, void *ar
while (true) {
ssize_t res = sock_udp_recv_buf_aux(sock, &stackbuf, &buf_ctx, 0, &remote, &aux_in);
if (res < 0) {
DEBUG("gcoap: udp recv failure: %d\n", (int)res);
DEBUG("gcoap: udp recv failure: %" PRIdSIZE "\n", res);
return;
}
if (res == 0) {
@ -387,7 +387,7 @@ static void _process_coap_pdu(gcoap_socket_t *sock, sock_udp_ep_t *remote, sock_
ssize_t res = coap_parse(&pdu, buf, len);
if (res < 0) {
DEBUG("gcoap: parse failure: %d\n", (int)res);
DEBUG("gcoap: parse failure: %" PRIdSIZE "\n", res);
/* If a response, can't clear memo, but it will timeout later.
*
* There are *some* error cases in which we could continue (eg. all
@ -446,7 +446,7 @@ static void _process_coap_pdu(gcoap_socket_t *sock, sock_udp_ep_t *remote, sock_
if (pdu_len > 0) {
ssize_t bytes = _tl_send(sock, _listen_buf, pdu_len, remote, aux);
if (bytes <= 0) {
DEBUG("gcoap: send response failed: %d\n", (int)bytes);
DEBUG("gcoap: send response failed: %" PRIdSIZE "\n", bytes);
}
}
}
@ -539,7 +539,7 @@ static void _process_coap_pdu(gcoap_socket_t *sock, sock_udp_ep_t *remote, sock_
ssize_t bytes = _tl_send(sock, buf, sizeof(coap_hdr_t), remote, aux);
if (bytes <= 0) {
DEBUG("gcoap: empty response failed: %d\n", (int)bytes);
DEBUG("gcoap: empty response failed: %" PRIdSIZE "\n", bytes);
}
}
}
@ -576,7 +576,7 @@ static void _on_resp_timeout(void *arg) {
ssize_t bytes = _tl_send(&memo->socket, memo->msg.data.pdu_buf,
memo->msg.data.pdu_len, &memo->remote_ep, NULL);
if (bytes <= 0) {
DEBUG("gcoap: sock resend failed: %d\n", (int)bytes);
DEBUG("gcoap: sock resend failed: %" PRIdSIZE "\n", bytes);
_expire_request(memo);
}
}
@ -1310,7 +1310,7 @@ static ssize_t _cache_check(const uint8_t *buf, size_t len,
ssize_t res = coap_parse(&req, (uint8_t *)buf, len);
if (res < 0) {
DEBUG("gcoap: parse failure for cache lookup: %d\n", (int)res);
DEBUG("gcoap: parse failure for cache lookup: %" PRIdSIZE "\n", res);
return -EINVAL;
}
if (coap_get_code_class(&req) != COAP_CLASS_REQ) {
@ -1624,8 +1624,8 @@ ssize_t gcoap_req_send_tl(const uint8_t *buf, size_t len,
event_timeout_clear(&memo->resp_evt_tmout);
}
memo->state = GCOAP_MEMO_UNUSED;
}
DEBUG("gcoap: sock send failed: %d\n", (int)res);
}
DEBUG("gcoap: sock send failed: %" PRIdSIZE "\n", res);
}
return ((res > 0 || res == -ENOTCONN) ? res : 0);
}

View File

@ -249,8 +249,8 @@ nanocoap_cache_entry_t *nanocoap_cache_add_by_key(const uint8_t *cache_key,
bool add_to_cache = false;
if (resp_len > CONFIG_NANOCOAP_CACHE_RESPONSE_SIZE) {
DEBUG("nanocoap_cache: response too large to cache (%lu > %d)\n",
(long unsigned)resp_len, CONFIG_NANOCOAP_CACHE_RESPONSE_SIZE);
DEBUG("nanocoap_cache: response too large to cache (%" PRIuSIZE "> %d)\n",
resp_len, CONFIG_NANOCOAP_CACHE_RESPONSE_SIZE);
return NULL;
}

View File

@ -220,7 +220,7 @@ ssize_t nanocoap_sock_request_cb(nanocoap_sock_t *sock, coap_pkt_t *pkt,
res = _sock_sendv(sock, &head);
if (res <= 0) {
DEBUG("nanocoap: error sending coap request, %d\n", (int)res);
DEBUG("nanocoap: error sending coap request, %" PRIdSIZE "\n", res);
return res;
}
@ -268,7 +268,7 @@ ssize_t nanocoap_sock_request_cb(nanocoap_sock_t *sock, coap_pkt_t *pkt,
continue;
}
if (res < 0) {
DEBUG("nanocoap: error receiving coap response, %d\n", (int)res);
DEBUG("nanocoap: error receiving coap response, %" PRIdSIZE "\n", res);
return res;
}
@ -794,7 +794,7 @@ int nanocoap_server(sock_udp_ep_t *local, uint8_t *buf, size_t bufsize)
res = sock_udp_recv_aux(&sock.udp, buf, bufsize, SOCK_NO_TIMEOUT,
&remote, aux_in_ptr);
if (res <= 0) {
DEBUG("error receiving UDP packet %d\n", (int)res);
DEBUG("error receiving UDP packet %" PRIdSIZE "\n", res);
continue;
}
coap_pkt_t pkt;
@ -803,7 +803,7 @@ int nanocoap_server(sock_udp_ep_t *local, uint8_t *buf, size_t bufsize)
continue;
}
if ((res = coap_handle_req(&pkt, buf, bufsize, &ctx)) <= 0) {
DEBUG("error handling request %d\n", (int)res);
DEBUG("error handling request %" PRIdSIZE "\n", res);
continue;
}

View File

@ -544,15 +544,15 @@ static void _handle_rtr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
DEBUG(" - IP Hop Limit: %u (should be %u)\n", ipv6->hl,
NDP_HOP_LIMIT);
DEBUG(" - ICMP code: %u (should be 0)\n", rtr_sol->code);
DEBUG(" - ICMP length: %u (should > %u)\n", (unsigned)icmpv6_len,
(unsigned)sizeof(ndp_rtr_sol_t));
DEBUG(" - ICMP length: %" PRIuSIZE " (should > %" PRIuSIZE ")\n",
icmpv6_len, sizeof(ndp_rtr_sol_t));
return;
}
/* pre-check option length */
FOREACH_OPT(rtr_sol, opt, tmp_len) {
if (tmp_len > icmpv6_len) {
DEBUG("nib: Payload length (%u) of RS doesn't align with options\n",
(unsigned)icmpv6_len);
DEBUG("nib: Payload length (%" PRIuSIZE ") of RS doesn't align with options\n",
icmpv6_len);
return;
}
if (opt->len == 0U) {
@ -659,8 +659,8 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
DEBUG(" - IP Hop Limit: %u (should be %u)\n", ipv6->hl,
NDP_HOP_LIMIT);
DEBUG(" - ICMP code: %u (should be 0)\n", rtr_adv->code);
DEBUG(" - ICMP length: %u (should > %u)\n", (unsigned)icmpv6_len,
(unsigned)sizeof(ndp_rtr_adv_t));
DEBUG(" - ICMP length: %" PRIuSIZE " (should > %" PRIuSIZE ")\n",
icmpv6_len, sizeof(ndp_rtr_adv_t));
DEBUG(" - Source address: %s (should be link-local)\n",
ipv6_addr_to_str(addr_str, &ipv6->src, sizeof(addr_str)));
DEBUG(" - Router lifetime: %u (should be <= 9000 on non-6LN)\n",
@ -670,8 +670,8 @@ static void _handle_rtr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
/* pre-check option length */
FOREACH_OPT(rtr_adv, opt, tmp_len) {
if (tmp_len > icmpv6_len) {
DEBUG("nib: Payload length (%u) of RA doesn't align with options\n",
(unsigned)icmpv6_len);
DEBUG("nib: Payload length (%" PRIuSIZE ") of RA doesn't align with options\n",
icmpv6_len);
return;
}
if (opt->len == 0U) {
@ -984,8 +984,8 @@ static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
DEBUG(" - IP Hop Limit: %u (should be %u)\n", ipv6->hl,
NDP_HOP_LIMIT);
DEBUG(" - ICMP code: %u (should be 0)\n", nbr_sol->code);
DEBUG(" - ICMP length: %u (should > %u)\n", (unsigned)icmpv6_len,
(unsigned)sizeof(ndp_nbr_sol_t));
DEBUG(" - ICMP length: %" PRIuSIZE " (should > %" PRIuSIZE ")\n",
icmpv6_len, sizeof(ndp_nbr_sol_t));
DEBUG(" - Target address: %s (should not be multicast)\n",
ipv6_addr_to_str(addr_str, &nbr_sol->tgt, sizeof(addr_str)));
DEBUG(" - Source address: %s\n",
@ -1005,8 +1005,8 @@ static void _handle_nbr_sol(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
/* pre-check option length */
FOREACH_OPT(nbr_sol, opt, tmp_len) {
if (tmp_len > icmpv6_len) {
DEBUG("nib: Payload length (%u) of NS doesn't align with options\n",
(unsigned)icmpv6_len);
DEBUG("nib: Payload length (%" PRIuSIZE ") of NS doesn't align with options\n",
icmpv6_len);
return;
}
if (opt->len == 0U) {
@ -1140,8 +1140,8 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
DEBUG(" - IP Hop Limit: %u (should be %u)\n", ipv6->hl,
NDP_HOP_LIMIT);
DEBUG(" - ICMP code: %u (should be 0)\n", nbr_adv->code);
DEBUG(" - ICMP length: %u (should > %u)\n", (unsigned)icmpv6_len,
(unsigned)sizeof(ndp_nbr_adv_t));
DEBUG(" - ICMP length: %" PRIuSIZE " (should > %" PRIuSIZE ")\n",
icmpv6_len, sizeof(ndp_nbr_adv_t));
DEBUG(" - Target address: %s (should not be multicast)\n",
ipv6_addr_to_str(addr_str, &nbr_adv->tgt, sizeof(addr_str)));
DEBUG(" - Destination address: %s\n",
@ -1155,8 +1155,8 @@ static void _handle_nbr_adv(gnrc_netif_t *netif, const ipv6_hdr_t *ipv6,
/* pre-check option length */
FOREACH_OPT(nbr_adv, opt, tmp_len) {
if (tmp_len > icmpv6_len) {
DEBUG("nib: Payload length (%u) of NA doesn't align with options\n",
(unsigned)icmpv6_len);
DEBUG("nib: Payload length (%" PRIuSIZE ") of NA doesn't align with options\n",
icmpv6_len);
return;
}
if (opt->len == 0U) {

View File

@ -477,9 +477,9 @@ int gnrc_sixlowpan_frag_sfr_forward(gnrc_pktsnip_t *pkt,
gnrc_pktbuf_release(pkt);
return -ENOMEM;
}
DEBUG("6lo sfr: adapting old fragment size (%u) for forwarding to %u\n",
DEBUG("6lo sfr: adapting old fragment size (%u) for forwarding to %" PRIuSIZE "\n",
sixlowpan_sfr_rfrag_get_frag_size(hdrsnip->data),
(unsigned)gnrc_pkt_len(pkt));
gnrc_pkt_len(pkt));
/* due to compression, packet length of the original fragment might have
* changed */
sixlowpan_sfr_rfrag_set_frag_size(hdrsnip->data, gnrc_pkt_len(pkt));
@ -1730,8 +1730,8 @@ static void _sched_arq_timeout(gnrc_sixlowpan_frag_fb_t *fbuf, uint32_t offset)
(uint8_t)fbuf->tag);
return;
}
DEBUG("6lo sfr: arming ACK timeout in %lums for datagram %u\n",
(long unsigned)offset, fbuf->tag);
DEBUG("6lo sfr: arming ACK timeout in %" PRIu32 "ms for datagram %u\n",
offset, fbuf->tag);
fbuf->sfr.arq_timeout_event.event.offset = offset;
fbuf->sfr.arq_timeout_event.msg.content.ptr = fbuf;
fbuf->sfr.arq_timeout_event.msg.type = GNRC_SIXLOWPAN_FRAG_SFR_ARQ_TIMEOUT_MSG;

View File

@ -120,8 +120,8 @@ void gnrc_sixlowpan_multiplex_by_size(gnrc_pktsnip_t *pkt,
}
#if defined(MODULE_GNRC_SIXLOWPAN_FRAG) || defined(MODULE_GNRC_SIXLOWPAN_FRAG_SFR)
else if (orig_datagram_size <= SIXLOWPAN_FRAG_MAX_LEN) {
DEBUG("6lo: Send fragmented (%u > %u)\n",
(unsigned int)datagram_size, netif->sixlo.max_frag_size);
DEBUG("6lo: Send fragmented (%" PRIuSIZE " > %u)\n",
datagram_size, netif->sixlo.max_frag_size);
gnrc_sixlowpan_frag_fb_t *fbuf;
#ifdef MODULE_GNRC_SIXLOWPAN_FRAG_SFR
bool sfr = gnrc_sixlowpan_frag_sfr_netif(netif);
@ -161,8 +161,8 @@ void gnrc_sixlowpan_multiplex_by_size(gnrc_pktsnip_t *pkt,
#endif /* defined(MODULE_GNRC_SIXLOWPAN_FRAG) || defined(MODULE_GNRC_SIXLOWPAN_FRAG_SFR) */
else {
(void)orig_datagram_size;
DEBUG("6lo: packet too big (%u > %u)\n",
(unsigned int)datagram_size, netif->sixlo.max_frag_size);
DEBUG("6lo: packet too big (%" PRIuSIZE " > %u)\n",
datagram_size, netif->sixlo.max_frag_size);
gnrc_pktbuf_release_error(pkt, EMSGSIZE);
}
}

View File

@ -838,8 +838,8 @@ void gnrc_sixlowpan_iphc_recv(gnrc_pktsnip_t *sixlo, void *rbuf_ptr,
DEBUG("6lo iphc: calculating payload length for SFR\n");
DEBUG(" - rbuf->super.datagram_size: %u\n",
rbuf->super.datagram_size);
DEBUG(" - payload_offset: %u\n", (unsigned)payload_offset);
DEBUG(" - uncomp_hdr_len: %u\n", (unsigned)uncomp_hdr_len);
DEBUG(" - payload_offset: %" PRIuSIZE "\n", payload_offset);
DEBUG(" - uncomp_hdr_len: %" PRIuSIZE "\n", uncomp_hdr_len);
/* set IPv6 header payload length field to the length of whatever is
* left after removing the 6LoWPAN header and adding uncompressed
* headers */

View File

@ -118,9 +118,9 @@ static gnrc_pktsnip_t *_mark(gnrc_pktsnip_t *pkt, size_t size, gnrc_nettype_t ty
void *header_data, *payload;
if ((size == 0) || (pkt == NULL) || (size > pkt->size) || (pkt->data == NULL)) {
DEBUG("pktbuf: size == 0 (was %u) or pkt == NULL (was %p) or "
"size > pkt->size (was %u) or pkt->data == NULL (was %p)\n",
(unsigned)size, (void *)pkt, (pkt ? (unsigned)pkt->size : 0),
DEBUG("pktbuf: size == 0 (was %" PRIuSIZE ") or pkt == NULL (was %p) or "
"size > pkt->size (was %" PRIuSIZE ") or pkt->data == NULL (was %p)\n",
size, (void *)pkt, (pkt ? pkt->size : 0),
(pkt ? pkt->data : NULL));
return NULL;
}

View File

@ -95,8 +95,8 @@ gnrc_pktsnip_t *gnrc_pktbuf_add(gnrc_pktsnip_t *next, const void *data, size_t s
gnrc_pktsnip_t *pkt;
if (size > CONFIG_GNRC_PKTBUF_SIZE) {
DEBUG("pktbuf: size (%u) > CONFIG_GNRC_PKTBUF_SIZE (%u)\n",
(unsigned)size, CONFIG_GNRC_PKTBUF_SIZE);
DEBUG("pktbuf: size (%" PRIuSIZE ") > CONFIG_GNRC_PKTBUF_SIZE (%u)\n",
size, CONFIG_GNRC_PKTBUF_SIZE);
return NULL;
}
mutex_lock(&gnrc_pktbuf_mutex);
@ -114,9 +114,9 @@ gnrc_pktsnip_t *gnrc_pktbuf_mark(gnrc_pktsnip_t *pkt, size_t size, gnrc_nettype_
mutex_lock(&gnrc_pktbuf_mutex);
if ((size == 0) || (pkt == NULL) || (size > pkt->size) || (pkt->data == NULL)) {
DEBUG("pktbuf: size == 0 (was %u) or pkt == NULL (was %p) or "
"size > pkt->size (was %u) or pkt->data == NULL (was %p)\n",
(unsigned)size, (void *)pkt, (pkt ? (unsigned)pkt->size : 0),
DEBUG("pktbuf: size == 0 (was %" PRIuSIZE ") or pkt == NULL (was %p) or "
"size > pkt->size (was %" PRIuSIZE ") or pkt->data == NULL (was %p)\n",
size, (void *)pkt, (pkt ? pkt->size : 0),
(pkt ? pkt->data : NULL));
mutex_unlock(&gnrc_pktbuf_mutex);
return NULL;
@ -243,8 +243,8 @@ gnrc_pktsnip_t *gnrc_pktbuf_start_write(gnrc_pktsnip_t *pkt)
#ifdef MODULE_OD
static inline void _print_chunk(void *chunk, size_t size, int num)
{
printf("=========== chunk %3d (%-10p size: %4u) ===========\n", num, chunk,
(unsigned int)size);
printf("=========== chunk %3" PRIuSIZE " (%-10p size: %4u) ===========\n", num, chunk,
size);
od_hex_dump(chunk, size, OD_WIDTH_DEFAULT);
}
@ -430,8 +430,9 @@ static void *_pktbuf_alloc(size_t size)
const void *mismatch;
if (CONFIG_GNRC_PKTBUF_CHECK_USE_AFTER_FREE &&
(mismatch = memchk(ptr + 1, CANARY, size - sizeof(_unused_t)))) {
printf("[%p] mismatch at offset %"PRIuPTR"/%u (ignoring %u initial bytes that were repurposed)\n",
(void *)ptr, (uintptr_t)mismatch - (uintptr_t)ptr, (unsigned)size, (unsigned)sizeof(_unused_t));
printf("[%p] mismatch at offset %"PRIuPTR"/%" PRIuSIZE
" (ignoring %" PRIuSIZE " initial bytes that were repurposed)\n",
(void *)ptr, (uintptr_t)mismatch - (uintptr_t)ptr, size, sizeof(_unused_t));
#ifdef MODULE_OD
od_hex_dump(ptr, size, 0);
#endif

View File

@ -151,8 +151,8 @@ static void _dump(gnrc_pktsnip_t *pkt)
gnrc_pktsnip_t *snip = pkt;
while (snip != NULL) {
printf("~~ SNIP %2i - size: %3u byte, type: ", snips,
(unsigned int)snip->size);
printf("~~ SNIP %2" PRIuSIZE " - size: %3u byte, type: ", snips,
snip->size);
_dump_snip(snip);
++snips;
size += snip->size;

View File

@ -1464,7 +1464,7 @@ void fib_print_notify_rp(fib_table_t *table)
mutex_lock(&(table->mtx_access));
for (size_t i = 0; i < FIB_MAX_REGISTERED_RP; ++i) {
printf("[fib_print_notify_rp] pid[%d]: %d\n", (int)i, (int)(table->notify_rp[i]));
printf("[fib_print_notify_rp] pid[%" PRIuSIZE "]: %d\n", i, (int)(table->notify_rp[i]));
}
mutex_unlock(&(table->mtx_access));
@ -1475,9 +1475,9 @@ void fib_print_fib_table(fib_table_t *table)
mutex_lock(&(table->mtx_access));
for (size_t i = 0; i < table->size; ++i) {
printf("[fib_print_table] %d) iface_id: %d, global: %p, next hop: %p, lifetime: %"
PRIu32"\n",
(int)i, (int)table->data.entries[i].iface_id,
printf("[fib_print_table] %" PRIuSIZE
") iface_id: %d, global: %p, next hop: %p, lifetime: %" PRIu32"\n",
i, (int)table->data.entries[i].iface_id,
(void *)table->data.entries[i].global,
(void *)table->data.entries[i].next_hop,
(uint32_t)(table->data.entries[i].lifetime / 1000));

View File

@ -40,7 +40,7 @@ void __attribute__((weak)) *malloc(size_t size)
if (size != 0) {
void *ptr = sbrk(size);
DEBUG("malloc(): allocating block of size %u at %p.\n", (unsigned int) size, ptr);
DEBUG("malloc(): allocating block of size %" PRIuSIZE " at %p.\n", size, ptr);
if (ptr != (void*) -1) {
return ptr;

View File

@ -21,6 +21,7 @@
#include <stdio.h>
#include <assert.h>
#include "architecture.h"
#include "thread.h"
#include "sched.h"
@ -115,7 +116,7 @@ void ps(void)
#endif
" | %-8s %.1s | %3i"
#ifdef DEVELHELP
" | %6" PRIu32 " (%5i) (%5i) | %10p | %10p "
" | %6" PRIuSIZE " (%5i) (%5i) | %10p | %10p "
#endif
#ifdef MODULE_SCHEDSTATISTICS
" | %2d.%03d%% | %8u | %10"PRIu32" "
@ -127,7 +128,7 @@ void ps(void)
#endif
sname, queued, thread_get_priority(p)
#ifdef DEVELHELP
, (uint32_t)thread_get_stacksize(p), stacksz, stack_free,
, thread_get_stacksize(p), stacksz, stack_free,
thread_get_stackstart(p), thread_get_sp(p)
#endif
#ifdef MODULE_SCHEDSTATISTICS

View File

@ -23,6 +23,7 @@
#include <assert.h>
#include <string.h>
#include "architecture.h"
#include "riotboot/flashwrite.h"
#include "riotboot/slot.h"
#include "od.h"
@ -107,7 +108,7 @@ int riotboot_flashwrite_flush(riotboot_flashwrite_t *state)
int riotboot_flashwrite_putbytes(riotboot_flashwrite_t *state,
const uint8_t *bytes, size_t len, bool more)
{
LOG_DEBUG(LOG_PREFIX "processing bytes %u-%u\n", state->offset,
LOG_DEBUG(LOG_PREFIX "processing bytes %" PRIuSIZE "-%" PRIuSIZE "\n", state->offset,
state->offset + len - 1);
while (len) {

View File

@ -23,6 +23,7 @@
#include <stdint.h>
#include <string.h>
#include "architecture.h"
#include "hashes/sha256.h"
#include "log.h"
#include "riotboot/slot.h"
@ -41,7 +42,7 @@ int riotboot_flashwrite_verify_sha256(const uint8_t *sha256_digest,
uint8_t *img_start = (uint8_t *)riotboot_slot_get_hdr(target_slot);
LOG_INFO("riotboot: verifying digest at %p (img at: %p size: %u)\n",
LOG_INFO("riotboot: verifying digest at %p (img at: %p size: %" PRIuSIZE ")\n",
sha256_digest, img_start, img_len);
sha256_init(&sha256);

View File

@ -340,13 +340,11 @@ static int _print_reply(gnrc_pktsnip_t *pkt, int corrupted, uint32_t triptime, v
if (gnrc_netif_highlander() || (if_pid == KERNEL_PID_UNDEF) ||
!ipv6_addr_is_link_local(&ipv6_hdr->src)) {
printf("%u bytes from %s: icmp_seq=%u ttl=%u",
(unsigned)icmpv6->size,
from_str, recv_seq, ipv6_hdr->hl);
printf("%" PRIuSIZE " bytes from %s: icmp_seq=%u ttl=%u",
icmpv6->size, from_str, recv_seq, ipv6_hdr->hl);
} else {
printf("%u bytes from %s%%%u: icmp_seq=%u ttl=%u",
(unsigned)icmpv6->size,
from_str, if_pid, recv_seq, ipv6_hdr->hl);
printf("%" PRIuSIZE " bytes from %s%%%u: icmp_seq=%u ttl=%u",
icmpv6->size, from_str, if_pid, recv_seq, ipv6_hdr->hl);
}
/* check if payload size matches */

View File

@ -29,6 +29,7 @@
#include <unistd.h>
#include <fcntl.h>
#include "architecture.h"
#include "macros/units.h"
#include "shell.h"
#include "tiny_strerror.h"
@ -279,7 +280,7 @@ static int _read_handler(int argc, char **argv)
return 5;
}
else if ((size_t)res > line_len) {
printf("BUFFER OVERRUN! %d > %lu\n", res, (unsigned long)line_len);
printf("BUFFER OVERRUN! %d > %" PRIuSIZE "\n", res, line_len);
vfs_close(fd);
return 6;
}
@ -491,8 +492,8 @@ static int _cp_handler(int argc, char **argv)
while (bufspace > 0) {
int res = vfs_read(fd_in, &_shell_vfs_data_buffer[pos], bufspace);
if (res < 0) {
printf("Error reading %lu bytes @ 0x%lx in \"%s\" (%d): %s\n",
(unsigned long)bufspace, (unsigned long)pos, src_name,
printf("Error reading %" PRIuSIZE " bytes @ 0x%" PRIxSIZE " in \"%s\" (%d): %s\n",
bufspace, pos, src_name,
fd_in, tiny_strerror(res));
vfs_close(fd_in);
vfs_close(fd_out);
@ -504,7 +505,7 @@ static int _cp_handler(int argc, char **argv)
break;
}
if (((unsigned)res) > bufspace) {
printf("READ BUFFER OVERRUN! %d > %lu\n", res, (unsigned long)bufspace);
printf("READ BUFFER OVERRUN! %d > %" PRIuSIZE "\n", res, bufspace);
vfs_close(fd_in);
vfs_close(fd_out);
return 3;
@ -517,15 +518,15 @@ static int _cp_handler(int argc, char **argv)
while (bufspace > 0) {
int res = vfs_write(fd_out, &_shell_vfs_data_buffer[pos], bufspace);
if (res <= 0) {
printf("Error writing %lu bytes @ 0x%lx in \"%s\" (%d): %s\n",
(unsigned long)bufspace, (unsigned long)pos, dest_name,
printf("Error writing %" PRIuSIZE " bytes @ 0x%" PRIxSIZE " in \"%s\" (%d): %s\n",
bufspace, pos, dest_name,
fd_out, tiny_strerror(res));
vfs_close(fd_in);
vfs_close(fd_out);
return 4;
}
if (((unsigned)res) > bufspace) {
printf("WRITE BUFFER OVERRUN! %d > %lu\n", res, (unsigned long)bufspace);
printf("WRITE BUFFER OVERRUN! %d > %" PRIuSIZE "\n", res, bufspace);
vfs_close(fd_in);
vfs_close(fd_out);
return 5;

View File

@ -26,6 +26,7 @@
#include <nanocbor/nanocbor.h>
#include <assert.h>
#include "architecture.h"
#include "hashes/sha256.h"
#include "kernel_defines.h"
@ -330,7 +331,7 @@ static inline void _print_download_progress(suit_manifest_t *manifest,
(void)manifest;
(void)offset;
(void)len;
DEBUG("_suit_flashwrite(): writing %u bytes at pos %u\n", len, offset);
DEBUG("_suit_flashwrite(): writing %" PRIuSIZE " bytes at pos %" PRIuSIZE "\n", len, offset);
#if defined(MODULE_PROGRESS_BAR)
if (image_size != 0) {
char _suffix[7] = { 0 };
@ -368,14 +369,14 @@ static int _storage_helper(void *arg, size_t offset, uint8_t *buf, size_t len,
if (image_size < offset + len) {
/* Extra newline at the start to compensate for the progress bar */
LOG_ERROR(
"\n_suit_coap(): Image beyond size, offset + len=%u, "
"image_size=%u\n", (unsigned)(total), (unsigned)image_size);
"\n_suit_coap(): Image beyond size, offset + len=%" PRIuSIZE ", "
"image_size=%" PRIu32 "\n", total, image_size);
return -1;
}
if (!more && image_size != total) {
LOG_INFO("Incorrect size received, got %u, expected %u\n",
(unsigned)total, (unsigned)image_size);
LOG_INFO("Incorrect size received, got %" PRIuSIZE ", expected %" PRIu32 "\n",
total, image_size);
return -1;
}
@ -427,8 +428,8 @@ static int _dtv_fetch(suit_manifest_t *manifest, int key,
memcpy(manifest->urlbuf, url, url_len);
manifest->urlbuf[url_len] = '\0';
LOG_DEBUG("_dtv_fetch() fetching \"%s\" (url_len=%u)\n", manifest->urlbuf,
(unsigned)url_len);
LOG_DEBUG("_dtv_fetch() fetching \"%s\" (url_len=%" PRIuSIZE ")\n", manifest->urlbuf,
url_len);
if (_start_storage(manifest, comp) < 0) {
LOG_ERROR("Unable to start storage backend\n");

View File

@ -20,6 +20,7 @@
*/
#include <string.h>
#include "architecture.h"
#include "kernel_defines.h"
#include "log.h"
#include "xfa.h"
@ -41,7 +42,7 @@ static int _flashwrite_init(suit_storage_t *storage)
{
(void)storage;
LOG_DEBUG("Storage size %u\n", (unsigned)sizeof(suit_storage_flashwrite_t));
LOG_DEBUG("Storage size %" PRIuSIZE "\n", sizeof(suit_storage_flashwrite_t));
return 0;
}

View File

@ -116,7 +116,7 @@ int suit_handle_url(const char *url)
return size;
}
LOG_INFO("suit_worker: got manifest with size %u\n", (unsigned)size);
LOG_INFO("suit_worker: got manifest with size %" PRIdSIZE "\n", size);
return suit_handle_manifest_buf(_manifest_buf, size);
}

View File

@ -88,7 +88,7 @@ static void *_listen_thread(void *ctx)
res = sock_udp_recv(&sock, buf, sizeof(buf), 2 * delay_us, NULL);
if (res < 0) {
if (res != -ETIMEDOUT) {
printf("Error receiving message: %zd\n", res);
printf("Error receiving message: %" PRIdSIZE "\n", res);
}
continue;
}

View File

@ -18,6 +18,7 @@
#include <stdio.h>
#include "architecture.h"
#include "event.h"
#include "event/thread.h"
#include "od.h"
@ -56,7 +57,7 @@ void _recv(netdev_t *dev)
printf("Src. addr.: %s\n", _addr_str);
data_len -= sizeof(ethernet_hdr_t);
printf("Payload (%u bytes): \n", (unsigned)data_len);
printf("Payload (%" PRIdSIZE " bytes): \n", data_len);
od_hex_dump(payload, data_len, 0);
}

View File

@ -264,7 +264,7 @@ static int send(int iface, le_uint16_t dst_pan, uint8_t *dst, size_t dst_len,
be_uint16_t _dst_pan = byteorder_ltobs(dst_pan);
l2util_addr_to_str(dst, dst_len, _addr_str);
printf("txtsnd: sending %u bytes to %s", (unsigned)iol_data.iol_len, _addr_str);
printf("txtsnd: sending %" PRIuSIZE " bytes to %s", iol_data.iol_len, _addr_str);
l2util_addr_to_str((uint8_t*) &_dst_pan, sizeof(dst_pan), _addr_str);
printf(" (PAN: %s)\n", _addr_str);

View File

@ -22,6 +22,7 @@
#include <stdio.h>
#include "architecture.h"
#include "irq.h"
#include "ztimer.h"
@ -54,9 +55,9 @@ void trace_dump(void)
uint32_t t_last = 0;
for (size_t i = 0; i < n; i++) {
printf("n=%4lu t=%s%8" PRIu32 " v=0x%08lx\n", (unsigned long)i,
printf("n=%4" PRIuSIZE " t=%s%8" PRIu32 " v=0x%08" PRIx32 "\n", i,
i ? "+" : " ",
tracebuf[i].time - t_last, (unsigned long)tracebuf[i].val);
tracebuf[i].time - t_last, tracebuf[i].val);
t_last = tracebuf[i].time;
}
}

View File

@ -142,8 +142,8 @@ universal_address_container_t *universal_address_add(uint8_t *addr, size_t addr_
pEntry->use_count++;
if (pEntry->use_count == 1) {
DEBUG("[universal_address_add] universal_address_table_filled: %d\n", \
(int)universal_address_table_filled);
DEBUG("[universal_address_add] universal_address_table_filled: %" PRIuSIZE "\n", \
universal_address_table_filled);
universal_address_table_filled++;
}
@ -166,8 +166,8 @@ void universal_address_rem(universal_address_container_t *entry)
}
}
else {
DEBUG("[universal_address_rem] universal_address_table_filled: %d\n", \
(int)universal_address_table_filled);
DEBUG("[universal_address_rem] universal_address_table_filled: %" PRIuSIZE "\n", \
universal_address_table_filled);
}
}
@ -359,8 +359,8 @@ int universal_address_get_num_used_entries(void)
void universal_address_print_table(void)
{
printf("[universal_address_print_table] universal_address_table_filled: %d\n", \
(int)universal_address_table_filled);
printf("[universal_address_print_table] universal_address_table_filled: %" PRIuSIZE "\n", \
universal_address_table_filled);
/* cppcheck-suppress unsignedLessThanZero
* (reason: UNIVERSAL_ADDRESS_MAX_ENTRIES may be zero in which case this

View File

@ -352,8 +352,8 @@ static bool _urb_transfer_complete(usbus_t *usbus, usbdev_ep_t *ep,
_usbus_transfer_urb_submit(usbus_ep, next_urb);
}
DEBUG("Done with the transfer, available: %u, len: %u\n",
(unsigned)active_urb->transferred, (unsigned)active_urb->len);
DEBUG("Done with the transfer, available: %" PRIuSIZE ", len: %" PRIuSIZE "\n",
active_urb->transferred, active_urb->len);
handler->driver->transfer_handler(usbus, handler, ep,
USBUS_EVENT_TRANSFER_COMPLETE);
}

View File

@ -17,6 +17,7 @@
#include <errno.h>
#include <stdbool.h>
#include "architecture.h"
#include "fmt.h"
#include "ut_process.h"
@ -71,9 +72,9 @@ int ut_process_expand(const char *ut, size_t ut_len,
res = _copy_str(exp_start, (&ut[i] - exp_start),
&uri[uri_idx], uri_len - uri_idx);
if (res < 0) {
DEBUG("ut_process: %p(%u) does not fit write-back %.*s "
DEBUG("ut_process: %p(%" PRIuSIZE ") does not fit write-back %.*s "
"of template %s\n",
(void *)uri, (unsigned)uri_len,
(void *)uri, uri_len,
(int)(&ut[i] - exp_start), exp_start, ut);
return res;
}
@ -103,8 +104,8 @@ int ut_process_expand(const char *ut, size_t ut_len,
if (!exp_start) {
res = _copy_char(ut[i], &uri[uri_idx], uri_len - uri_idx);
if (res < 0) {
DEBUG("ut_process: %p(%u) does not fit literal %c of "
"template %s\n", (void *)uri, (unsigned)uri_len,
DEBUG("ut_process: %p(%" PRIuSIZE ") does not fit literal %c of "
"template %s\n", (void *)uri, uri_len,
ut[i], ut);
return res;
}
@ -119,9 +120,9 @@ int ut_process_expand(const char *ut, size_t ut_len,
res = _copy_str(exp_start, (&ut[i] - exp_start),
&uri[uri_idx], uri_len - uri_idx);
if (res < 0) {
DEBUG("ut_process: %p(%u) does not fit terminal write-back %.*s of "
DEBUG("ut_process: %p(%" PRIuSIZE ") does not fit terminal write-back %.*s of "
"template %s\n",
(void *)uri, (unsigned)uri_len,
(void *)uri, uri_len,
(int)(&ut[i] - exp_start), exp_start, ut);
return res;
}
@ -129,8 +130,8 @@ int ut_process_expand(const char *ut, size_t ut_len,
}
res = _copy_char('\0', &uri[uri_idx], uri_len - uri_idx);
if (res < 0) {
DEBUG("ut_process: %p(%u) does not fit terminating '\\0' char\n",
(void *)uri, (unsigned)uri_len);
DEBUG("ut_process: %p(%" PRIuSIZE ") does not fit terminating '\\0' char\n",
(void *)uri, uri_len);
return res;
}
/* do not increment uri_idx. We want the string length so \0 does not count
@ -353,8 +354,8 @@ static int _set_var(const char *var, size_t var_len,
if (prefix) {
res = _copy_char(prefix, &uri[uri_idx], uri_len - uri_idx);
if (res < 0) {
DEBUG("ut_process: %p(%u) does not fit prefix %c\n",
(void *)uri, (unsigned)uri_len, prefix);
DEBUG("ut_process: %p(%" PRIuSIZE ") does not fit prefix %c\n",
(void *)uri, uri_len, prefix);
return res;
}
uri_idx += res;
@ -364,8 +365,8 @@ static int _set_var(const char *var, size_t var_len,
assert(sep); /* all operators have a separator defined */
res = _copy_char(sep, &uri[uri_idx], uri_len - uri_idx);
if (res < 0) {
DEBUG("ut_process: %p(%u) does not fit separator '%c'\n",
(void *)uri, (unsigned)uri_len, sep);
DEBUG("ut_process: %p(%" PRIuSIZE ") does not fit separator '%c'\n",
(void *)uri, uri_len, sep);
return -ENOBUFS;
}
uri_idx += res;
@ -387,8 +388,8 @@ static int _fill_var(const ut_process_var_t *var, bool has_reserved,
for (const char *c = var->name; *c != '\0'; c++) {
res = _copy_char(*c, &uri[uri_idx], uri_len - uri_idx);
if (res < 0) {
DEBUG("ut_process: %p(%u) does not var name %s\n", (void *)uri,
(unsigned)uri_len, var->name);
DEBUG("ut_process: %p(%" PRIuSIZE ") does not var name %s\n", (void *)uri,
uri_len, var->name);
return res;
}
uri_idx += res;
@ -397,8 +398,8 @@ static int _fill_var(const ut_process_var_t *var, bool has_reserved,
if ((var->value[0] != '\0') || empty_equal) {
res = _copy_char('=', &uri[uri_idx], uri_len - uri_idx);
if (res < 0) {
DEBUG("ut_process: %p(%u) does not fit =\n", (void *)uri,
(unsigned)uri_len);
DEBUG("ut_process: %p(%" PRIuSIZE ") does not fit =\n", (void *)uri,
uri_len);
return res;
}
uri_idx += res;
@ -416,8 +417,8 @@ static int _fill_var(const ut_process_var_t *var, bool has_reserved,
}
res = _copy_str(enc, enc_len, &uri[uri_idx], uri_len - uri_idx);
if (res < 0) {
DEBUG("ut_process: %p(%u) does not fit value encoding %.*s\n",
(void *)uri, (unsigned)uri_len, (unsigned)enc_len, enc);
DEBUG("ut_process: %p(%" PRIuSIZE ") does not fit value encoding %.*s\n",
(void *)uri, uri_len, (unsigned)enc_len, enc);
return res;
}
uri_idx += res;

View File

@ -315,7 +315,7 @@ int vfs_open(const char *name, int flags, mode_t mode)
ssize_t vfs_read(int fd, void *dest, size_t count)
{
DEBUG("vfs_read: %d, %p, %lu\n", fd, dest, (unsigned long)count);
DEBUG("vfs_read: %d, %p, %" PRIuSIZE "\n", fd, dest, count);
if (dest == NULL) {
return -EFAULT;
}
@ -337,7 +337,7 @@ ssize_t vfs_read(int fd, void *dest, size_t count)
ssize_t vfs_write(int fd, const void *src, size_t count)
{
DEBUG_NOT_STDOUT(fd, "vfs_write: %d, %p, %lu\n", fd, src, (unsigned long)count);
DEBUG_NOT_STDOUT(fd, "vfs_write: %d, %p, %" PRIuSIZE "\n", fd, src, count);
if (src == NULL) {
return -EFAULT;
}
@ -839,8 +839,8 @@ int vfs_bind(int fd, int flags, const vfs_file_ops_t *f_op, void *private_data)
int vfs_normalize_path(char *buf, const char *path, size_t buflen)
{
DEBUG("vfs_normalize_path: %p, \"%s\" (%p), %lu\n",
(void *)buf, path, (void *)path, (unsigned long)buflen);
DEBUG("vfs_normalize_path: %p, \"%s\" (%p), %" PRIuSIZE "\n",
(void *)buf, path, (void *)path, buflen);
size_t len = 0;
int npathcomp = 0;
const char *path_end = path + strlen(path); /* Find the terminating null byte */