utils: Add and use FLATPAK_VARIANT_DICT_INITIALIZER

This fixes warnings on some versions of glib due to a private struct
change.
tingping/wmclass
Alexander Larsson 2016-12-13 10:08:26 +01:00
parent 42d2c6a5d6
commit c756534b19
3 changed files with 4 additions and 2 deletions

View File

@ -617,7 +617,7 @@ flatpak_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
OstreeRepoTransactionStats stats;
g_autoptr(OstreeRepoCommitModifier) modifier = NULL;
CommitData commit_data = {0};
g_auto(GVariantDict) metadata_dict = {0};
g_auto(GVariantDict) metadata_dict = FLATPAK_VARIANT_DICT_INITIALIZER;
g_autoptr(GVariant) metadata_dict_v = NULL;
context = g_option_context_new (_("LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory"));

View File

@ -1398,7 +1398,7 @@ flatpak_dir_pull_extra_data (FlatpakDir *self,
g_autoptr(GFile) root = NULL;
g_autoptr(GVariant) extra_data_sources = NULL;
g_autoptr(GVariant) detached_metadata = NULL;
g_auto(GVariantDict) new_metadata_dict = {0};
g_auto(GVariantDict) new_metadata_dict = FLATPAK_VARIANT_DICT_INITIALIZER;
g_autoptr(GVariantBuilder) extra_data_builder = NULL;
g_autoptr(GVariant) new_detached_metadata = NULL;
g_autoptr(GVariant) extra_data = NULL;

View File

@ -40,8 +40,10 @@ typedef enum {
/* https://bugzilla.gnome.org/show_bug.cgi?id=766370 */
#if !GLIB_CHECK_VERSION(2, 49, 3)
#define FLATPAK_VARIANT_BUILDER_INITIALIZER {{0,}}
#define FLATPAK_VARIANT_DICT_INITIALIZER {{0,}}
#else
#define FLATPAK_VARIANT_BUILDER_INITIALIZER {{{0,}}}
#define FLATPAK_VARIANT_DICT_INITIALIZER {{{0,}}}
#endif
gboolean flatpak_fail (GError **error,