diff options
author | Alexander Larsson <alexl@redhat.com> | 2015-09-10 20:16:52 +0200 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2015-09-13 22:25:21 -0400 |
commit | fd6c572c42a061d61fc0367c8097cc0b5590294a (patch) | |
tree | 975d8e7bb8b7cf2af9dbad5898da2f4e9f2ed541 | |
parent | 27fcf68e7c12f8ade32e0cc8860e3533a3da52b5 (diff) | |
download | ostree-fd6c572c42a061d61fc0367c8097cc0b5590294a.tar.gz |
_ostree_static_delta_part_validate: Take a stream instead of a file as arg
This is only called in one place, and we have already opened the file there,
no need to open it twice.
-rw-r--r-- | src/libostree/ostree-repo-static-delta-core.c | 2 | ||||
-rw-r--r-- | src/libostree/ostree-repo-static-delta-private.h | 2 | ||||
-rw-r--r-- | src/libostree/ostree-repo-static-delta-processing.c | 9 |
3 files changed, 4 insertions, 9 deletions
diff --git a/src/libostree/ostree-repo-static-delta-core.c b/src/libostree/ostree-repo-static-delta-core.c index cd2940ba..c58f868a 100644 --- a/src/libostree/ostree-repo-static-delta-core.c +++ b/src/libostree/ostree-repo-static-delta-core.c @@ -318,7 +318,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo *self, if (!skip_validation) { g_autofree char *expected_checksum = ostree_checksum_from_bytes (csum); - if (!_ostree_static_delta_part_validate (self, part_path, i, + if (!_ostree_static_delta_part_validate (self, in, i, expected_checksum, cancellable, error)) goto out; diff --git a/src/libostree/ostree-repo-static-delta-private.h b/src/libostree/ostree-repo-static-delta-private.h index 4df3b8c6..7dfba0a9 100644 --- a/src/libostree/ostree-repo-static-delta-private.h +++ b/src/libostree/ostree-repo-static-delta-private.h @@ -104,7 +104,7 @@ G_BEGIN_DECLS #define OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT "(a{sv}tayay" OSTREE_COMMIT_GVARIANT_STRING "aya" OSTREE_STATIC_DELTA_META_ENTRY_FORMAT "a" OSTREE_STATIC_DELTA_FALLBACK_FORMAT ")" gboolean _ostree_static_delta_part_validate (OstreeRepo *repo, - GFile *part_path, + GInputStream *in, guint part_offset, const char *expected_checksum, GCancellable *cancellable, diff --git a/src/libostree/ostree-repo-static-delta-processing.c b/src/libostree/ostree-repo-static-delta-processing.c index 1f2b3262..18687f8a 100644 --- a/src/libostree/ostree-repo-static-delta-processing.c +++ b/src/libostree/ostree-repo-static-delta-processing.c @@ -150,22 +150,17 @@ open_output_target (StaticDeltaExecutionState *state, gboolean _ostree_static_delta_part_validate (OstreeRepo *repo, - GFile *part_path, + GInputStream *in, guint part_offset, const char *expected_checksum, GCancellable *cancellable, GError **error) { gboolean ret = FALSE; - g_autoptr(GInputStream) tmp_in = NULL; g_autofree guchar *actual_checksum_bytes = NULL; g_autofree char *actual_checksum = NULL; - tmp_in = (GInputStream*)g_file_read (part_path, cancellable, error); - if (!tmp_in) - goto out; - - if (!ot_gio_checksum_stream (tmp_in, &actual_checksum_bytes, + if (!ot_gio_checksum_stream (in, &actual_checksum_bytes, cancellable, error)) goto out; |