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/svg/svg-doc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'source/svg/svg-doc.c') diff --git a/source/svg/svg-doc.c b/source/svg/svg-doc.c index d0ff1e4a..06de56f5 100644 --- a/source/svg/svg-doc.c +++ b/source/svg/svg-doc.c @@ -91,6 +91,7 @@ svg_open_document_with_buffer(fz_context *ctx, fz_buffer *buf) size_t len; unsigned char *data; + fz_terminate_buffer(ctx, buf); len = fz_buffer_storage(ctx, buf, &data); root = fz_parse_xml(ctx, data, len, 0); @@ -115,10 +116,7 @@ svg_open_document_with_stream(fz_context *ctx, fz_stream *file) buf = fz_read_all(ctx, file, 0); fz_try(ctx) - { - fz_write_buffer_byte(ctx, buf, 0); doc = svg_open_document_with_buffer(ctx, buf); - } fz_always(ctx) fz_drop_buffer(ctx, buf); fz_catch(ctx) -- cgit v1.2.3