Fix clang warning:
src/ndef.c:1196:28: error: cast from 'char *' to 'gunichar2 *' (aka
'unsigned short *') increases required alignment from 1 to 2
[-Werror,-Wcast-align]
g_str = g_utf16_to_utf8((gunichar2 *)txt, len, NULL,
^~~~~~~~~~~~~~~~
The case is safe as length of string is an even number.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
---
src/ndef.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ndef.c b/src/ndef.c
index fdd44b467027..13e3356c2c4c 100644
--- a/src/ndef.c
+++ b/src/ndef.c
@@ -1198,7 +1198,8 @@ parse_text_payload(uint8_t *payload, uint32_t length)
txt = (char *)(payload + offset);
if (status)
- g_str = g_utf16_to_utf8((gunichar2 *)txt, len, NULL,
+ /* Cast to void to silence the 1-to-2 alignment warning */
+ g_str = g_utf16_to_utf8((gunichar2 *)(void *)txt, len, NULL,
NULL, NULL);
else
g_str = txt;
--
2.27.0