From 68a9b9d3ca59ae533b81727ad6a5694055ccafb4 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 5 Sep 2024 12:14:15 +0100 Subject: [PATCH] gresource: Split g_resource_lookup_data() into two internal helpers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s now a call to `do_lookup()` followed by a call to `resource_to_bytes()`. This makes no functional changes, but will be useful in the following commit. Signed-off-by: Philip Withnall Helps: #3465 --- gio/gresource.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gio/gresource.c b/gio/gresource.c index c8a85c9b4..b34c5bd24 100644 --- a/gio/gresource.c +++ b/gio/gresource.c @@ -804,6 +804,14 @@ g_resource_open_stream (GResource *resource, return stream; } +static GBytes *resource_to_bytes (GResource *resource, + const char *path, + size_t size, + const void *data, + size_t data_size, + guint32 flags, + GError **error); + /** * g_resource_lookup_data: * @resource: A #GResource @@ -845,6 +853,18 @@ g_resource_lookup_data (GResource *resource, if (!do_lookup (resource, path, lookup_flags, &size, &flags, &data, &data_size, error)) return NULL; + return resource_to_bytes (resource, path, size, data, data_size, flags, error); +} + +static GBytes * +resource_to_bytes (GResource *resource, + const char *path, + size_t size, + const void *data, + size_t data_size, + guint32 flags, + GError **error) +{ if (size == 0) return g_bytes_new_with_free_func ("", 0, (GDestroyNotify) g_resource_unref, g_resource_ref (resource)); else if (flags & G_RESOURCE_FLAGS_COMPRESSED)