[glib/resource-overlay-info] gresource: Complete the overlay support
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/resource-overlay-info] gresource: Complete the overlay support
- Date: Tue, 27 Nov 2018 05:15:48 +0000 (UTC)
commit 6313cf5f3f00e2e585f14a9ef274b60f712a7fd3
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Nov 27 00:13:22 2018 -0500
gresource: Complete the overlay support
Unlike the other g_resources_ functions, g_resources_get_info
was not respecting G_RESOURCE_OVERLAYS. Add this missing
support.
Closes: #1445
gio/gresource.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
---
diff --git a/gio/gresource.c b/gio/gresource.c
index 2844f4808..a9bf14bf9 100644
--- a/gio/gresource.c
+++ b/gio/gresource.c
@@ -285,6 +285,27 @@ enumerate_overlay_dir (const gchar *candidate,
return FALSE;
}
+typedef struct {
+ gsize size;
+ guint32 flags;
+} InfoData;
+
+static gboolean
+get_overlay_info (const gchar *candidate,
+ gpointer user_data)
+{
+ InfoData *info = user_data;
+ GStatBuf buf;
+
+ if (g_stat (candidate, &buf) < 0)
+ return FALSE;
+
+ info->size = buf.st_size;
+ info->flags = G_RESOURCE_FLAGS_NONE;
+
+ return TRUE;
+}
+
static gboolean
g_resource_find_overlay (const gchar *path,
CheckCandidate check,
@@ -1251,6 +1272,17 @@ g_resources_get_info (const gchar *path,
gboolean res = FALSE;
GList *l;
gboolean r_res;
+ InfoData info;
+
+ if (g_resource_find_overlay (path, get_overlay_info, &info))
+ {
+ if (size)
+ *size = info.size;
+ if (flags)
+ *flags = info.flags;
+
+ return TRUE;
+ }
register_lazy_static_resources ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]