diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> | 2021-07-09 16:25:43 +0200 |
---|---|---|
committer | Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> | 2021-07-19 12:36:25 +0200 |
commit | 81558bfb7b1102eb6a702e53f180c9caf7740cab (patch) | |
tree | 9230cf86d282a430b8f38c880427b52d97a25e34 | |
parent | 112003ee6967ce92c3453d760f0b5c9aa74c566a (diff) | |
download | neard-81558bfb7b1102eb6a702e53f180c9caf7740cab.tar.gz |
ndef: silence clang -Wcast-align warning
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@canonical.com>
-rw-r--r-- | src/ndef.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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; |