summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2016-08-22 18:18:00 (GMT)
committer Chris Young <chris@unsatisfactorysoftware.co.uk>2016-08-22 18:18:00 (GMT)
commitc9bdd0c5013efa193668ee24a8a0fb73227471a6 (patch)
tree84db6d33dd4b5f921b019f614770d970c84c4f2e
parent5702c70efacc57fd7d5333e949b853cf5a03b677 (diff)
downloadlibsvgtiny-c9bdd0c5013efa193668ee24a8a0fb73227471a6.tar.gz
libsvgtiny-c9bdd0c5013efa193668ee24a8a0fb73227471a6.tar.bz2
Fetch external entities for libexpat/svg through the proper channels.
This currently does fetching, but not parsing.
-rw-r--r--include/svgtiny.h3
-rw-r--r--src/svgtiny.c5
2 files changed, 5 insertions, 3 deletions
diff --git a/include/svgtiny.h b/include/svgtiny.h
index 85f146f..84873ed 100644
--- a/include/svgtiny.h
+++ b/include/svgtiny.h
@@ -66,7 +66,8 @@ struct svgtiny_named_color {
struct svgtiny_diagram *svgtiny_create(void);
svgtiny_code svgtiny_parse(struct svgtiny_diagram *diagram,
const char *buffer, size_t size, const char *url,
- int width, int height);
+ int width, int height,
+ int (*fetch_cb)(void *parser, const char *base, const char *uri));
void svgtiny_free(struct svgtiny_diagram *svg);
#endif
diff --git a/src/svgtiny.c b/src/svgtiny.c
index e42077a..65057b2 100644
--- a/src/svgtiny.c
+++ b/src/svgtiny.c
@@ -133,7 +133,8 @@ static void ignore_msg(uint32_t severity, void *ctx, const char *msg, ...)
svgtiny_code svgtiny_parse(struct svgtiny_diagram *diagram,
const char *buffer, size_t size, const char *url,
- int viewport_width, int viewport_height)
+ int viewport_width, int viewport_height,
+ int (*fetch_cb)(void *parser, const char *base, const char *uri))
{
dom_document *document;
dom_exception exc;
@@ -158,7 +159,7 @@ svgtiny_code svgtiny_parse(struct svgtiny_diagram *diagram,
state.gradient_y2 = NULL;
parser = dom_xml_parser_create(NULL, NULL,
- ignore_msg, NULL, &document);
+ ignore_msg, NULL, &document, fetch_cb);
if (parser == NULL)
return svgtiny_LIBDOM_ERROR;