[linux-nfc] [neard][PATCH v2 10/73] dbus: fix -Wformat in near_dbus_encode_string()
Krzysztof Kozlowski <[email protected]> Mon, 19 Jul 2021 13:07:16 +0200
| Newsgroups | org.01.lists.linux-nfc,dev.linux.lists.oe-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
_______________________________________________
Linux-nfc mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s