[ostree] Switch to libgsystem file reading API



commit 1ac307e6b8c0d05a267af01b12aa65ea4ed80aaa
Author: Colin Walters <walters verbum org>
Date:   Thu Nov 29 16:58:39 2012 -0500

    Switch to libgsystem file reading API
    
    More draining common utilities into libgsystem.

 src/libgsystem               |    2 +-
 src/libostree/ostree-repo.c  |    4 ++--
 src/libotutil/ot-gio-utils.c |   30 ------------------------------
 src/libotutil/ot-gio-utils.h |    7 -------
 4 files changed, 3 insertions(+), 40 deletions(-)
---
diff --git a/src/libgsystem b/src/libgsystem
index ab2588d..eb4cecb 160000
--- a/src/libgsystem
+++ b/src/libgsystem
@@ -1 +1 @@
-Subproject commit ab2588da8442fc6135af13ee624dd91b73a7051c
+Subproject commit eb4cecbc1528e1d1bdd99298d6f58768c6642b24
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index d48ebd5..e0c7ab6 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -233,7 +233,7 @@ parse_rev_file (OstreeRepo     *self,
   GError *temp_error = NULL;
   ot_lfree char *rev = NULL;
 
-  if (!ot_gfile_load_contents_utf8 (f, &rev, NULL, NULL, &temp_error))
+  if ((rev = gs_file_load_contents_utf8 (f, NULL, &temp_error)) == NULL)
     goto out;
 
   if (rev == NULL)
@@ -419,7 +419,7 @@ ostree_repo_resolve_rev (OstreeRepo     *self,
 
       if (child)
         {
-          if (!ot_gfile_load_contents_utf8 (child, &ret_rev, NULL, NULL, &temp_error))
+          if ((ret_rev = gs_file_load_contents_utf8 (child, NULL, &temp_error)) == NULL)
             {
               g_propagate_error (error, temp_error);
               g_prefix_error (error, "Couldn't open ref '%s': ", gs_file_get_path_cached (child));
diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c
index 1130225..42e36dc 100644
--- a/src/libotutil/ot-gio-utils.c
+++ b/src/libotutil/ot-gio-utils.c
@@ -133,36 +133,6 @@ ot_gfile_get_child_build_path (GFile      *parent,
   return g_file_resolve_relative_path (parent, path);
 }
 
-gboolean
-ot_gfile_load_contents_utf8 (GFile         *file,
-                             char         **out_contents,
-                             char         **out_etag,
-                             GCancellable  *cancellable,
-                             GError       **error)
-{
-  gboolean ret = FALSE;
-  gsize len;
-  ot_lfree char *ret_contents = NULL;
-  ot_lfree char *ret_etag = NULL;
-
-  if (!g_file_load_contents (file, cancellable, &ret_contents, &len, &ret_etag, error))
-    goto out;
-  if (!g_utf8_validate (ret_contents, len, NULL))
-    {
-      g_set_error (error,
-                   G_IO_ERROR,
-                   G_IO_ERROR_INVALID_DATA,
-                   "Invalid UTF-8");
-      goto out;
-    }
-
-  ret = TRUE;
-  ot_transfer_out_value (out_contents, &ret_contents);
-  ot_transfer_out_value (out_etag, &ret_etag);
- out:
-  return ret;
-}
-
 static gboolean
 cp_internal (GFile         *src,
              GFile         *dest,
diff --git a/src/libotutil/ot-gio-utils.h b/src/libotutil/ot-gio-utils.h
index 2481698..ce055c6 100644
--- a/src/libotutil/ot-gio-utils.h
+++ b/src/libotutil/ot-gio-utils.h
@@ -42,13 +42,6 @@ GFile *ot_gfile_get_child_strconcat (GFile *parent, const char *first, ...) G_GN
 
 GFile *ot_gfile_get_child_build_path (GFile *parent, const char *first, ...) G_GNUC_NULL_TERMINATED;
 
-gboolean ot_gfile_load_contents_utf8 (GFile         *file,
-                                      char         **contents_out,
-                                      char         **etag_out,
-                                      GCancellable  *cancellable,
-                                      GError       **error);
-
-
 gboolean ot_gio_shutil_cp_a (GFile         *src,
                              GFile         *dest,
                              GCancellable  *cancellable,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]