summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2016-08-22 22:34:51 (GMT)
committer Chris Young <chris@unsatisfactorysoftware.co.uk>2016-08-22 22:34:51 (GMT)
commitc149e4a24ac2c670d315a5f1a4a83b58bf737c52 (patch)
tree455a9e5a7d6e4036180de59118708051353ef3ef
parentc9bdd0c5013efa193668ee24a8a0fb73227471a6 (diff)
downloadlibsvgtiny-c149e4a24ac2c670d315a5f1a4a83b58bf737c52.tar.gz
libsvgtiny-c149e4a24ac2c670d315a5f1a4a83b58bf737c52.tar.bz2
Add an extra callback so we can parse the fetched external entity
-rw-r--r--include/svgtiny.h4
-rw-r--r--src/svgtiny.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/include/svgtiny.h b/include/svgtiny.h
index 84873ed..50dbc7a 100644
--- a/include/svgtiny.h
+++ b/include/svgtiny.h
@@ -62,12 +62,14 @@ struct svgtiny_named_color {
svgtiny_colour color;
};
+typedef int (*svgtiny_dom_xml_parser_fetch_cb)(void *parser, const char *base, const char *uri,
+ int (*svgtiny_expat_xmlparser_parse_cb)(void *parser, const char *data, int size));
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 (*fetch_cb)(void *parser, const char *base, const char *uri));
+ svgtiny_dom_xml_parser_fetch_cb fetch_cb);
void svgtiny_free(struct svgtiny_diagram *svg);
#endif
diff --git a/src/svgtiny.c b/src/svgtiny.c
index 65057b2..30d5d02 100644
--- a/src/svgtiny.c
+++ b/src/svgtiny.c
@@ -134,7 +134,7 @@ 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 (*fetch_cb)(void *parser, const char *base, const char *uri))
+ svgtiny_dom_xml_parser_fetch_cb fetch_cb)
{
dom_document *document;
dom_exception exc;
@@ -181,7 +181,7 @@ svgtiny_code svgtiny_parse(struct svgtiny_diagram *diagram,
/* We're done parsing, drop the parser.
* We now own the document entirely.
*/
- dom_xml_parser_destroy(parser);
+// dom_xml_parser_destroy(parser); /**\todo we need to ensure the doc is fully parsed here */
/* find root <svg> element */
exc = dom_document_get_document_element(document, &svg);