mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 07:26:15 +01:00
gresource: Split g_resource_lookup_data() into two internal helpers
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 <pwithnall@gnome.org> Helps: #3465
This commit is contained in:
parent
87af31604b
commit
68a9b9d3ca
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user