aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-05-19 13:27:02 +0200
committerAleksander Morgado <aleksander@aleksander.es>2020-05-19 13:44:23 +0200
commita2b0cee935e4d0648a13572b57fda059c16854fb (patch)
tree2209b48c361f10c56bd8d717129c76ed82d9445b
parentbd2e6f5df43236f709113647845afb9fe095f837 (diff)
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))) ^~~
-rw-r--r--plugins/huawei/mm-modem-helpers-huawei.c4
1 files changed, 3 insertions, 1 deletions
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: