~ubuntu-branches/ubuntu/trusty/librsvg/trusty-proposed

« back to all changes in this revision

Viewing changes to rsvg-base-file-util.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2012-03-27 01:47:52 UTC
  • mfrom: (1.1.32) (34.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20120327014752-c9vmipiww40cnip7
Tags: 2.36.0-1
* New upstream release.
* Update debian/copyright using the machine-readable copyright format 1.0.
* Bump Standards-Version to 3.9.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
#include "config.h"
28
28
#include "rsvg.h"
 
29
#include "rsvg-io.h"
29
30
#include "rsvg-private.h"
30
31
 
31
32
static gboolean
85
86
rsvg_handle_new_from_file (const gchar * file_name, GError ** error)
86
87
{
87
88
    gchar *base_uri;
88
 
    GByteArray *f;
 
89
    guint8 *data;
 
90
    gsize data_len;
89
91
    RsvgHandle *handle = NULL;
90
92
 
91
93
    rsvg_return_val_if_fail (file_name != NULL, NULL, error);
92
94
 
93
95
    base_uri = rsvg_get_base_uri_from_filename (file_name);
94
 
    f = _rsvg_acquire_xlink_href_resource (file_name, base_uri, error);
 
96
    data = _rsvg_io_acquire_data (file_name, base_uri, NULL, &data_len, NULL, error);
95
97
 
96
 
    if (f) {
 
98
    if (data) {
97
99
        handle = rsvg_handle_new ();
98
 
        if (handle) {
99
 
            rsvg_handle_set_base_uri (handle, base_uri);
100
 
            if (!rsvg_handle_fill_with_data (handle, f->data, f->len, error)) {
101
 
                g_object_unref (handle);
102
 
                handle = NULL;
103
 
            }
 
100
        rsvg_handle_set_base_uri (handle, base_uri);
 
101
        if (!rsvg_handle_fill_with_data (handle, data, data_len, error)) {
 
102
            g_object_unref (handle);
 
103
            handle = NULL;
104
104
        }
105
 
        g_byte_array_free (f, TRUE);
 
105
        g_free (data);
106
106
    }
107
107
 
108
108
    g_free (base_uri);