[neard][PATCH v2 10/73] dbus: fix -Wformat in near_dbus_encode_string()

Krzysztof Kozlowski <[email protected]>
Newsgroups dev.linux.lists.oe-linux-nfc,org.01.lists.linux-nfc
Message-ID <[email protected]>
Fix GCC warning:

    src/dbus.c: In function ‘near_dbus_encode_string’:
    src/dbus.c:71:37: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘int’ [-Werror=format=]
       71 |    g_string_append_printf(str, "_%02x", tmp);
          |                                  ~~~^   ~~~
          |                                     |   |
          |                                     |   int
          |                                     unsigned int
          |                                  %02x

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
 src/dbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dbus.c b/src/dbus.c
index 9c67a9eec89a..ed4570d951ed 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -68,7 +68,7 @@ char *near_dbus_encode_string(const char *value)
 		const char tmp = value[i];
 		if ((tmp < '0' || tmp > '9') && (tmp < 'A' || tmp > 'Z') &&
 						(tmp < 'a' || tmp > 'z'))
-			g_string_append_printf(str, "_%02x", tmp);
+			g_string_append_printf(str, "_%02x", (unsigned int)tmp);
 		else
 			str = g_string_append_c(str, tmp);
 	}
-- 
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.