diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-12-28 13:19:47 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-01-09 13:21:40 +0100 |
commit | bbcc85a9f746c161b2e23c6057e69ec7b967252b (patch) | |
tree | 8ead60bd762cc0cbf945c002c769e74699594c0b /source/svg/svg-doc.c | |
parent | e9667e7f8ab7c154d8932916a22c33cf2bad0445 (diff) | |
download | mupdf-bbcc85a9f746c161b2e23c6057e69ec7b967252b.tar.xz |
Add fz_terminate_buffer function.
Non-destructively zero terminate a fz_buffer for use as a C string.
Diffstat (limited to 'source/svg/svg-doc.c')
-rw-r--r-- | source/svg/svg-doc.c | 4 |
1 files changed, 1 insertions, 3 deletions
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) |