diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-12-28 13:40:21 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-01-09 13:21:40 +0100 |
commit | 6933d36755f90e23308a52c0c3b9c6a4423a9e4c (patch) | |
tree | d845ac62869d8a09fbf638a2c4bb0953efec1eb7 /source/html | |
parent | 7a439812b2226c1e3b203ec603f05b39d159f91e (diff) | |
download | mupdf-6933d36755f90e23308a52c0c3b9c6a4423a9e4c.tar.xz |
Make fz_parse_xml take a fz_buffer. Make xps_part contain a fz_buffer.
Diffstat (limited to 'source/html')
-rw-r--r-- | source/html/epub-doc.c | 16 | ||||
-rw-r--r-- | source/html/html-layout.c | 6 |
2 files changed, 4 insertions, 18 deletions
diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c index cf7f1ecf..d220816d 100644 --- a/source/html/epub-doc.c +++ b/source/html/epub-doc.c @@ -309,15 +309,11 @@ epub_parse_ncx(fz_context *ctx, epub_document *doc, const char *path) fz_buffer *buf; fz_xml *ncx; char base_uri[2048]; - unsigned char *data; - size_t len; fz_dirname(base_uri, path, sizeof base_uri); buf = fz_read_archive_entry(ctx, zip, path); - fz_terminate_buffer(ctx, buf); - len = fz_buffer_storage(ctx, buf, &data); - ncx = fz_parse_xml(ctx, data, len, 0); + ncx = fz_parse_xml(ctx, buf, 0); fz_drop_buffer(ctx, buf); doc->outline = epub_parse_ncx_imp(ctx, doc, fz_xml_find_down(ncx, "navMap"), base_uri); @@ -347,8 +343,6 @@ epub_parse_header(fz_context *ctx, epub_document *doc) const char *version; char ncx[2048], s[2048]; epub_chapter **tailp; - size_t len; - unsigned char *data; if (fz_has_archive_entry(ctx, zip, "META-INF/rights.xml")) fz_throw(ctx, FZ_ERROR_GENERIC, "EPUB is locked by DRM"); @@ -358,9 +352,7 @@ epub_parse_header(fz_context *ctx, epub_document *doc) /* parse META-INF/container.xml to find OPF */ buf = fz_read_archive_entry(ctx, zip, "META-INF/container.xml"); - fz_terminate_buffer(ctx, buf); - len = fz_buffer_storage(ctx, buf, &data); - container_xml = fz_parse_xml(ctx, data, len, 0); + container_xml = fz_parse_xml(ctx, buf, 0); fz_drop_buffer(ctx, buf); container = fz_xml_find(container_xml, "container"); @@ -375,9 +367,7 @@ epub_parse_header(fz_context *ctx, epub_document *doc) /* parse OPF to find NCX and spine */ buf = fz_read_archive_entry(ctx, zip, full_path); - fz_terminate_buffer(ctx, buf); - len = fz_buffer_storage(ctx, buf, &data); - content_opf = fz_parse_xml(ctx, data, len, 0); + content_opf = fz_parse_xml(ctx, buf, 0); fz_drop_buffer(ctx, buf); package = fz_xml_find(content_opf, "package"); diff --git a/source/html/html-layout.c b/source/html/html-layout.c index ff2102d1..76b4a1cf 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -2548,8 +2548,6 @@ fz_parse_html(fz_context *ctx, fz_html_font_set *set, fz_archive *zip, const cha { fz_xml *xml; fz_html *html; - unsigned char *data; - size_t len; fz_css_match match; struct genstate g; @@ -2562,9 +2560,7 @@ fz_parse_html(fz_context *ctx, fz_html_font_set *set, fz_archive *zip, const cha g.emit_white = 0; g.last_brk_cls = UCDN_LINEBREAK_CLASS_OP; - fz_terminate_buffer(ctx, buf); - len = fz_buffer_storage(ctx, buf, &data); - xml = fz_parse_xml(ctx, data, len, 1); + xml = fz_parse_xml(ctx, buf, 1); g.css = fz_new_css(ctx); fz_try(ctx) |