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))) ^~~
This commit is contained in:
@@ -163,6 +163,7 @@ match_info_to_ip4_addr (GMatchInfo *match_info,
|
|||||||
gchar buf[9];
|
gchar buf[9];
|
||||||
gsize len, bin_len;
|
gsize len, bin_len;
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
|
guint32 aux;
|
||||||
|
|
||||||
s = g_match_info_fetch (match_info, match_index);
|
s = g_match_info_fetch (match_info, match_index);
|
||||||
g_return_val_if_fail (s != NULL, FALSE);
|
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)
|
if (!bin || bin_len != 4)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
*out_addr = GUINT32_SWAP_LE_BE (*((guint32 *) bin));
|
memcpy (&aux, bin, 4);
|
||||||
|
*out_addr = GUINT32_SWAP_LE_BE (aux);
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
Reference in New Issue
Block a user