Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/e0833d6dfcd721d42c0914c747b9cf7f07c3f16c
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/e0833d6dfcd721d42c0914c747b9cf7f07c3f16c
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/e0833d6dfcd721d42c0914c747b9cf7f07c3f16c

The branch, chris/fetch-x-ent-ref has been created
        at  e0833d6dfcd721d42c0914c747b9cf7f07c3f16c (commit)

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=e0833d6dfcd721d42c0914c747b9cf7f07c3f16c
commit e0833d6dfcd721d42c0914c747b9cf7f07c3f16c
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Fetch external entities for libexpat/svg through the proper channels.
    This currently does fetching, but not parsing.

diff --git a/content/handlers/image/svg.c b/content/handlers/image/svg.c
index 94c4858..b81f510 100644
--- a/content/handlers/image/svg.c
+++ b/content/handlers/image/svg.c
@@ -27,11 +27,13 @@
 
 #include <svgtiny.h>
 
+#include "utils/log.h"
 #include "utils/messages.h"
 #include "utils/utils.h"
 #include "netsurf/plotters.h"
 #include "netsurf/content.h"
 #include "content/content_protected.h"
+#include "content/hlcache.h"
 
 #include "image/svg.h"
 
@@ -46,6 +48,57 @@ typedef struct svg_content {
 
 
 
+/** Callback for hlcache fetch */
+static nserror svg_fetch_hlcache_cb(hlcache_handle *handle,
+                       const hlcache_event *event,
+                       void *parser)
+{
+       switch (event->type) {
+               case CONTENT_MSG_DONE:
+                       LOG("external entity '%s' retrieved", 
nsurl_access(hlcache_handle_get_url(handle)));
+               break;
+
+               case CONTENT_MSG_ERROR:
+                       LOG("external entity %s error: %s", 
nsurl_access(hlcache_handle_get_url(handle)), event->data.error);
+                       hlcache_handle_release(handle);
+               break;
+
+               default:
+               break;
+       }
+
+       return NSERROR_OK;
+}
+
+/** Callback for libsvgtiny fetch */
+static int svg_fetch_cb(void *parser, const char *base, const char *uri)
+{
+       nsurl *x_ent;
+       nserror ret;
+       hlcache_handle *handle;
+
+       LOG("Fetching external entity reference %s", uri);
+
+       /* create url */
+       ret = nsurl_create(uri, &x_ent);
+       if (ret != NSERROR_OK) {
+               return false;
+       }
+
+       ret = hlcache_handle_retrieve(x_ent, 0, NULL, NULL,
+                                     svg_fetch_hlcache_cb,
+                                     parser, /* data */
+                                     NULL, CONTENT_ANY,
+                                     &handle);
+       nsurl_unref(x_ent);
+
+       if (ret != NSERROR_OK) {
+               return false;
+       }
+
+       return true;
+}
+
 static nserror svg_create_svg_data(svg_content *c)
 {
        union content_msg_data msg_data;
@@ -139,7 +192,7 @@ static void svg_reformat(struct content *c, int width, int 
height)
 
                svgtiny_parse(svg->diagram, source_data, source_size,
                                nsurl_access(content_get_url(c)),
-                               width, height);
+                               width, height, svg_fetch_cb);
 
                svg->current_width = width;
                svg->current_height = height;
diff --git a/frontends/amiga/iff_dr2d.c b/frontends/amiga/iff_dr2d.c
index aea7738..053f948 100644
--- a/frontends/amiga/iff_dr2d.c
+++ b/frontends/amiga/iff_dr2d.c
@@ -91,7 +91,7 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char 
*buffer,
        }
 
        /* parse */
-       code = svgtiny_parse(diagram, buffer, size, url, 1000, 1000);
+       code = svgtiny_parse(diagram, buffer, size, url, 1000, 1000, NULL);
        if (code != svgtiny_OK) {
                fprintf(stderr, "svgtiny_parse failed: ");
                switch (code) {


-----------------------------------------------------------------------


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to