[gnome-software] Fix issues with GsAppListFilterFlags and GObject properties on 32 bits systems
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Fix issues with GsAppListFilterFlags and GObject properties on 32 bits systems
- Date: Thu, 24 Oct 2019 12:06:49 +0000 (UTC)
commit 232a20f2e84f6679caa98817ca63817c7d92597a
Author: Andre Moreira Magalhaes <andre endlessm com>
Date: Thu Oct 24 09:48:41 2019 +0100
Fix issues with GsAppListFilterFlags and GObject properties on 32 bits systems
GsPluginJob "dedupe-flags" property expects GsAppListFilterFlags as uint64.
This causes a crash on 32 bits systems when passing GsAppListFilterFlags to
g_object_new(), as the type is not properly interpreted as uint64.
Lets force the type to be uint64 so as to avoid a need for casting all
places using g_object_new and GsAppListFilterFlags.
Reworked a little by Philip Withnall.
lib/gs-app-list-private.h | 6 +++++-
lib/gs-plugin-job.c | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/lib/gs-app-list-private.h b/lib/gs-app-list-private.h
index 7794d72d..b6e93066 100644
--- a/lib/gs-app-list-private.h
+++ b/lib/gs-app-list-private.h
@@ -53,9 +53,13 @@ typedef enum {
GS_APP_LIST_FILTER_FLAG_PREFER_INSTALLED= 1 << 3,
GS_APP_LIST_FILTER_FLAG_KEY_ID_PROVIDES = 1 << 4,
/*< private >*/
- GS_APP_LIST_FILTER_FLAG_LAST
+ GS_APP_LIST_FILTER_FLAG_LAST,
+ GS_APP_LIST_FILTER_FLAG_MASK = G_MAXUINT64
} GsAppListFilterFlags;
+/* All the properties which use #GsAppListFilterFlags are guint64s. */
+G_STATIC_ASSERT (sizeof (GsAppListFilterFlags) == sizeof (guint64));
+
GsAppList *gs_app_list_copy (GsAppList *list);
guint gs_app_list_get_size_peak (GsAppList *list);
void gs_app_list_filter_duplicates (GsAppList *list,
diff --git a/lib/gs-plugin-job.c b/lib/gs-plugin-job.c
index 24830a9b..36dc6bea 100644
--- a/lib/gs-plugin-job.c
+++ b/lib/gs-plugin-job.c
@@ -69,7 +69,7 @@ gs_plugin_job_to_string (GsPluginJob *self)
g_string_append_printf (str, " with filter-flags=%s", tmp);
}
if (self->dedupe_flags > 0)
- g_string_append_printf (str, " with dedupe-flags=%x", self->dedupe_flags);
+ g_string_append_printf (str, " with dedupe-flags=%" G_GUINT64_FORMAT, self->dedupe_flags);
if (self->refine_flags > 0) {
g_autofree gchar *tmp = gs_plugin_refine_flags_to_string (self->refine_flags);
g_string_append_printf (str, " with refine-flags=%s", tmp);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]