[linux-nfc] [neard][PATCH v2 28/73] nfctype5: use proper format for integers (-Wformat)

Krzysztof Kozlowski <[email protected]> Mon, 19 Jul 2021 13:07:34 +0200
Newsgroups org.01.lists.linux-nfc,dev.linux.lists.oe-linux-nfc
Message-ID <[email protected]>
Properly print signed and unsigned integers.  This fixes warnings like:

    In file included from plugins/nfctype5.c:29:
    plugins/nfctype5.c: In function ‘t5_read’:
    ./include/near/log.h:45:14: error: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’} [-Werror=format=]
       45 |   near_debug("%s:%s() " fmt, \
          |              ^~~~~~~~~~
    plugins/nfctype5.c:437:2: note: in expansion of macro ‘DBG’
      437 |  DBG("Reading %zd bytes starting at offset %d\n", len, offset);
          |  ^~~

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
 plugins/nfctype5.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugins/nfctype5.c b/plugins/nfctype5.c
index 3d2cdf030d4f..0f90e55ab268 100644
--- a/plugins/nfctype5.c
+++ b/plugins/nfctype5.c
@@ -434,7 +434,7 @@ static int t5_read(struct near_tag *tag, uint8_t offset, uint8_t *buf,
 	uint8_t blk_size = near_tag_get_blk_size(tag);
 	int err;
 
-	DBG("Reading %zd bytes starting at offset %d\n", len, offset);
+	DBG("Reading %zu bytes starting at offset %u\n", len, offset);
 
 	err = t5_cmd_hdr_init(tag, &t5_cmd.hdr, CMD_READ_SINGLE_BLOCK);
 	if (err)
@@ -532,10 +532,10 @@ static int t5_write(struct near_tag *tag, uint8_t offset, uint8_t *buf,
 	uint8_t blk_size = near_tag_get_blk_size(tag);
 	int err;
 
-	DBG("Writing %zd bytes starting at offset %d\n", len, offset);
+	DBG("Writing %zu bytes starting at offset %u\n", len, offset);
 
 	if (offset % blk_size) {
-		near_error("Write - Invalid offset - offset: %d, blk_size: %d",
+		near_error("Write - Invalid offset - offset: %u, blk_size: %u",
 			   offset, blk_size);
 		return -EINVAL;
 	}
-- 
2.27.0
_______________________________________________
Linux-nfc mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s