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

Krzysztof Kozlowski <[email protected]>
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:

    src/ndef.c: In function ‘property_get_uri’:
    src/ndef.c:506:31: error: field precision specifier ‘.*’ expects argument of type ‘int’, but argument 3 has type ‘uint32_t’ {aka ‘unsigned int’} [-Werror=format=]
      506 |  value = g_strdup_printf("%s%.*s", prefix, uri->field_length,
          |                             ~~^~           ~~~~~~~~~~~~~~~~~
          |                               |               |
          |                               int             uint32_t {aka unsigned int}
    src/ndef.c: In function ‘property_get_uri’:
    src/ndef.c:506:31: error: field precision specifier ‘.*’ expects argument of type ‘int’, but argument 3 has type ‘uint32_t’ {aka ‘unsigned int’} [-Werror=format=]
      506 |  value = g_strdup_printf("%s%.*s", prefix, uri->field_length,
          |                             ~~^~           ~~~~~~~~~~~~~~~~~
          |                               |               |
          |                               int             uint32_t {aka unsigned int}

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 0d84ff4dc17b..66faf7867399 100644
--- a/src/ndef.c
+++ b/src/ndef.c
@@ -503,8 +503,8 @@ static gboolean property_get_uri(const GDBusPropertyTable *property,
 
 	DBG("URI prefix %s", prefix);
 
-	value = g_strdup_printf("%s%.*s", prefix, uri->field_length,
-							 uri->field);
+	value = g_strdup_printf("%s%.*s", prefix, (int)uri->field_length,
+				uri->field);
 
 	dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &value);
 
@@ -1280,7 +1280,7 @@ parse_uri_payload(uint8_t *payload, uint32_t length)
 	}
 
 	DBG("Identifier  '0X%X'", uri_payload->identifier);
-	DBG("Field  '%.*s'", uri_payload->field_length, uri_payload->field);
+	DBG("Field  '%.*s'", (int)uri_payload->field_length, uri_payload->field);
 
 	return uri_payload;
 
-- 
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
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.