mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 08:28:53 +02: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:
@@ -804,6 +804,14 @@ g_resource_open_stream (GResource *resource,
|
|||||||
return stream;
|
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:
|
* g_resource_lookup_data:
|
||||||
* @resource: A #GResource
|
* @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))
|
if (!do_lookup (resource, path, lookup_flags, &size, &flags, &data, &data_size, error))
|
||||||
return NULL;
|
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)
|
if (size == 0)
|
||||||
return g_bytes_new_with_free_func ("", 0, (GDestroyNotify) g_resource_unref, g_resource_ref (resource));
|
return g_bytes_new_with_free_func ("", 0, (GDestroyNotify) g_resource_unref, g_resource_ref (resource));
|
||||||
else if (flags & G_RESOURCE_FLAGS_COMPRESSED)
|
else if (flags & G_RESOURCE_FLAGS_COMPRESSED)
|
||||||
|
Reference in New Issue
Block a user