[librsvg: 4/29] gitlab#198 - Fix rsvg_pixbuf_from_file_with_size_data()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 4/29] gitlab#198 - Fix rsvg_pixbuf_from_file_with_size_data()
- Date: Tue, 6 Feb 2018 21:04:25 +0000 (UTC)
commit 758fd17561eb3c90c55629b02567b5e385659894
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Feb 5 16:50:27 2018 -0600
gitlab#198 - Fix rsvg_pixbuf_from_file_with_size_data()
Now that _rsvg_io_acquire_data() expects a URI, we first need to
create a URI from the provided file name.
https://gitlab.gnome.org/GNOME/librsvg/issues/198
rsvg-file-util.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/rsvg-file-util.c b/rsvg-file-util.c
index 947ef46..c8de90c 100644
--- a/rsvg-file-util.c
+++ b/rsvg-file-util.c
@@ -126,19 +126,28 @@ rsvg_pixbuf_from_file_with_size_data (const gchar * file_name,
GdkPixbuf *pixbuf;
char *data;
gsize data_len;
- GString *base_uri = g_string_new (file_name);
+ GFile *file;
+ gchar *base_uri;
- data = _rsvg_io_acquire_data (file_name, base_uri->str, NULL, &data_len, NULL, error);
+ file = g_file_new_for_path (file_name);
+ base_uri = g_file_get_uri (file);
+ if (!base_uri) {
+ g_object_unref (file);
+ return NULL;
+ }
+
+ data = _rsvg_io_acquire_data (base_uri, base_uri, NULL, &data_len, NULL, error);
if (data) {
pixbuf = rsvg_pixbuf_from_stdio_file_with_size_data (data, data_len,
- cb_data, base_uri->str, error);
+ cb_data, base_uri, error);
g_free (data);
} else {
pixbuf = NULL;
}
- g_string_free (base_uri, TRUE);
+ g_free (base_uri);
+ g_object_unref (file);
return pixbuf;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]