From a2b0cee935e4d0648a13572b57fda059c16854fb Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 19 May 2020 13:27:02 +0200 Subject: [PATCH] huawei,helpers: fix warnings with -Wcast-align huawei/mm-modem-helpers-huawei.c: In function 'match_info_to_ip4_addr': huawei/mm-modem-helpers-huawei.c:193:39: error: cast increases required alignment of target type [-Werror=cast-align] *out_addr = GUINT32_SWAP_LE_BE (*((guint32 *) bin)); ^ /usr/include/glib-2.0/glib/gtypes.h:184:77: note: in definition of macro 'GUINT32_SWAP_LE_BE' # define GUINT32_SWAP_LE_BE(val) ((guint32) __builtin_bswap32 ((gint32) (val))) ^~~ --- plugins/huawei/mm-modem-helpers-huawei.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/huawei/mm-modem-helpers-huawei.c b/plugins/huawei/mm-modem-helpers-huawei.c index a1422be6..f8baf829 100644 --- a/plugins/huawei/mm-modem-helpers-huawei.c +++ b/plugins/huawei/mm-modem-helpers-huawei.c @@ -163,6 +163,7 @@ match_info_to_ip4_addr (GMatchInfo *match_info, gchar buf[9]; gsize len, bin_len; gboolean success = FALSE; + guint32 aux; s = g_match_info_fetch (match_info, match_index); g_return_val_if_fail (s != NULL, FALSE); @@ -190,7 +191,8 @@ match_info_to_ip4_addr (GMatchInfo *match_info, if (!bin || bin_len != 4) goto done; - *out_addr = GUINT32_SWAP_LE_BE (*((guint32 *) bin)); + memcpy (&aux, bin, 4); + *out_addr = GUINT32_SWAP_LE_BE (aux); success = TRUE; done: