[gnome-software] GsApp: Swap two enums in GsAppPermissions so that unknown comes first
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] GsApp: Swap two enums in GsAppPermissions so that unknown comes first
- Date: Mon, 4 Mar 2019 14:06:23 +0000 (UTC)
commit a44cf873bd922b6d43f6e9485dd009090d549ed4
Author: Kalev Lember <klember redhat com>
Date: Mon Mar 4 13:43:09 2019 +0100
GsApp: Swap two enums in GsAppPermissions so that unknown comes first
This is convinient because it makes 0-initialized variable mean that we
don't have the data.
lib/gs-app.h | 4 ++--
plugins/flatpak/gs-flatpak.c | 6 +++++-
2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/lib/gs-app.h b/lib/gs-app.h
index 18d4bb4b..4c25961a 100644
--- a/lib/gs-app.h
+++ b/lib/gs-app.h
@@ -132,8 +132,8 @@ typedef enum {
} GsAppQuality;
typedef enum {
- GS_APP_PERMISSIONS_NONE = 0,
- GS_APP_PERMISSIONS_UNKNOWN = 1 << 0,
+ GS_APP_PERMISSIONS_UNKNOWN = 0,
+ GS_APP_PERMISSIONS_NONE = 1 << 0,
GS_APP_PERMISSIONS_NETWORK = 1 << 1,
GS_APP_PERMISSIONS_SYSTEM_BUS = 1 << 2,
GS_APP_PERMISSIONS_SESSION_BUS = 1 << 3,
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 47856988..eee88cc8 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -103,7 +103,7 @@ perms_from_metadata (GKeyFile *keyfile)
{
char **strv;
char *str;
- GsAppPermissions permissions = GS_APP_PERMISSIONS_NONE;
+ GsAppPermissions permissions = GS_APP_PERMISSIONS_UNKNOWN;
strv = g_key_file_get_string_list (keyfile, "Context", "sockets", NULL, NULL);
if (strv != NULL && g_strv_contains ((const gchar * const*)strv, "system-bus"))
@@ -147,6 +147,10 @@ perms_from_metadata (GKeyFile *keyfile)
permissions |= GS_APP_PERMISSIONS_SETTINGS;
g_free (str);
+ /* no permissions set */
+ if (permissions == GS_APP_PERMISSIONS_UNKNOWN)
+ return GS_APP_PERMISSIONS_NONE;
+
return permissions;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]