Properly print signed and unsigned integers. This fixes warnings like:
In file included from plugins/nfctype2.c:36:
plugins/nfctype2.c: In function ‘data_recv’:
./include/near/log.h:45:14: error: format ‘%d’ expects argument of type ‘int’, but
argument 4 has type ‘uint32_t’ {aka ‘unsigned int’} [-Werror=format=]
45 | near_debug("%s:%s() " fmt, \
| ^~~~~~~~~~
plugins/nfctype2.c:195:2: note: in expansion of macro ‘DBG’
195 | DBG("adapter %d", adapter_idx);
| ^~~
plugins/nfctype2.c: In function ‘nfctype2_write’:
plugins/nfctype2.c:458:43: error: format ‘%zd’ expects argument of type ‘signed
size_t’, but argument 2 has type ‘size_t’ {aka ‘long unsigned int’} [-Werror=format=]
458 | near_error("Not enough space on tag %zd %zd",
| ~~^
| |
| long int
| %ld
459 | ndef->length,
| ~~~~~~~~~~~~
| |
| size_t {aka long unsigned int}
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
---
plugins/nfctype2.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/plugins/nfctype2.c b/plugins/nfctype2.c
index dec9615b69af..3618ca177363 100644
--- a/plugins/nfctype2.c
+++ b/plugins/nfctype2.c
@@ -192,7 +192,7 @@ static int data_recv(uint8_t *resp, int length, void *data)
cmd.cmd = CMD_READ;
cmd.block = DATA_BLOCK_START + tag->current_block;
- DBG("adapter %d", adapter_idx);
+ DBG("adapter %u", adapter_idx);
return near_adapter_send(adapter_idx,
(uint8_t *) &cmd, CMD_READ_SIZE,
@@ -341,7 +341,7 @@ static int nfctype2_read(uint32_t adapter_idx,
cb, tgt_subtype);
default:
- DBG("Unknown Tag Type 2 subtype %d", tgt_subtype);
+ DBG("Unknown Tag Type 2 subtype %u", tgt_subtype);
return -1;
}
}
@@ -455,7 +455,7 @@ static int nfctype2_write(uint32_t adapter_idx, uint32_t target_idx,
*/
if (near_tag_get_memory_layout(tag) == NEAR_TAG_MEMORY_STATIC) {
if ((ndef->length + 3) > near_tag_get_data_length(tag)) {
- near_error("Not enough space on tag %zd %zd",
+ near_error("Not enough space on tag %zu %zu",
ndef->length,
near_tag_get_data_length(tag));
err = -ENOSPC;
@@ -471,7 +471,7 @@ static int nfctype2_write(uint32_t adapter_idx, uint32_t target_idx,
return mifare_write(adapter_idx, target_idx, ndef,
cb, tgt_subtype);
default:
- DBG("Unknown TAG Type 2 subtype %d", tgt_subtype);
+ DBG("Unknown TAG Type 2 subtype %u", tgt_subtype);
err = -EINVAL;
goto out_err;
}
@@ -533,7 +533,7 @@ static int nfctype2_check_presence(uint32_t adapter_idx, uint32_t
target_idx,
cb, tgt_subtype);
default:
- DBG("Unknown TAG Type 2 subtype %d", tgt_subtype);
+ DBG("Unknown TAG Type 2 subtype %u", tgt_subtype);
return -1;
}
@@ -586,7 +586,7 @@ static int nfctype2_format(uint32_t adapter_idx, uint32_t target_idx,
tgt_subtype = near_tag_get_subtype(adapter_idx, target_idx);
if (tgt_subtype != NEAR_TAG_NFC_T2_MIFARE_ULTRALIGHT) {
- DBG("Unknown Tag Type 2 subtype %d", tgt_subtype);
+ DBG("Unknown Tag Type 2 subtype %u", tgt_subtype);
return -1;
}
--
2.27.0