diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> | 2021-07-11 16:38:01 +0200 |
---|---|---|
committer | Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> | 2021-07-19 12:44:07 +0200 |
commit | f941cdc4597d1b127546be00a1fcb4dcc7c85063 (patch) | |
tree | 27768d1f15c165bb014b86f1901f2ba29c8ac7e5 | |
parent | 232d33a705717c8bfdc4fc445a6f241fd10bcaec (diff) | |
download | neard-f941cdc4597d1b127546be00a1fcb4dcc7c85063.tar.gz |
nfctype2: use proper format for integers (-Wformat)
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@canonical.com>
-rw-r--r-- | plugins/nfctype2.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/nfctype2.c b/plugins/nfctype2.c index dec9615..3618ca1 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; } |