[librsvg: 1/11] Make _rsvg_handle_allow_load() take a GFile for the base uri, not a handle
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 1/11] Make _rsvg_handle_allow_load() take a GFile for the base uri, not a handle
- Date: Tue, 5 Dec 2017 00:55:56 +0000 (UTC)
commit 72a4f0584e08bcb16b189eb8b395e193fdc3f88a
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Dec 4 13:06:39 2017 -0600
Make _rsvg_handle_allow_load() take a GFile for the base uri, not a handle
rsvg-base.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/rsvg-base.c b/rsvg-base.c
index 74a59ec..5437ec6 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -2666,11 +2666,10 @@ rsvg_return_if_fail_warning (const char *pretty_function, const char *expression
}
static gboolean
-_rsvg_handle_allow_load (RsvgHandle *handle,
+_rsvg_handle_allow_load (GFile *base_gfile,
const char *uri,
GError **error)
{
- RsvgHandlePrivate *priv = handle->priv;
GFile *base;
char *path, *dir;
char *scheme = NULL, *cpath = NULL, *cdir = NULL;
@@ -2686,11 +2685,11 @@ _rsvg_handle_allow_load (RsvgHandle *handle,
goto allow;
/* No base to compare to? */
- if (priv->base_gfile == NULL)
+ if (base_gfile == NULL)
goto deny;
/* Deny loads from differing URI schemes */
- if (!g_file_has_uri_scheme (priv->base_gfile, scheme))
+ if (!g_file_has_uri_scheme (base_gfile, scheme))
goto deny;
/* resource: is allowed to load anything from other resources */
@@ -2701,7 +2700,7 @@ _rsvg_handle_allow_load (RsvgHandle *handle,
if (!g_str_equal (scheme, "file"))
goto deny;
- base = g_file_get_parent (priv->base_gfile);
+ base = g_file_get_parent (base_gfile);
if (base == NULL)
goto deny;
@@ -2782,12 +2781,13 @@ _rsvg_handle_acquire_data (RsvgHandle *handle,
gsize *len,
GError **error)
{
+ RsvgHandlePrivate *priv = handle->priv;
char *uri;
char *data;
uri = _rsvg_handle_resolve_uri (handle, url);
- if (_rsvg_handle_allow_load (handle, uri, error)) {
+ if (_rsvg_handle_allow_load (priv->base_gfile, uri, error)) {
data = _rsvg_io_acquire_data (uri,
rsvg_handle_get_base_uri (handle),
content_type,
@@ -2808,12 +2808,13 @@ _rsvg_handle_acquire_stream (RsvgHandle *handle,
char **content_type,
GError **error)
{
+ RsvgHandlePrivate *priv = handle->priv;
char *uri;
GInputStream *stream;
uri = _rsvg_handle_resolve_uri (handle, url);
- if (_rsvg_handle_allow_load (handle, uri, error)) {
+ if (_rsvg_handle_allow_load (priv->base_gfile, uri, error)) {
stream = _rsvg_io_acquire_stream (uri,
rsvg_handle_get_base_uri (handle),
content_type,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]