[gs-commits] mupdf 1.16.1.100 Drop references to accelerator upon exce
[email protected] (Tor Andersson) Tue, 22 Oct 2019 11:29:11 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit eda14b468d5b9d5d53eb14dfead58d3c8b49f084 Author: Sebastian Rasmussen <[email protected]> Date: Wed Oct 16 20:11:37 2019 +0200 Drop references to accelerator upon exception opening epub. diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c index 2135aca..b1aae2b 100644 --- a/source/html/epub-doc.c +++ b/source/html/epub-doc.c @@ -818,7 +818,6 @@ epub_init(fz_context *ctx, fz_archive *zip, fz_stream *accel) doc = fz_new_derived_document(ctx, epub_document); doc->zip = zip; - doc->set = fz_new_html_font_set(ctx); doc->super.drop_document = epub_drop_document; doc->super.layout = epub_layout; @@ -833,15 +832,13 @@ epub_init(fz_context *ctx, fz_archive *zip, fz_stream *accel) doc->super.output_accelerator = epub_output_accelerator; doc->super.is_reflowable = 1; - doc->css_sum = user_css_sum(ctx); - fz_try(ctx) { + doc->set = fz_new_html_font_set(ctx); + doc->css_sum = user_css_sum(ctx); epub_load_accelerator(ctx, doc, accel); epub_parse_header(ctx, doc); } - fz_always(ctx) - fz_drop_stream(ctx, accel); fz_catch(ctx) { fz_drop_document(ctx, &doc->super); @@ -861,21 +858,32 @@ static fz_document * epub_open_document(fz_context *ctx, const char *filename, const char *accel) { fz_stream *afile = NULL; + fz_document *doc; if (accel) afile = fz_open_file(ctx, accel); - if (strstr(filename, "META-INF/container.xml") || strstr(filename, "META-INF\\container.xml")) + + fz_try(ctx) { - char dirname[2048], *p; - fz_strlcpy(dirname, filename, sizeof dirname); - p = strstr(dirname, "META-INF"); - *p = 0; - if (!dirname[0]) - fz_strlcpy(dirname, ".", sizeof dirname); - return epub_init(ctx, fz_open_directory(ctx, dirname), afile); + if (strstr(filename, "META-INF/container.xml") || strstr(filename, "META-INF\\container.xml")) + { + char dirname[2048], *p; + fz_strlcpy(dirname, filename, sizeof dirname); + p = strstr(dirname, "META-INF"); + *p = 0; + if (!dirname[0]) + fz_strlcpy(dirname, ".", sizeof dirname); + doc = epub_init(ctx, fz_open_directory(ctx, dirname), afile); + } + else + doc = epub_init(ctx, fz_open_zip_archive(ctx, filename), afile); } + fz_always(ctx) + fz_drop_stream(ctx, afile); + fz_catch(ctx) + fz_rethrow(ctx); - return epub_init(ctx, fz_open_zip_archive(ctx, filename), afile); + return doc; } static int http://git.ghostscript.com/?p=mupdf.git;a=commit;h=eda14b468d5b9d5d53eb14dfead58d3c8b49f084 -- MuPDF library Artifex Software, Inc.