From 3706695fb3cb5a378c355dd485eabed008dcbb62 Mon Sep 17 00:00:00 2001 From: Matthew Leeds Date: Thu, 22 Aug 2019 19:08:26 -0700 Subject: [PATCH] common: Fix misordering of branch and arch arguments flatpak_dir_collect_deployed_refs() has the order of its "branch" and "arch" arguments wrong, as does its only caller flatpak_list_deployed_refs(). When flatpak_list_deployed_refs() is called by add_extension() the arch is put in the branch argument and vice versa. But then in the implementation the arch is used as if it's the branch and vice versa, so there's no functional bug here. Fix the order for readability. Similarly, flatpak_list_unmaintained_refs() has the order wrong, but the confusion is only within that function, since the order is correct in its caller add_extension() and in the function it uses, flatpak_dir_collect_unmaintained_refs(). So there's no functional bug there either, but fix the order. Closes: #3067 Approved by: alexlarsson --- common/flatpak-dir-private.h | 2 +- common/flatpak-dir.c | 6 +++--- common/flatpak-utils-private.h | 2 +- common/flatpak-utils.c | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/common/flatpak-dir-private.h b/common/flatpak-dir-private.h index c8d0d74e..3d8f4dc8 100644 --- a/common/flatpak-dir-private.h +++ b/common/flatpak-dir-private.h @@ -747,8 +747,8 @@ gboolean flatpak_dir_cleanup_undeployed_refs (FlatpakDir *self, gboolean flatpak_dir_collect_deployed_refs (FlatpakDir *self, const char *type, const char *name_prefix, - const char *branch, const char *arch, + const char *branch, GHashTable *hash, GCancellable *cancellable, GError **error); diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 01a46f8f..d76a97ff 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -9534,8 +9534,8 @@ gboolean flatpak_dir_collect_deployed_refs (FlatpakDir *self, const char *type, const char *name_prefix, - const char *branch, const char *arch, + const char *branch, GHashTable *hash, GCancellable *cancellable, GError **error) @@ -9565,8 +9565,8 @@ flatpak_dir_collect_deployed_refs (FlatpakDir *self, name[0] != '.' && (name_prefix == NULL || g_str_has_prefix (name, name_prefix))) { g_autoptr(GFile) child1 = g_file_get_child (dir, name); - g_autoptr(GFile) child2 = g_file_get_child (child1, branch); - g_autoptr(GFile) child3 = g_file_get_child (child2, arch); + g_autoptr(GFile) child2 = g_file_get_child (child1, arch); + g_autoptr(GFile) child3 = g_file_get_child (child2, branch); g_autoptr(GFile) active = g_file_get_child (child3, "active"); if (g_file_query_exists (active, cancellable)) diff --git a/common/flatpak-utils-private.h b/common/flatpak-utils-private.h index 85102aa2..f3b5cb81 100644 --- a/common/flatpak-utils-private.h +++ b/common/flatpak-utils-private.h @@ -256,8 +256,8 @@ FlatpakDeploy * flatpak_find_deploy_for_ref (const char *ref, GError **error); char ** flatpak_list_deployed_refs (const char *type, const char *name_prefix, - const char *branch, const char *arch, + const char *branch, GCancellable *cancellable, GError **error); char ** flatpak_list_unmaintained_refs (const char *name_prefix, diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index d12e0bee..6f2d7190 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -1576,8 +1576,8 @@ flatpak_build_app_ref (const char *app, char ** flatpak_list_deployed_refs (const char *type, const char *name_prefix, - const char *branch, const char *arch, + const char *branch, GCancellable *cancellable, GError **error) { @@ -1598,7 +1598,7 @@ flatpak_list_deployed_refs (const char *type, goto out; if (!flatpak_dir_collect_deployed_refs (user_dir, type, name_prefix, - branch, arch, hash, cancellable, + arch, branch, hash, cancellable, error)) goto out; @@ -1606,7 +1606,7 @@ flatpak_list_deployed_refs (const char *type, { FlatpakDir *system_dir = g_ptr_array_index (system_dirs, i); if (!flatpak_dir_collect_deployed_refs (system_dir, type, name_prefix, - branch, arch, hash, cancellable, + arch, branch, hash, cancellable, error)) goto out; } @@ -1628,8 +1628,8 @@ out: char ** flatpak_list_unmaintained_refs (const char *name_prefix, - const char *branch, const char *arch, + const char *branch, GCancellable *cancellable, GError **error) { @@ -1647,7 +1647,7 @@ flatpak_list_unmaintained_refs (const char *name_prefix, user_dir = flatpak_dir_get_user (); if (!flatpak_dir_collect_unmaintained_refs (user_dir, name_prefix, - branch, arch, hash, cancellable, + arch, branch, hash, cancellable, error)) return NULL; @@ -1660,7 +1660,7 @@ flatpak_list_unmaintained_refs (const char *name_prefix, FlatpakDir *system_dir = g_ptr_array_index (system_dirs, i); if (!flatpak_dir_collect_unmaintained_refs (system_dir, name_prefix, - branch, arch, hash, cancellable, + arch, branch, hash, cancellable, error)) return NULL; }