[linux-nfc] [neard][PATCH 26/34] device: 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/device.c: In function ‘near_device_get_device’:
    src/device.c:85:33: error: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘uint32_t’ {aka ‘unsigned int’} [-Werror=format=]
       85 |  path = g_strdup_printf("%s/nfc%d/device%d", NFC_PATH,
          |                                ~^
          |                                 |
          |                                 int
          |                                %d
       86 |      adapter_idx, target_idx);
          |      ~~~~~~~~~~~
          |      |
          |      uint32_t {aka unsigned int}

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

diff --git a/src/device.c b/src/device.c
index a6598e0ddd28..aeae7d39a290 100644
--- a/src/device.c
+++ b/src/device.c
@@ -82,7 +82,7 @@ struct near_device *near_device_get_device(uint32_t adapter_idx,
 
 	DBG("");
 
-	path = g_strdup_printf("%s/nfc%d/device%d", NFC_PATH,
+	path = g_strdup_printf("%s/nfc%u/device%u", NFC_PATH,
 					adapter_idx, target_idx);
 	if (!path)
 		return NULL;
@@ -305,7 +305,7 @@ int near_device_add_records(struct near_device *device, GList *records,
 	for (list = records; list; list = list->next) {
 		record = list->data;
 
-		path = g_strdup_printf("%s/nfc%d/device%d/record%d",
+		path = g_strdup_printf("%s/nfc%u/device%u/record%u",
 					NFC_PATH, device->adapter_idx,
 					device->target_idx, device->n_records);
 
@@ -342,7 +342,7 @@ struct near_device *__near_device_add(uint32_t adapter_idx, uint32_t target_idx,
 	if (!device)
 		return NULL;
 
-	device->path = g_strdup_printf("%s/nfc%d/device%d", NFC_PATH,
+	device->path = g_strdup_printf("%s/nfc%u/device%u", NFC_PATH,
 					adapter_idx, target_idx);
 	if (!device->path) {
 		g_free(device);
-- 
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.