[glib/resources] Don't report the trailing null we store in non-compressed resource files
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/resources] Don't report the trailing null we store in non-compressed resource files
- Date: Thu, 22 Dec 2011 10:09:33 +0000 (UTC)
commit ff0dc58e9ea7f46b05142c13ada3ae5207071908
Author: Alexander Larsson <alexl redhat com>
Date: Thu Dec 22 11:07:11 2011 +0100
Don't report the trailing null we store in non-compressed resource files
gio/gresource.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gio/gresource.c b/gio/gresource.c
index 4ec9c4d..6f2ff79 100644
--- a/gio/gresource.c
+++ b/gio/gresource.c
@@ -188,7 +188,13 @@ static gboolean do_lookup (GResource *resource,
if (data)
*data = g_variant_get_data (array);
if (data_size)
- *data_size = g_variant_get_size (array);
+ {
+ /* Don't report trailing newline that non-compressed files has */
+ if (_flags & G_RESOURCE_FLAGS_COMPRESSED)
+ *data_size = g_variant_get_size (array);
+ else
+ *data_size = g_variant_get_size (array) - 1;
+ }
res = TRUE;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]