summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-08-22 09:54:54 +0100
committerRichard Hughes <richard@hughsie.com>2016-08-22 09:54:54 +0100
commite660570b428b5a645e391070608b25b5a5b38ebf (patch)
treefadf6cb2837cd629579da2ae7e5e1f01c47834f8
parent6717d2bc5a3e05d1d6ee53aacb622cfbea9e2b24 (diff)
downloadappstream-glib-e660570b428b5a645e391070608b25b5a5b38ebf.tar.gz
trivial: Fix a -Wcast-align issue on ARM
-rw-r--r--libappstream-glib/as-app-builder.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libappstream-glib/as-app-builder.c b/libappstream-glib/as-app-builder.c
index 41ef64a..32fe467 100644
--- a/libappstream-glib/as-app-builder.c
+++ b/libappstream-glib/as-app-builder.c
@@ -102,18 +102,19 @@ as_app_builder_parse_file_gettext (AsAppBuilderContext *ctx,
GError **error)
{
AsAppBuilderEntry *entry;
- AsAppBuilderGettextHeader *h;
+ AsAppBuilderGettextHeader h;
g_autofree gchar *data = NULL;
gboolean swapped;
- /* read data, although we only strictly need the header */
+ /* read data */
if (!g_file_get_contents (filename, &data, NULL, error))
return FALSE;
- h = (AsAppBuilderGettextHeader *) data;
- if (h->magic == 0x950412de)
+ /* we only strictly need the header */
+ memcpy (&h, data, sizeof (AsAppBuilderGettextHeader));
+ if (h.magic == 0x950412de)
swapped = FALSE;
- else if (h->magic == 0xde120495)
+ else if (h.magic == 0xde120495)
swapped = TRUE;
else {
g_set_error_literal (error,
@@ -125,9 +126,9 @@ as_app_builder_parse_file_gettext (AsAppBuilderContext *ctx,
entry = as_app_builder_entry_new ();
entry->locale = g_strdup (locale);
if (swapped)
- entry->nstrings = GUINT32_SWAP_LE_BE (h->nstrings);
+ entry->nstrings = GUINT32_SWAP_LE_BE (h.nstrings);
else
- entry->nstrings = h->nstrings;
+ entry->nstrings = h.nstrings;
if (entry->nstrings > ctx->max_nstrings)
ctx->max_nstrings = entry->nstrings;
ctx->data = g_list_prepend (ctx->data, entry);