[neard][PATCH 18/34] ndef: use proper format for integers (-Wformat)

Krzysztof Kozlowski <[email protected]>
Newsgroups dev.linux.lists.oe-linux-nfc,org.01.lists.linux-nfc
Message-ID <[email protected]>
Properly print signed and unsigned integers.  This fixes warnings like:

    ./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, \
          |              ^~~~~~~~~~
    src/ndef.c:1084:2: note: in expansion of macro ‘DBG’
     1084 |  DBG("payload length %d", rec_header->payload_len);
          |  ^~~

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

diff --git a/src/ndef.c b/src/ndef.c
index 54e2e1ae170e..0d84ff4dc17b 100644
--- a/src/ndef.c
+++ b/src/ndef.c
@@ -585,7 +585,7 @@ static gboolean property_get_size(const GDBusPropertyTable *property,
 {
 	struct near_ndef_record *record = user_data;
 
-	DBG("%d", record->sp->size);
+	DBG("%u", record->sp->size);
 
 	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &record->sp->size);
 
@@ -1042,7 +1042,7 @@ static struct near_ndef_record_header *parse_record_header(uint8_t *rec,
 	uint8_t *type = NULL;
 	uint32_t header_len = 0;
 
-	DBG("length %d", length);
+	DBG("length %u", length);
 
 	if (!rec || offset >= length)
 		return NULL;
@@ -1081,7 +1081,7 @@ static struct near_ndef_record_header *parse_record_header(uint8_t *rec,
 			goto fail;
 	}
 
-	DBG("payload length %d", rec_header->payload_len);
+	DBG("payload length %u", rec_header->payload_len);
 
 	if (rec_header->il == 1) {
 		rec_header->il_length = rec[offset++];
-- 
2.27.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.