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/html/epub-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/html/epub-doc.c')
-rw-r--r-- | source/html/epub-doc.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c index 590004f6..cf7f1ecf 100644 --- a/source/html/epub-doc.c +++ b/source/html/epub-doc.c @@ -256,7 +256,6 @@ epub_parse_chapter(fz_context *ctx, epub_document *doc, const char *path) fz_dirname(base_uri, path, sizeof base_uri); buf = fz_read_archive_entry(ctx, zip, path); - fz_write_buffer_byte(ctx, buf, 0); ch = fz_malloc_struct(ctx, epub_chapter); ch->path = fz_strdup(ctx, path); @@ -316,7 +315,7 @@ epub_parse_ncx(fz_context *ctx, epub_document *doc, const char *path) fz_dirname(base_uri, path, sizeof base_uri); buf = fz_read_archive_entry(ctx, zip, path); - fz_write_buffer_byte(ctx, buf, 0); + fz_terminate_buffer(ctx, buf); len = fz_buffer_storage(ctx, buf, &data); ncx = fz_parse_xml(ctx, data, len, 0); fz_drop_buffer(ctx, buf); @@ -359,7 +358,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_write_buffer_byte(ctx, buf, 0); + fz_terminate_buffer(ctx, buf); len = fz_buffer_storage(ctx, buf, &data); container_xml = fz_parse_xml(ctx, data, len, 0); fz_drop_buffer(ctx, buf); @@ -376,7 +375,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_write_buffer_byte(ctx, buf, 0); + fz_terminate_buffer(ctx, buf); len = fz_buffer_storage(ctx, buf, &data); content_opf = fz_parse_xml(ctx, data, len, 0); fz_drop_buffer(ctx, buf); |