core: Convert metadata parsing API to GFile

This commit is contained in:
Colin Walters committed 2011-11-17 18:36:57 -05:00
1 parent 218684786d
commit 2c2b9c0e00
3 files changed
+9 -8

No files matched your search

+4 -6
View File
@@ -395,19 +395,17 @@ ostree_set_xattrs (GFile *f,
}
gboolean
ostree_parse_metadata_file (const char *path,
ostree_parse_metadata_file (GFile *file,
OstreeSerializedVariantType *out_type,
GVariant **out_variant,
GError **error)
{
GFile *pathf = NULL;
gboolean ret = FALSE;
GVariant *ret_variant = NULL;
GVariant *container = NULL;
guint32 ret_type;
pathf = ot_util_new_file_for_path (path);
if (!ot_util_variant_map (pathf, G_VARIANT_TYPE (OSTREE_SERIALIZED_VARIANT_FORMAT),
if (!ot_util_variant_map (file, G_VARIANT_TYPE (OSTREE_SERIALIZED_VARIANT_FORMAT),
&container, error))
goto out;
@@ -417,7 +415,8 @@ ostree_parse_metadata_file (const char *path,
if (ret_type <= 0 || ret_type > OSTREE_SERIALIZED_VARIANT_LAST)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Corrupted metadata object '%s'; invalid type %d", path, ret_type);
"Corrupted metadata object '%s'; invalid type %d",
ot_gfile_get_path_cached (file), ret_type);
goto out;
}
@@ -430,7 +429,6 @@ ostree_parse_metadata_file (const char *path,
g_variant_unref (ret_variant);
if (container != NULL)
g_variant_unref (container);
g_clear_object (&pathf);
return ret;
}