From bbcc85a9f746c161b2e23c6057e69ec7b967252b Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 28 Dec 2016 13:19:47 +0100 Subject: Add fz_terminate_buffer function. Non-destructively zero terminate a fz_buffer for use as a C string. --- source/html/html-layout.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source/html/html-layout.c') diff --git a/source/html/html-layout.c b/source/html/html-layout.c index 91297f10..ff2102d1 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -406,10 +406,7 @@ static fz_image *load_html_image(fz_context *ctx, fz_archive *zip, const char *b buf = fz_read_archive_entry(ctx, zip, path); #if FZ_ENABLE_SVG if (strstr(path, ".svg")) - { - fz_write_buffer_byte(ctx, buf, 0); img = fz_new_image_from_svg(ctx, buf); - } else #endif img = fz_new_image_from_buffer(ctx, buf); @@ -2552,7 +2549,7 @@ 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_buffer_storage(ctx, buf, &data); + size_t len; fz_css_match match; struct genstate g; @@ -2565,6 +2562,8 @@ 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); g.css = fz_new_css(ctx); -- cgit v1.2.3