mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 14:33:52 +01:00
tests: Use size_t print format specifier
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
This commit is contained in:
parent
314dbf15b9
commit
fa0cf05d0a
@ -38,9 +38,9 @@
|
||||
#endif
|
||||
#include "thread.h"
|
||||
|
||||
#define P(NAME) printf(" tcb->%-11s %3u %3u\n", #NAME, \
|
||||
(unsigned)sizeof(((thread_t *) 0)->NAME), \
|
||||
(unsigned)offsetof(thread_t, NAME))
|
||||
#define P(NAME) printf(" tcb->%-11s %3" PRIuSIZE " %3" PRIuSIZE "\n", #NAME, \
|
||||
sizeof(((thread_t *) 0)->NAME), \
|
||||
offsetof(thread_t, NAME))
|
||||
|
||||
int main(void)
|
||||
{
|
||||
@ -48,43 +48,43 @@ int main(void)
|
||||
|
||||
puts(" size");
|
||||
|
||||
printf("sizeof(cib_t): %3u\n",
|
||||
(unsigned)sizeof(cib_t));
|
||||
printf("sizeof(clist_node_t): %3u\n",
|
||||
(unsigned)sizeof(clist_node_t));
|
||||
printf("sizeof(core_panic_t): %3u\n",
|
||||
(unsigned)sizeof(core_panic_t));
|
||||
printf("sizeof(kernel_pid_t): %3u\n",
|
||||
(unsigned)sizeof(kernel_pid_t));
|
||||
printf("sizeof(list_node_t): %3u\n",
|
||||
(unsigned)sizeof(list_node_t));
|
||||
printf("sizeof(mbox_t): %3u\n",
|
||||
(unsigned)sizeof(mbox_t));
|
||||
printf("sizeof(cib_t): %3" PRIuSIZE "\n",
|
||||
sizeof(cib_t));
|
||||
printf("sizeof(clist_node_t): %3" PRIuSIZE "\n",
|
||||
sizeof(clist_node_t));
|
||||
printf("sizeof(core_panic_t): %3" PRIuSIZE "\n",
|
||||
sizeof(core_panic_t));
|
||||
printf("sizeof(kernel_pid_t): %3" PRIuSIZE "\n",
|
||||
sizeof(kernel_pid_t));
|
||||
printf("sizeof(list_node_t): %3" PRIuSIZE "\n",
|
||||
sizeof(list_node_t));
|
||||
printf("sizeof(mbox_t): %3" PRIuSIZE "\n",
|
||||
sizeof(mbox_t));
|
||||
#ifdef MODULE_CORE_MSG
|
||||
printf("sizeof(msg_t): %3u\n",
|
||||
(unsigned)sizeof(msg_t));
|
||||
printf("sizeof(msg_t): %3" PRIuSIZE "\n",
|
||||
sizeof(msg_t));
|
||||
#else
|
||||
puts("sizeof(msg_t): 0 (not enabled)");
|
||||
#endif
|
||||
printf("sizeof(mutex_t): %3u\n",
|
||||
(unsigned)sizeof(mutex_t));
|
||||
printf("sizeof(priority_queue_node_t): %3u\n",
|
||||
(unsigned)sizeof(priority_queue_node_t));
|
||||
printf("sizeof(priority_queue_t): %3u\n",
|
||||
(unsigned)sizeof(priority_queue_t));
|
||||
printf("sizeof(ringbuffer_t): %3u\n",
|
||||
(unsigned)sizeof(ringbuffer_t));
|
||||
printf("sizeof(rmutex_t): %3u\n",
|
||||
(unsigned)sizeof(rmutex_t));
|
||||
printf("sizeof(mutex_t): %3" PRIuSIZE "\n",
|
||||
sizeof(mutex_t));
|
||||
printf("sizeof(priority_queue_node_t): %3" PRIuSIZE "\n",
|
||||
sizeof(priority_queue_node_t));
|
||||
printf("sizeof(priority_queue_t): %3" PRIuSIZE "\n",
|
||||
sizeof(priority_queue_t));
|
||||
printf("sizeof(ringbuffer_t): %3" PRIuSIZE "\n",
|
||||
sizeof(ringbuffer_t));
|
||||
printf("sizeof(rmutex_t): %3" PRIuSIZE "\n",
|
||||
sizeof(rmutex_t));
|
||||
#ifdef MODULE_CORE_THREAD_FLAGS
|
||||
printf("sizeof(thread_flags_t): %3u\n",
|
||||
(unsigned)sizeof(thread_flags_t));
|
||||
printf("sizeof(thread_flags_t): %3" PRIuSIZE "\n",
|
||||
sizeof(thread_flags_t));
|
||||
#else
|
||||
puts("sizeof(thread_flags_t): 0 (not enabled)");
|
||||
#endif
|
||||
printf("\nTCB (thread_t) details: size offset\n");
|
||||
printf("sizeof(thread_t): %3u -\n",
|
||||
(unsigned)sizeof(thread_t));
|
||||
printf("sizeof(thread_t): %3" PRIuSIZE " -\n",
|
||||
sizeof(thread_t));
|
||||
P(sp);
|
||||
P(status);
|
||||
P(priority);
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
* so do not sort this one alphabetically */
|
||||
#include <stdatomic.h>
|
||||
|
||||
#include "architecture.h"
|
||||
#include "irq.h"
|
||||
#include "sched.h"
|
||||
#include "thread.h"
|
||||
@ -79,7 +80,7 @@ int main(void)
|
||||
(unsigned)STACKSIZE, (unsigned)ALIGNMENT);
|
||||
for (size_t i = 0; i < ALIGNMENT; i++) {
|
||||
atomic_store(&test_failed, false);
|
||||
printf("Testing for alignment %u: ", (unsigned)i);
|
||||
printf("Testing for alignment %" PRIuSIZE ": ", i);
|
||||
kernel_pid_t p;
|
||||
p = thread_create(stack + i, STACKSIZE, THREAD_PRIORITY_MAIN - 1,
|
||||
THREAD_CREATE_STACKTEST,
|
||||
|
||||
@ -80,7 +80,7 @@ static int send(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Response (len=%d): %s\n", (int)len, resp);
|
||||
printf("Response (len=%" PRIdSIZE "): %s\n", len, resp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -115,7 +115,7 @@ static int send_lines(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Response (len=%d): %s\n", (int)len, resp);
|
||||
printf("Response (len=%" PRIdSIZE "): %s\n", len, resp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -134,7 +134,7 @@ static int send_recv_bytes(int argc, char **argv)
|
||||
|
||||
ssize_t len = at_recv_bytes(&at_dev, buffer, atoi(argv[2]), 10 * US_PER_SEC);
|
||||
|
||||
printf("Response (len=%d): %s\n", (int)len, buffer);
|
||||
printf("Response (len=%" PRIdSIZE "): %s\n", len, buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -163,7 +163,7 @@ static int send_recv_bytes_until_string(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Response (len=%d): %s\n", (int)len, buffer);
|
||||
printf("Response (len=%" PRIdSIZE "): %s\n", len, buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ int main(void)
|
||||
check = at24cxxx_write(&at24cxxx_dev, WRITE_POSITION, expected_write_data,
|
||||
sizeof(expected_write_data));
|
||||
if (check != AT24CXXX_OK) {
|
||||
printf("[FAILURE] at24cxxx_write: %d (size = %zu)\n", check,
|
||||
printf("[FAILURE] at24cxxx_write: %d (size = %" PRIuSIZE ")\n", check,
|
||||
sizeof(expected_write_data));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ int ata8520e_sigfox_cmd(int argc, char **argv)
|
||||
else {
|
||||
if (strlen(argv[2]) > SIGFOX_MAX_TX_LENGTH) {
|
||||
printf("Message length cannot exceeds %d characters length, your "
|
||||
"message length is %u", SIGFOX_MAX_TX_LENGTH, (unsigned)strlen(argv[2]));
|
||||
"message length is %" PRIuSIZE, SIGFOX_MAX_TX_LENGTH, strlen(argv[2]));
|
||||
return 1;
|
||||
}
|
||||
if (ata8520e_send_frame(&dev,
|
||||
@ -99,7 +99,7 @@ int ata8520e_sigfox_cmd(int argc, char **argv)
|
||||
}
|
||||
if (strlen(argv[2]) > SIGFOX_MAX_TX_LENGTH) {
|
||||
printf("Message length cannot exceeds %d characters length, your "
|
||||
"message length is %u", SIGFOX_MAX_TX_LENGTH, (unsigned)strlen(argv[2]));
|
||||
"message length is %" PRIuSIZE, SIGFOX_MAX_TX_LENGTH, strlen(argv[2]));
|
||||
return 1;
|
||||
}
|
||||
uint8_t rx_buf[SIGFOX_RX_LENGTH];
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
void _callback(void *arg, size_t col, size_t row, bool state)
|
||||
{
|
||||
(void)arg;
|
||||
printf("Key switch at column %u and row %u is ", (unsigned)col, (unsigned)row);
|
||||
printf("Key switch at column %" PRIuSIZE " and row %" PRIuSIZE " is ", col, row);
|
||||
if (state) {
|
||||
puts("pressed!");
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ int rn2xx3_mac_cmd(int argc, char **argv) {
|
||||
puts("MAC transmission succeeded");
|
||||
puts("Data received:");
|
||||
printf(" -port: %d\n", rn2xx3_mac_get_rx_port(&rn2xx3_dev));
|
||||
printf(" -payload len: %d\n", (uint8_t)strlen((char *)rn2xx3_dev.rx_buf));
|
||||
printf(" -payload len: %" PRIuSIZE "\n", strlen((char *)rn2xx3_dev.rx_buf));
|
||||
printf(" -payload: '%s'\n", rn2xx3_dev.rx_buf);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "architecture.h"
|
||||
#include "msg.h"
|
||||
#include "thread.h"
|
||||
#include "shell.h"
|
||||
@ -68,9 +69,9 @@ static void _event_cb(netdev_t *dev, netdev_event_t event)
|
||||
netdev_lora_rx_info_t packet_info;
|
||||
dev->driver->recv(dev, message, len, &packet_info);
|
||||
printf(
|
||||
"Received: \"%s\" (%d bytes) - [RSSI: %i, SNR: %i, TOA: %" PRIu32 "ms]\n",
|
||||
message, (int)len,
|
||||
packet_info.rssi, (int)packet_info.snr,
|
||||
"Received: \"%s\" (%" PRIuSIZE " bytes) - [RSSI: %i, SNR: %i, TOA: %" PRIu32 "ms]\n",
|
||||
message, len,
|
||||
packet_info.rssi, packet_info.snr,
|
||||
sx126x_get_lora_time_on_air_in_ms(&sx126x.pkt_params, &sx126x.mod_params)
|
||||
);
|
||||
netopt_state_t state = NETOPT_STATE_RX;
|
||||
@ -273,8 +274,8 @@ static int sx126x_tx_cmd(netdev_t *netdev, int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("sending \"%s\" payload (%u bytes)\n",
|
||||
argv[2], (unsigned)strlen(argv[2]) + 1);
|
||||
printf("sending \"%s\" payload (%" PRIuSIZE " bytes)\n",
|
||||
argv[2], strlen(argv[2]) + 1);
|
||||
iolist_t iolist = {
|
||||
.iol_base = argv[2],
|
||||
.iol_len = (strlen(argv[2]) + 1)
|
||||
|
||||
@ -240,8 +240,8 @@ int send_cmd(int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("sending \"%s\" payload (%u bytes)\n",
|
||||
argv[1], (unsigned)strlen(argv[1]) + 1);
|
||||
printf("sending \"%s\" payload (%" PRIuSIZE " bytes)\n",
|
||||
argv[1], strlen(argv[1]) + 1);
|
||||
|
||||
iolist_t iolist = {
|
||||
.iol_base = argv[1],
|
||||
@ -492,9 +492,9 @@ static void _event_cb(netdev_t *dev, netdev_event_t event)
|
||||
len = dev->driver->recv(dev, NULL, 0, 0);
|
||||
dev->driver->recv(dev, message, len, &packet_info);
|
||||
printf(
|
||||
"{Payload: \"%s\" (%d bytes), RSSI: %i, SNR: %i, TOA: %" PRIu32 "}\n",
|
||||
message, (int)len,
|
||||
packet_info.rssi, (int)packet_info.snr,
|
||||
"{Payload: \"%s\" (%" PRIuSIZE " bytes), RSSI: %i, SNR: %i, TOA: %" PRIu32 "}\n",
|
||||
message, len,
|
||||
packet_info.rssi, packet_info.snr,
|
||||
sx127x_get_time_on_air((const sx127x_t *)dev, len));
|
||||
break;
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "architecture.h"
|
||||
#include "msg.h"
|
||||
#include "thread.h"
|
||||
#include "shell.h"
|
||||
@ -69,8 +70,8 @@ static void _event_cb(netdev_t *dev, netdev_event_t event)
|
||||
netdev_lora_rx_info_t packet_info;
|
||||
dev->driver->recv(dev, message, len, &packet_info);
|
||||
printf(
|
||||
"Received: \"%s\" (%d bytes) - [RSSI: %i, SNR: %i]\n",
|
||||
message, (int)len, packet_info.rssi, (int)packet_info.snr);
|
||||
"Received: \"%s\" (%" PRIuSIZE " bytes) - [RSSI: %i, SNR: %i]\n",
|
||||
message, len, packet_info.rssi, packet_info.snr);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -282,8 +283,8 @@ static int sx1280_tx_cmd(netdev_t *netdev, int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("sending \"%s\" payload (%u bytes)\n",
|
||||
argv[2], (unsigned)strlen(argv[2]) + 1);
|
||||
printf("sending \"%s\" payload (%" PRIuSIZE " bytes)\n",
|
||||
argv[2], strlen(argv[2]) + 1);
|
||||
iolist_t iolist = {
|
||||
.iol_base = argv[2],
|
||||
.iol_len = (strlen(argv[2]) + 1)
|
||||
|
||||
@ -89,8 +89,8 @@ static unsigned _get_qos(const char *str)
|
||||
static void _on_pub(const emcute_topic_t *topic, void *data, size_t len)
|
||||
{
|
||||
(void)data;
|
||||
printf("### got publication of %u bytes for topic '%s' [%d] ###\n",
|
||||
(unsigned)len, topic->name, (int)topic->id);
|
||||
printf("### got publication of %" PRIuSIZE " bytes for topic '%s' [%u] ###\n",
|
||||
len, topic->name, topic->id);
|
||||
}
|
||||
|
||||
static int _con(int argc, char **argv)
|
||||
@ -224,18 +224,18 @@ static int _pub(int argc, char **argv)
|
||||
t = &_topics[idx];
|
||||
len = atoi(argv[2]);
|
||||
if ((unsigned)len > sizeof(_pub_buf)) {
|
||||
printf("error: len %d > %lu\n", len, (unsigned long)sizeof(_pub_buf));
|
||||
printf("error: len %d > %" PRIuSIZE "\n", len, sizeof(_pub_buf));
|
||||
return 1;
|
||||
}
|
||||
memset(_pub_buf, 92, len);
|
||||
if (emcute_pub(t, _pub_buf, len, flags) != EMCUTE_OK) {
|
||||
printf("error: unable to publish data to topic '%s [%d]'\n",
|
||||
t->name, (int)t->id);
|
||||
printf("error: unable to publish data to topic '%s [%u]'\n",
|
||||
t->name, t->id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("success: published %d bytes to topic '%s [%d]'\n",
|
||||
(int)len, t->name, t->id);
|
||||
printf("success: published %d bytes to topic '%s [%u]'\n",
|
||||
len, t->name, t->id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -604,8 +604,8 @@ static int shell_test_cmd(int argc, char **argv)
|
||||
}
|
||||
test_num = atoi(argv[2]);
|
||||
if ((unsigned)test_num >= ARRAY_SIZE(_shell_tests)) {
|
||||
printf("<num> must be between 0 and %u\n",
|
||||
(unsigned)ARRAY_SIZE(_shell_tests) - 1);
|
||||
printf("<num> must be between 0 and %" PRIuSIZE "\n",
|
||||
ARRAY_SIZE(_shell_tests) - 1);
|
||||
return 1;
|
||||
}
|
||||
printf("Running test %d\n", test_num);
|
||||
|
||||
@ -106,7 +106,7 @@ static void send(char *addr_str, char *port_str, char *data_len_str, unsigned in
|
||||
}
|
||||
/* access to `payload` was implicitly given up with the send operation above
|
||||
* => use original variable for output */
|
||||
printf("Success: send %u byte to [%s]:%u\n", (unsigned)data_len, addr_str,
|
||||
printf("Success: send %" PRIuSIZE " byte to [%s]:%u\n", data_len, addr_str,
|
||||
port);
|
||||
xtimer_usleep(delay);
|
||||
}
|
||||
|
||||
@ -110,9 +110,9 @@ static int _dump_etherframe(netdev_t *dev, const iolist_t *iolist)
|
||||
(void)dev;
|
||||
while (iolist) {
|
||||
if ((outbuf_len + iolist->iol_len) > sizeof(outbuf)) {
|
||||
printf("Ignoring packet: %u > %u\n",
|
||||
(unsigned)(outbuf_len + iolist->iol_len),
|
||||
(unsigned)sizeof(outbuf));
|
||||
printf("Ignoring packet: %" PRIuSIZE " > %" PRIuSIZE "\n",
|
||||
(outbuf_len + iolist->iol_len),
|
||||
sizeof(outbuf));
|
||||
/* ignore larger packets */
|
||||
return outbuf_len;
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ int gnrc_tcp_send_cmd(int argc, char **argv)
|
||||
sent += ret;
|
||||
} while (sent < to_send);
|
||||
|
||||
printf("%s: sent %u\n", argv[0], (unsigned)sent);
|
||||
printf("%s: sent %" PRIuSIZE "\n", argv[0], sent);
|
||||
return sent;
|
||||
}
|
||||
|
||||
@ -321,7 +321,7 @@ int gnrc_tcp_recv_cmd(int argc, char **argv)
|
||||
rcvd += ret;
|
||||
} while (rcvd < to_receive);
|
||||
|
||||
printf("%s: received %u\n", argv[0], (unsigned)rcvd);
|
||||
printf("%s: received %" PRIuSIZE "\n", argv[0], rcvd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -230,7 +230,7 @@ int main(void)
|
||||
int sends_expected = (IS_USED(MODULE_NETDEV_IEEE802154)) ? 2 : 1;
|
||||
printf("transmissions expected = %d, transmissions completed = %d\n",
|
||||
sends_expected, sends);
|
||||
printf("sent %u out of %u bytes\n", pld_pos, (unsigned)sizeof(test_msg));
|
||||
printf("sent %u out of %" PRIuSIZE " bytes\n", pld_pos, sizeof(test_msg));
|
||||
expect(sends == sends_expected);
|
||||
expect(pld_pos == sizeof(test_msg));
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ static void send(char *addr_str, char *port_str, char *data_len_str, unsigned in
|
||||
}
|
||||
/* access to `payload` was implicitly given up with the send operation above
|
||||
* => use original variable for output */
|
||||
printf("Success: send %u byte to [%s]:%u\n", (unsigned)data_len, addr_str,
|
||||
printf("Success: send %" PRIuSIZE " byte to [%s]:%u\n", data_len, addr_str,
|
||||
port);
|
||||
xtimer_usleep(delay);
|
||||
}
|
||||
|
||||
@ -344,7 +344,7 @@ static void submac_rx_done(ieee802154_submac_t *submac)
|
||||
printf("%u, ", (unsigned)((buffer[1] & IEEE802154_FCF_VERS_MASK) >> 4));
|
||||
printf("Seq.: %u\n", (unsigned)ieee802154_get_seq(buffer));
|
||||
od_hex_dump(buffer + mhr_len, data_len - mhr_len, 0);
|
||||
printf("txt (%u chars): ", data_len - mhr_len);
|
||||
printf("txt (%" PRIuSIZE " chars): ", data_len - mhr_len);
|
||||
for (int i = mhr_len; i < data_len; i++) {
|
||||
if ((buffer[i] > 0x1F) && (buffer[i] < 0x80)) {
|
||||
putchar((char)buffer[i]);
|
||||
|
||||
@ -126,12 +126,12 @@ int nanotest_client_cmd(int argc, char **argv)
|
||||
len = coap_opt_finish(&pkt, COAP_OPT_FINISH_NONE);
|
||||
}
|
||||
|
||||
printf("nanocli: sending msg ID %u, %u bytes\n", coap_get_id(&pkt),
|
||||
(unsigned) len);
|
||||
printf("nanocli: sending msg ID %u, %" PRIuSIZE " bytes\n", coap_get_id(&pkt),
|
||||
len);
|
||||
|
||||
ssize_t res = _send(&pkt, buflen, argv[2], argv[3]);
|
||||
if (res < 0) {
|
||||
printf("nanocli: msg send failed: %d\n", (int)res);
|
||||
printf("nanocli: msg send failed: %" PRIdSIZE "\n", res);
|
||||
}
|
||||
else {
|
||||
char *class_str = (coap_get_code_class(&pkt) == COAP_CLASS_SUCCESS)
|
||||
@ -171,7 +171,7 @@ static int _blockwise_cb(void *arg, size_t offset, uint8_t *buf, size_t len, int
|
||||
(void)arg;
|
||||
(void)more;
|
||||
|
||||
printf("offset %03u: ", (unsigned)offset);
|
||||
printf("offset %03" PRIuSIZE ": ", offset);
|
||||
for (unsigned i = 0; i < len; ++i) {
|
||||
putchar(buf[i]);
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "architecture.h"
|
||||
#include "shell.h"
|
||||
#include "test_utils/expect.h"
|
||||
|
||||
@ -74,7 +75,7 @@ static int cmd_read(int argc, char **argv)
|
||||
size_t ret = eeprom_read(pos, (uint8_t *)buffer, count);
|
||||
buffer[count] = '\0';
|
||||
|
||||
printf("Data read from EEPROM (%d bytes): %s\n", (int)ret, buffer);
|
||||
printf("Data read from EEPROM (%" PRIuSIZE " bytes): %s\n", ret, buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -114,7 +115,7 @@ static int cmd_write(int argc, char **argv)
|
||||
}
|
||||
|
||||
size_t ret = eeprom_write(pos, (uint8_t *)argv[2], strlen(argv[2]));
|
||||
printf("%d bytes written to EEPROM\n", (int)ret);
|
||||
printf("%" PRIuSIZE " bytes written to EEPROM\n", ret);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -162,7 +163,7 @@ static int cmd_set(int argc, char **argv)
|
||||
}
|
||||
|
||||
size_t ret = eeprom_set(pos, c, count);
|
||||
printf("%d bytes set to %c in EEPROM\n", (int)ret, c);
|
||||
printf("%" PRIuSIZE " bytes set to %c in EEPROM\n", ret, c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -183,7 +184,7 @@ static int cmd_clear(int argc, char **argv)
|
||||
}
|
||||
|
||||
size_t ret = eeprom_clear(pos, count);
|
||||
printf("%d bytes cleared in EEPROM\n", (int)ret);
|
||||
printf("%" PRIuSIZE " bytes cleared in EEPROM\n", ret);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "architecture.h"
|
||||
#include "od.h"
|
||||
#include "shell.h"
|
||||
#include "periph/flashpage.h"
|
||||
@ -233,10 +234,10 @@ static int cmd_write_raw(int argc, char **argv)
|
||||
|
||||
flashpage_write((void*)addr, raw_buf, strlen(raw_buf));
|
||||
#if (__SIZEOF_POINTER__ == 2)
|
||||
printf("wrote local data to flash address %#" PRIx16 " of len %u\n",
|
||||
printf("wrote local data to flash address %#" PRIx16 " of len %" PRIuSIZE "\n",
|
||||
addr, strlen(raw_buf));
|
||||
#else
|
||||
printf("wrote local data to flash address %#" PRIx32 " of len %u\n",
|
||||
printf("wrote local data to flash address %#" PRIx32 " of len %" PRIuSIZE "\n",
|
||||
addr, strlen(raw_buf));
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
@ -112,11 +112,11 @@ static void print_bytes(const char *title, const uint8_t *data, size_t len)
|
||||
{
|
||||
printf("%4s\n", title);
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
printf(" %2i ", (int)i);
|
||||
printf(" %2" PRIuSIZE " ", i);
|
||||
}
|
||||
printf("\n ");
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
printf(" 0x%02x", (int)data[i]);
|
||||
printf(" 0x%02x", data[i]);
|
||||
}
|
||||
printf("\n ");
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
|
||||
@ -162,7 +162,7 @@ int _handshake_cmd(int argc, char **argv)
|
||||
_ctx.state = EDHOC_WAITING;
|
||||
|
||||
if ((msg_len = edhoc_create_msg1(&_ctx, corr, _method, _suite, msg, sizeof(msg))) > 0) {
|
||||
printf("[initiator]: sending msg1 (%d bytes):\n", (int)msg_len);
|
||||
printf("[initiator]: sending msg1 (%" PRIdSIZE " bytes):\n", msg_len);
|
||||
print_bstr(msg, msg_len);
|
||||
_build_coap_pkt(&pkt, buf, sizeof(buf), msg, msg_len);
|
||||
len = _send(&pkt, COAP_BUF_SIZE, &addr, netif, port);
|
||||
@ -180,7 +180,7 @@ int _handshake_cmd(int argc, char **argv)
|
||||
print_bstr(pkt.payload, pkt.payload_len);
|
||||
|
||||
if ((msg_len = edhoc_create_msg3(&_ctx, pkt.payload, pkt.payload_len, msg, sizeof(msg))) > 0) {
|
||||
printf("[initiator]: sending msg3 (%d bytes):\n", (int)msg_len);
|
||||
printf("[initiator]: sending msg3 (%" PRIdSIZE " bytes):\n", msg_len);
|
||||
print_bstr(msg, msg_len);
|
||||
_build_coap_pkt(&pkt, buf, sizeof(buf), msg, msg_len);
|
||||
len = _send(&pkt, COAP_BUF_SIZE, &addr, netif, port);
|
||||
|
||||
@ -74,7 +74,7 @@ ssize_t _edhoc_handler(coap_pkt_t *pkt, uint8_t *buf, size_t len, coap_request_c
|
||||
uint8_t msg[COAP_BUF_SIZE];
|
||||
if ((msg_len =
|
||||
edhoc_create_msg2(&_ctx, pkt->payload, pkt->payload_len, msg, sizeof(msg))) >= 0) {
|
||||
printf("[responder]: sending msg2 (%d bytes):\n", (int) msg_len);
|
||||
printf("[responder]: sending msg2 (%" PRIdSIZE " bytes):\n", msg_len);
|
||||
print_bstr(msg, msg_len);
|
||||
msg_len = coap_reply_simple(pkt, COAP_CODE_204, buf, len, COAP_FORMAT_OCTET, msg,
|
||||
msg_len);
|
||||
|
||||
@ -155,9 +155,8 @@ static int ip_send(char *addr_str, char *port_str, char *data, unsigned int num,
|
||||
puts("could not send");
|
||||
}
|
||||
else {
|
||||
printf("Success: send %u byte over %s to %s (next header: %u)\n",
|
||||
(unsigned)data_len,
|
||||
(dst.family == AF_INET6) ? "IPv6" : "IPv4",
|
||||
printf("Success: send %" PRIuSIZE " byte over %s to %s (next header: %u)\n",
|
||||
data_len, (dst.family == AF_INET6) ? "IPv6" : "IPv4",
|
||||
addr_str, protocol);
|
||||
}
|
||||
ztimer_sleep(ZTIMER_USEC, delay);
|
||||
|
||||
@ -172,7 +172,7 @@ static int tcp_send(char *data, unsigned int num, unsigned int delay)
|
||||
puts("could not send");
|
||||
}
|
||||
else {
|
||||
printf("Success: send %u byte over TCP to server\n", (unsigned)data_len);
|
||||
printf("Success: send %" PRIuSIZE " byte over TCP to server\n", data_len);
|
||||
}
|
||||
ztimer_sleep(ZTIMER_USEC, delay);
|
||||
}
|
||||
|
||||
@ -118,8 +118,8 @@ static int udp_send(char *addr_str, char *data, unsigned int num,
|
||||
puts("could not send");
|
||||
}
|
||||
else {
|
||||
printf("Success: send %u byte over UDP to %s\n",
|
||||
(unsigned)data_len, addr_str);
|
||||
printf("Success: send %" PRIuSIZE " byte over UDP to %s\n",
|
||||
data_len, addr_str);
|
||||
}
|
||||
ztimer_sleep(ZTIMER_USEC, delay);
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "architecture.h"
|
||||
#include "kernel_defines.h"
|
||||
#include "random.h"
|
||||
#include "rs.h"
|
||||
@ -61,8 +62,8 @@ int main(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("total: %u shards (%u bytes)\n",
|
||||
(unsigned)ARRAY_SIZE(marks), (unsigned)sizeof(data));
|
||||
printf("total: %" PRIuSIZE " shards (%" PRIuSIZE " bytes)\n",
|
||||
ARRAY_SIZE(marks), sizeof(data));
|
||||
|
||||
/* generate parity shards */
|
||||
reed_solomon_encode(rs, shards, ARRAY_SIZE(shards), SHARD_SIZE);
|
||||
|
||||
@ -186,7 +186,7 @@ static void _send(uint32_t type, uint32_t seq, size_t len)
|
||||
expect(_coc);
|
||||
expect(len >= 8);
|
||||
expect(len <= APP_MTU);
|
||||
printf("# Sending: size %5u seq %5u\n", (unsigned)len, (unsigned)seq);
|
||||
printf("# Sending: size %5" PRIuSIZE " seq %5" PRIu32 "\n", len, seq);
|
||||
|
||||
_txbuf[POS_TYPE] = type;
|
||||
_txbuf[POS_SEQ] = seq;
|
||||
|
||||
@ -102,8 +102,8 @@ static int udp_send(char *addr_str, char *port_str, char *data,
|
||||
|
||||
for (unsigned int i = 0; i < num; i++) {
|
||||
|
||||
printf("Send %u byte over UDP to [%s]:%s\n",
|
||||
(unsigned)data_len, addr_str, port_str);
|
||||
printf("Send %" PRIuSIZE " byte over UDP to [%s]:%s\n",
|
||||
data_len, addr_str, port_str);
|
||||
|
||||
/* don't run if not in synch */
|
||||
if (ieee154e_isSynch() == FALSE) {
|
||||
|
||||
@ -156,10 +156,10 @@ static void _dtls_handler(sock_dtls_t *sock, sock_async_flags_t type, void *arg)
|
||||
|
||||
res = sock_dtls_recv(sock, &session, _recv_buf, sizeof(_recv_buf), 0);
|
||||
if (res >= 0) {
|
||||
printf("Received %d bytes -- (echo)\n", (int)res);
|
||||
printf("Received %" PRIdSIZE " bytes -- (echo)\n", res);
|
||||
res = sock_dtls_send(sock, &session, _recv_buf, (size_t)res, 0);
|
||||
if (res < 0) {
|
||||
printf("Error resending DTLS message: %d\n", (int)res);
|
||||
printf("Error resending DTLS message: %" PRIdSIZE "\n", res);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,7 +183,7 @@ static int start_server(void)
|
||||
res = credman_add(&credential);
|
||||
if (res < 0 && res != CREDMAN_EXIST) {
|
||||
/* ignore duplicate credentials */
|
||||
printf("Error cannot add credential to system: %d\n", (int)res);
|
||||
printf("Error cannot add credential to system: %" PRIdSIZE "\n", res);
|
||||
return 1;
|
||||
}
|
||||
res = sock_dtls_create(&_dtls_sock, &_udp_sock, SOCK_DTLS_SERVER_TAG,
|
||||
|
||||
@ -78,8 +78,8 @@ int test_umorse_out(void)
|
||||
{
|
||||
uint8_t code[CODE_LEN];
|
||||
|
||||
printf("> Translate text of length %u into Morse code:\n\"%s\"\n",
|
||||
(unsigned)strlen(text), text);
|
||||
printf("> Translate text of length %" PRIuSIZE " into Morse code:\n\"%s\"\n",
|
||||
strlen(text), text);
|
||||
|
||||
memset(code, 0, CODE_LEN);
|
||||
printf("> using aligned encoding:\n");
|
||||
|
||||
@ -24,8 +24,9 @@ ssize_t _flashwrite_handler(coap_pkt_t* pkt, uint8_t *buf, size_t len, coap_requ
|
||||
coap_block1_t block1;
|
||||
int blockwise = coap_get_block1(pkt, &block1);
|
||||
|
||||
printf("_flashwrite_handler(): received data: offset=%u len=%u blockwise=%i more=%i\n", \
|
||||
(unsigned)block1.offset, pkt->payload_len, blockwise, block1.more);
|
||||
printf("_flashwrite_handler(): received data: offset=%" PRIuSIZE
|
||||
" len=%u blockwise=%i more=%i\n",
|
||||
block1.offset, pkt->payload_len, blockwise, block1.more);
|
||||
|
||||
uint8_t *payload_start = pkt->payload;
|
||||
size_t payload_len = pkt->payload_len;
|
||||
@ -53,7 +54,8 @@ ssize_t _flashwrite_handler(coap_pkt_t* pkt, uint8_t *buf, size_t len, coap_requ
|
||||
riotboot_flashwrite_putbytes(writer, payload_start, payload_len, block1.more);
|
||||
}
|
||||
else {
|
||||
printf("_flashwrite_handler(): skipping invalid offset (data=%u, writer=%u)\n", (unsigned)offset, (unsigned)writer->offset);
|
||||
printf("_flashwrite_handler(): skipping invalid offset (data=%" PRIuSIZE
|
||||
", writer=%" PRIuSIZE ")\n", offset, writer->offset);
|
||||
}
|
||||
|
||||
if (block1.more == 1) {
|
||||
|
||||
@ -62,8 +62,7 @@ int main(void)
|
||||
bloom_init(&bloom, BLOOM_BITS, bf, hashes, BLOOM_HASHF);
|
||||
|
||||
printf("Testing Bloom filter.\n\n");
|
||||
printf("m: %" PRIu32 " k: %" PRIu32 "\n\n", (uint32_t) bloom.m,
|
||||
(uint32_t) bloom.k);
|
||||
printf("m: %" PRIuSIZE " k: %" PRIuSIZE "\n\n", bloom.m, bloom.k);
|
||||
|
||||
random_init(myseed);
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "architecture.h"
|
||||
#include "test_utils/expect.h"
|
||||
|
||||
#ifndef CHUNK_SIZE
|
||||
@ -128,7 +129,7 @@ static void check_calloc_returns_null_on_overflow(void)
|
||||
* allocation succeeded. It then optimized out the test `NULL == p` and
|
||||
* assumes it to always be false. We just print the address to prevent
|
||||
* that from happening */
|
||||
printf("calloc(%zu, %zu) = %p\n", nmemb, size, p);
|
||||
printf("calloc(%" PRIuSIZE ", %" PRIuSIZE ") = %p\n", nmemb, size, p);
|
||||
expect(NULL == p);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "architecture.h"
|
||||
#include "memarray.h"
|
||||
#include "ps.h"
|
||||
|
||||
@ -67,8 +68,8 @@ void fill_memory(struct block_t *head)
|
||||
head->message[MESSAGE_SIZE - 1] = 0;
|
||||
head->number = aux;
|
||||
|
||||
printf("\t(%i, %s) Allocated %u Bytes at %p, total %d\n",
|
||||
head->number, head->message, (unsigned)sizeof(struct block_t),
|
||||
printf("\t(%i, %s) Allocated %" PRIuSIZE " Bytes at %p, total %d\n",
|
||||
head->number, head->message, sizeof(struct block_t),
|
||||
(void *)head, total);
|
||||
|
||||
/* NOTE: If there is not space, memarray_alloc returns zero */
|
||||
@ -86,8 +87,8 @@ void free_memory(struct block_t *head)
|
||||
|
||||
while (head) {
|
||||
total -= sizeof(struct block_t);
|
||||
printf("\tFree (%i) %u Bytes at %p, total %d\n", \
|
||||
head->number, (unsigned)sizeof(struct block_t),
|
||||
printf("\tFree (%i) %" PRIuSIZE " Bytes at %p, total %d\n", \
|
||||
head->number, sizeof(struct block_t),
|
||||
(void *)head, total);
|
||||
|
||||
if (head->next) {
|
||||
@ -142,45 +143,45 @@ int main(void)
|
||||
|
||||
puts("Extend and reduce tests");
|
||||
|
||||
printf("Memarray available: %u\n",
|
||||
(unsigned)memarray_available(&block_storage));
|
||||
printf("Memarray available: %" PRIuSIZE "\n",
|
||||
memarray_available(&block_storage));
|
||||
|
||||
/* Extend with second block */
|
||||
memarray_extend(&block_storage, block_storage_data_extend,
|
||||
MAX_NUMBER_BLOCKS);
|
||||
printf("Memarray available: %u\n",
|
||||
(unsigned)memarray_available(&block_storage));
|
||||
printf("Memarray available: %" PRIuSIZE "\n",
|
||||
memarray_available(&block_storage));
|
||||
|
||||
/* remove the original block */
|
||||
int res = memarray_reduce(&block_storage, block_storage_data,
|
||||
MAX_NUMBER_BLOCKS);
|
||||
printf("Memarray reduction: %d available: %u\n",
|
||||
res, (unsigned)memarray_available(&block_storage));
|
||||
printf("Memarray reduction: %d available: %" PRIuSIZE "\n",
|
||||
res, memarray_available(&block_storage));
|
||||
|
||||
/* try to remove original block a second time */
|
||||
res = memarray_reduce(&block_storage, block_storage_data,
|
||||
MAX_NUMBER_BLOCKS);
|
||||
printf("Memarray reduction: %d available: %u\n",
|
||||
res, (unsigned)memarray_available(&block_storage));
|
||||
printf("Memarray reduction: %d available: %" PRIuSIZE "\n",
|
||||
res, memarray_available(&block_storage));
|
||||
|
||||
/* remove the extension block */
|
||||
res = memarray_reduce(&block_storage, block_storage_data_extend,
|
||||
MAX_NUMBER_BLOCKS);
|
||||
printf("Memarray reduction: %d available: %u\n",
|
||||
res, (unsigned)memarray_available(&block_storage));
|
||||
printf("Memarray reduction: %d available: %" PRIuSIZE "\n",
|
||||
res, memarray_available(&block_storage));
|
||||
|
||||
/* extend again with the original block */
|
||||
memarray_extend(&block_storage, block_storage_data, MAX_NUMBER_BLOCKS);
|
||||
|
||||
/* remove one element */
|
||||
memarray_alloc(&block_storage);
|
||||
printf("Memarray available: %u\n",
|
||||
(unsigned)memarray_available(&block_storage));
|
||||
printf("Memarray available: %" PRIuSIZE "\n",
|
||||
memarray_available(&block_storage));
|
||||
|
||||
/* try to reduce with a missing element */
|
||||
res = memarray_reduce(&block_storage, block_storage_data, MAX_NUMBER_BLOCKS);
|
||||
printf("Memarray reduction: %d available: %u\n",
|
||||
res, (unsigned)memarray_available(&block_storage));
|
||||
printf("Memarray reduction: %d available: %" PRIuSIZE "\n",
|
||||
res, memarray_available(&block_storage));
|
||||
|
||||
printf("Finishing\n");
|
||||
ps();
|
||||
|
||||
@ -30,7 +30,7 @@ void *run(void *parameter) {
|
||||
size_t n = (size_t) parameter;
|
||||
size_t factorial = 1;
|
||||
|
||||
printf("pthread: parameter = %u\n", (unsigned int) n);
|
||||
printf("pthread: parameter = %" PRIuSIZE "\n", n);
|
||||
|
||||
if (n > 0) {
|
||||
for (size_t i = 1; i <= n; i++) {
|
||||
@ -38,7 +38,7 @@ void *run(void *parameter) {
|
||||
}
|
||||
}
|
||||
|
||||
printf("pthread: factorial = %u\n", (unsigned int) factorial);
|
||||
printf("pthread: factorial = %" PRIuSIZE "\n",factorial);
|
||||
pthread_exit((void *)factorial);
|
||||
|
||||
return NULL;
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "architecture.h"
|
||||
#include "shell.h"
|
||||
|
||||
#if MODULE_STDIO_RTT
|
||||
@ -87,7 +88,7 @@ static int print_shell_bufsize(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
printf("%d\n", sizeof(line_buf));
|
||||
printf("%" PRIuSIZE "\n", sizeof(line_buf));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ static void _handle_data(usbdev_mock_t *dev, usbdev_mock_ep_t *ep, size_t len)
|
||||
{
|
||||
if (ep->ep.dir == USB_EP_DIR_IN) {
|
||||
/* Zero length IN packet is not valid here */
|
||||
DEBUG("[data]: Handling IN data from stack: %u\n", (unsigned)len);
|
||||
DEBUG("[data]: Handling IN data from stack: %" PRIuSIZE "\n", len);
|
||||
TEST_ASSERT(len != 0);
|
||||
dev->usbdev.epcb(&dev->in[0].ep, USBDEV_EVENT_ESR);
|
||||
if (ep->available == dev->req_len) {
|
||||
@ -263,9 +263,8 @@ static void _handle_data(usbdev_mock_t *dev, usbdev_mock_ep_t *ep, size_t len)
|
||||
req_phase = TEST_REQ_PHASE_OUTACK;
|
||||
}
|
||||
else {
|
||||
DEBUG("[data]: Expecting more data from stack: %u/%u\n",
|
||||
(unsigned)ep->available,
|
||||
(unsigned)dev->req_len);
|
||||
DEBUG("[data]: Expecting more data from stack: %" PRIuSIZE "/%" PRIuSIZE "\n",
|
||||
ep->available, dev->req_len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,8 +40,8 @@ static void _fill_FIB_unique(size_t entries)
|
||||
|
||||
for (size_t i = 0; i < entries; ++i) {
|
||||
/* construct "addresses" for the FIB */
|
||||
snprintf(addr_dst, add_buf_size, "Test address %02d", (int)i);
|
||||
snprintf(addr_nxt, add_buf_size, "Test address %02d", (int)(entries + i));
|
||||
snprintf(addr_dst, add_buf_size, "Test address %02" PRIuSIZE, i);
|
||||
snprintf(addr_nxt, add_buf_size, "Test address %02" PRIuSIZE, entries + i);
|
||||
/* the terminating \0 is unnecessary here */
|
||||
fib_add_entry(&test_fib_table, 42,
|
||||
(uint8_t *)addr_dst, add_buf_size - 1, addr_dst_flags,
|
||||
@ -64,8 +64,8 @@ static void _fill_FIB_multiple(size_t entries, size_t modulus)
|
||||
|
||||
for (size_t i = 0; i < entries; ++i) {
|
||||
/* construct "addresses" for the FIB */
|
||||
snprintf(addr_dst, add_buf_size, "Test address %02d", (int)i);
|
||||
snprintf(addr_nxt, add_buf_size, "Test address %02d", (int)(i % modulus));
|
||||
snprintf(addr_dst, add_buf_size, "Test address %02" PRIuSIZE, i);
|
||||
snprintf(addr_nxt, add_buf_size, "Test address %02" PRIuSIZE, i % modulus);
|
||||
fib_add_entry(&test_fib_table, 42,
|
||||
(uint8_t *)addr_dst, add_buf_size - 1, addr_dst_flags,
|
||||
(uint8_t *)addr_nxt, add_buf_size - 1, addr_nxt_flags,
|
||||
@ -151,7 +151,7 @@ static void test_fib_03_removing_all_entries(void)
|
||||
|
||||
for (size_t i = 0; i < entries; ++i) {
|
||||
/* construct "addresses" to remove */
|
||||
snprintf(addr_dst, add_buf_size, "Test address %02d", (int)i);
|
||||
snprintf(addr_dst, add_buf_size, "Test address %02" PRIuSIZE, i);
|
||||
fib_remove_entry(&test_fib_table, (uint8_t *)addr_dst, add_buf_size - 1);
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ static void test_fib_04_remove_lower_half(void)
|
||||
|
||||
for (size_t i = 0; i < entries / 2; ++i) {
|
||||
/* construct "addresses" to remove */
|
||||
snprintf(addr_dst, add_buf_size, "Test address %02d", (int)i);
|
||||
snprintf(addr_dst, add_buf_size, "Test address %02" PRIuSIZE, i);
|
||||
fib_remove_entry(&test_fib_table, (uint8_t *)addr_dst, add_buf_size - 1);
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ static void test_fib_05_remove_upper_half(void)
|
||||
|
||||
for (size_t i = 0; i < entries / 2; ++i) {
|
||||
/* construct "addresses" to remove */
|
||||
snprintf(addr_dst, add_buf_size, "Test address %02d", (int)((entries / 2) + i));
|
||||
snprintf(addr_dst, add_buf_size, "Test address %02" PRIuSIZE, (entries / 2) + i);
|
||||
fib_remove_entry(&test_fib_table, (uint8_t *)addr_dst, add_buf_size - 1);
|
||||
}
|
||||
|
||||
@ -715,8 +715,8 @@ static void test_fib_17_get_entry_set(void)
|
||||
/* fill 20 addresses */
|
||||
for (size_t i = 0; i < 20; ++i) {
|
||||
/* construct "addresses" for the FIB */
|
||||
snprintf(addr_dst, addr_buf_size, "Test address %02d", (int)i);
|
||||
snprintf(addr_nxt, addr_buf_size, "Test address %02d", (int)(i % 11));
|
||||
snprintf(addr_dst, addr_buf_size, "Test address %02" PRIuSIZE, i);
|
||||
snprintf(addr_nxt, addr_buf_size, "Test address %02" PRIuSIZE, i % 11);
|
||||
fib_add_entry(&test_fib_table, 42,
|
||||
(uint8_t *)addr_dst, addr_buf_size - 1, 0x0,
|
||||
(uint8_t *)addr_nxt, addr_buf_size - 1, 0x0, 100000);
|
||||
|
||||
@ -67,7 +67,7 @@ static int _create_sr(const char *pre, size_t from, size_t to, fib_sr_t *sr, siz
|
||||
|
||||
for (size_t i = from; i < to; ++i) {
|
||||
int res;
|
||||
snprintf(&(addr_nxt[strlen(pre)]), buf_size, "%d", (int)i);
|
||||
snprintf(&(addr_nxt[strlen(pre)]), buf_size, "%" PRIuSIZE, i);
|
||||
/* append a hop */
|
||||
res = fib_sr_entry_append(&test_fib_sr_table, sr, (uint8_t *)&addr_nxt, buf_size);
|
||||
if (res != 0) {
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "architecture.h"
|
||||
#include "container.h"
|
||||
#include "embUnit.h"
|
||||
|
||||
@ -57,7 +58,7 @@ static int _compare_string_buffer(const char *name, const char *input_uri, const
|
||||
return 0;
|
||||
}
|
||||
printf(
|
||||
"\nWith given input uri '%s', expected %s '%s' with length '%d' but got '%.*s' with length '%d'\n",
|
||||
"\nWith given input uri '%s', expected %s '%s' with length '%" PRIuSIZE "' but got '%.*s' with length '%d'\n",
|
||||
input_uri, name, expected_str, strlen(expected_str), actual_len, actual_str, actual_len);
|
||||
return -1;
|
||||
}
|
||||
@ -317,7 +318,7 @@ static void _result_component_scheme_matches_input_scheme(void)
|
||||
* but the uri_parser provides the length separately*/
|
||||
if (uri_res.scheme_len != strlen(test_vec[i]->scheme)) {
|
||||
printf(
|
||||
"With given input uri '%s', expected a scheme with the length '%d' but got '%d'\n",
|
||||
"With given input uri '%s', expected a scheme with the length '%" PRIuSIZE "' but got '%d'\n",
|
||||
test_vec[i]->input_uri, strlen(test_vec[i]->scheme), uri_res.scheme_len);
|
||||
TEST_FAIL(failure_msg);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user