diff --git a/include/mupdf/fitz/document.h b/include/mupdf/fitz/document.h index 315831bf5a..3c7c98eb80 100644 --- a/include/mupdf/fitz/document.h +++ b/include/mupdf/fitz/document.h @@ -323,12 +323,13 @@ typedef void (fz_page_delete_link_fn)(fz_context *ctx, fz_page *page, fz_link *l accel: fz_stream to read accelerator data from. May be NULL. May be ignored. - zip: Archive to read associated content from (like images for - an html stream). Maybe NULL. May be ignored. + dir: 'Directory context' in which the document is loaded; + associated content from (like images for an html stream + will be loaded from this). Maybe NULL. May be ignored. Pointer to opened document. Throws exception in case of error. */ -typedef fz_document *(fz_document_open_fn)(fz_context *ctx, fz_stream *stream, fz_stream *accel, fz_archive *zip); +typedef fz_document *(fz_document_open_fn)(fz_context *ctx, fz_stream *stream, fz_stream *accel, fz_archive *dir); /** Recognize a document type from @@ -349,7 +350,7 @@ typedef int (fz_document_recognize_fn)(fz_context *ctx, const char *magic); stream: stream contents to recognise (may be NULL if document is a directory). - dir: directory from which stream is loaded. + dir: directory context from which stream is loaded. Returns a number between 0 (not recognized) and 100 (fully recognized) based on how certain the recognizer diff --git a/include/mupdf/fitz/story-writer.h b/include/mupdf/fitz/story-writer.h index 6ecc1320da..70cbcd5201 100644 --- a/include/mupdf/fitz/story-writer.h +++ b/include/mupdf/fitz/story-writer.h @@ -189,8 +189,8 @@ void fz_write_story( * story content has been written to the device). * pagefn_ref: * Passed to pagefn(). - * archive: - * NULL, or an archive to load images etc from. + * dir: + * NULL, or a directory context to load images etc from. */ void fz_write_stabilized_story( fz_context *ctx, @@ -203,7 +203,7 @@ void fz_write_stabilized_story( void *rectfn_ref, fz_write_story_pagefn pagefn, void *pagefn_ref, - fz_archive *archive + fz_archive *dir ); #endif diff --git a/include/mupdf/fitz/story.h b/include/mupdf/fitz/story.h index 5a31c566e0..ab4715130d 100644 --- a/include/mupdf/fitz/story.h +++ b/include/mupdf/fitz/story.h @@ -56,11 +56,11 @@ typedef struct fz_story fz_story; Passing a NULL buffer will be treated as an empty document. Passing a NULL user_css will be treated as an empty CSS string. - A non-NULL archive will allow images etc to be loaded. The + A non-NULL dir will allow images etc to be loaded. The story keeps its own reference, so the caller can drop its reference after this call. */ -fz_story *fz_new_story(fz_context *ctx, fz_buffer *buf, const char *user_css, float em, fz_archive *archive); +fz_story *fz_new_story(fz_context *ctx, fz_buffer *buf, const char *user_css, float em, fz_archive *dir); /* Retrieve the warnings given from parsing this story. diff --git a/include/mupdf/fitz/util.h b/include/mupdf/fitz/util.h index d8a3504a00..00485082b1 100644 --- a/include/mupdf/fitz/util.h +++ b/include/mupdf/fitz/util.h @@ -108,22 +108,22 @@ int fz_search_display_list(fz_context *ctx, fz_display_list *list, const char *n /** Parse an SVG document into a display-list. */ -fz_display_list *fz_new_display_list_from_svg(fz_context *ctx, fz_buffer *buf, const char *base_uri, fz_archive *zip, float *w, float *h); +fz_display_list *fz_new_display_list_from_svg(fz_context *ctx, fz_buffer *buf, const char *base_uri, fz_archive *dir, float *w, float *h); /** Create a scalable image from an SVG document. */ -fz_image *fz_new_image_from_svg(fz_context *ctx, fz_buffer *buf, const char *base_uri, fz_archive *zip); +fz_image *fz_new_image_from_svg(fz_context *ctx, fz_buffer *buf, const char *base_uri, fz_archive *dir); /** Parse an SVG document into a display-list. */ -fz_display_list *fz_new_display_list_from_svg_xml(fz_context *ctx, fz_xml_doc *xmldoc, fz_xml *xml, const char *base_uri, fz_archive *zip, float *w, float *h); +fz_display_list *fz_new_display_list_from_svg_xml(fz_context *ctx, fz_xml_doc *xmldoc, fz_xml *xml, const char *base_uri, fz_archive *dir, float *w, float *h); /** Create a scalable image from an SVG document. */ -fz_image *fz_new_image_from_svg_xml(fz_context *ctx, fz_xml_doc *xmldoc, fz_xml *xml, const char *base_uri, fz_archive *zip); +fz_image *fz_new_image_from_svg_xml(fz_context *ctx, fz_xml_doc *xmldoc, fz_xml *xml, const char *base_uri, fz_archive *dir); /** Write image as a data URI (for HTML and SVG output). diff --git a/include/mupdf/fitz/xml.h b/include/mupdf/fitz/xml.h index bf19b1578b..7792f4a731 100644 --- a/include/mupdf/fitz/xml.h +++ b/include/mupdf/fitz/xml.h @@ -57,7 +57,7 @@ fz_xml *fz_parse_xml_stream(fz_context *ctx, fz_stream *stream, int preserve_whi preserve_white: whether to keep or delete all-whitespace nodes. */ -fz_xml *fz_parse_xml_archive_entry(fz_context *ctx, fz_archive *arch, const char *filename, int preserve_white); +fz_xml *fz_parse_xml_archive_entry(fz_context *ctx, fz_archive *dir, const char *filename, int preserve_white); /** Try and parse the contents of an archive entry into a tree of xml nodes. @@ -67,7 +67,7 @@ fz_xml *fz_parse_xml_archive_entry(fz_context *ctx, fz_archive *arch, const char Will return NULL if the archive entry can't be found. Otherwise behaves the same as fz_parse_xml_archive_entry. May throw exceptions. */ -fz_xml *fz_try_parse_xml_archive_entry(fz_context *ctx, fz_archive *arch, const char *filename, int preserve_white); +fz_xml *fz_try_parse_xml_archive_entry(fz_context *ctx, fz_archive *dir, const char *filename, int preserve_white); /** Parse the contents of a buffer into a tree of XML nodes, diff --git a/include/mupdf/html.h b/include/mupdf/html.h index a037dc7f8a..ce439b31b7 100644 --- a/include/mupdf/html.h +++ b/include/mupdf/html.h @@ -44,9 +44,9 @@ typedef struct int patch_mobi; } fz_htdoc_format_t; -fz_document *fz_htdoc_open_document_with_buffer(fz_context *ctx, fz_archive *zip, fz_buffer *buf, const fz_htdoc_format_t *format); +fz_document *fz_htdoc_open_document_with_buffer(fz_context *ctx, fz_archive *dir, fz_buffer *buf, const fz_htdoc_format_t *format); -fz_document *fz_htdoc_open_document_with_stream_and_dir(fz_context *ctx, fz_stream *stm, fz_archive *zip, const fz_htdoc_format_t *format); +fz_document *fz_htdoc_open_document_with_stream_and_dir(fz_context *ctx, fz_stream *stm, fz_archive *dir, const fz_htdoc_format_t *format); diff --git a/source/cbz/mucbz.c b/source/cbz/mucbz.c index b8c8f3a839..078f447367 100644 --- a/source/cbz/mucbz.c +++ b/source/cbz/mucbz.c @@ -258,7 +258,7 @@ cbz_lookup_metadata(fz_context *ctx, fz_document *doc_, const char *key, char *b } static fz_document * -cbz_open_document(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *zip) +cbz_open_document(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *dir) { cbz_document *doc = fz_new_derived_document(ctx, cbz_document); @@ -269,7 +269,10 @@ cbz_open_document(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive fz_try(ctx) { - doc->arch = fz_open_archive_with_stream(ctx, file); + if (file) + doc->arch = fz_open_archive_with_stream(ctx, file); + else + doc->arch = fz_keep_archive(ctx, dir); cbz_create_page_list(ctx, doc); } fz_catch(ctx) @@ -318,18 +321,16 @@ cbz_recognize_doc_content(fz_context *ctx, fz_stream *stream, fz_archive *dir) fz_var(arch); fz_var(ret); - /* FIXME: Maybe consider: if stream == NULL then use dir as archive. - * This would enable us to open directories of unpacked cbz's. Is - * this a good thing, or is it too permissive? */ - - if (stream == NULL) - return 0; - fz_try(ctx) { - arch = fz_try_open_archive_with_stream(ctx, stream); - if (arch == NULL) - break; + if (stream == NULL) + arch = fz_keep_archive(ctx, dir); + else + { + arch = fz_try_open_archive_with_stream(ctx, stream); + if (arch == NULL) + break; + } /* If it's an archive, and we can find at least one plausible page * then we can open it as a cbz. */ @@ -337,7 +338,10 @@ cbz_recognize_doc_content(fz_context *ctx, fz_stream *stream, fz_archive *dir) for (i = 0; i < count && ret == 0; i++) { const char *name = fz_list_archive_entry(ctx, arch, i); - const char *ext = name ? strrchr(name, '.') : NULL; + const char *ext; + if (name == NULL) + continue; + ext = strrchr(name, '.'); if (ext) { for (k = 0; cbz_ext_list[k]; k++) diff --git a/source/cbz/muimg.c b/source/cbz/muimg.c index 7e1f8cec2a..2c7fbfd7ea 100644 --- a/source/cbz/muimg.c +++ b/source/cbz/muimg.c @@ -172,7 +172,7 @@ img_lookup_metadata(fz_context *ctx, fz_document *doc_, const char *key, char *b } static fz_document * -img_open_document(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *zip) +img_open_document(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *dir) { img_document *doc = fz_new_derived_document(ctx, img_document); diff --git a/source/fitz/directory.c b/source/fitz/directory.c index 8400f80db3..35146ac0cb 100644 --- a/source/fitz/directory.c +++ b/source/fitz/directory.c @@ -27,7 +27,10 @@ #include #ifdef _MSC_VER +#include #define stat _stat +#else +#include #endif typedef struct @@ -35,13 +38,21 @@ typedef struct fz_archive super; char *path; + + int max_entries; + int num_entries; + char **entries; } fz_directory; static void drop_directory(fz_context *ctx, fz_archive *arch) { fz_directory *dir = (fz_directory *) arch; + int i; fz_free(ctx, dir->path); + for (i = 0; i < dir->num_entries; i++) + fz_free(ctx, dir->entries[i]); + fz_free(ctx, dir->entries); } static fz_stream *open_dir_entry(fz_context *ctx, fz_archive *arch, const char *name) @@ -85,16 +96,51 @@ fz_is_directory(fz_context *ctx, const char *path) return S_ISDIR(info.st_mode); } +static int +count_dir_entries(fz_context *ctx, fz_archive *arch) +{ + fz_directory *dir = (fz_directory *) arch; + + return dir->num_entries; +} + +const char * +list_dir_entry(fz_context *ctx, fz_archive *arch, int n) +{ + fz_directory *dir = (fz_directory *) arch; + + if (n < 0 || n >= dir->num_entries) + return NULL; + + return dir->entries[n]; +} + fz_archive * fz_open_directory(fz_context *ctx, const char *path) { fz_directory *dir; +#ifdef _MSC_VER + WCHAR *wpath = NULL; + size_t z = 3; + HANDLE h = NULL; + WIN32_FIND_DATAW dw; + + fz_var(wpath); + fz_var(h); +#else + DIR *dp; + struct dirent *ep; + + fz_var(dp); +#endif if (!fz_is_directory(ctx, path)) fz_throw(ctx, FZ_ERROR_FORMAT, "'%s' is not a directory", path); dir = fz_new_derived_archive(ctx, NULL, fz_directory); dir->super.format = "dir"; + dir->super.count_entries = count_dir_entries; + dir->super.list_entry = list_dir_entry; dir->super.has_entry = has_dir_entry; dir->super.read_entry = read_dir_entry; dir->super.open_entry = open_dir_entry; @@ -102,8 +148,98 @@ fz_open_directory(fz_context *ctx, const char *path) fz_try(ctx) { +#ifdef _MSC_VER + char const *p = path; + WCHAR *w; + while (*p) + { + int rune; + p += fz_chartorune(&rune, p); + if (rune >= 0x10000 || rune < 0) + fz_throw(ctx, FZ_ERROR_GENERIC, "Unrepresentable UTF-8 char in directory name"); + z++; + } + w = wpath = fz_malloc(ctx, z * sizeof(WCHAR)); + p = path; + while (*p) + { + int rune; + p += fz_chartorune(&rune, p); + *w++ = rune; + } + w[0] = '\\'; + w[1] = '*'; + w[2] = 0; + + /* Now enumerate the paths. */ + h = FindFirstFileW(wpath, &dw); + if (h == INVALID_HANDLE_VALUE) + break; + + do + { + char *u; + + if (dir->max_entries == dir->num_entries) + { + int newmax = dir->max_entries * 2; + if (newmax == 0) + newmax = 32; + + dir->entries = fz_realloc(ctx, dir->entries, sizeof(*dir->entries) * newmax); + dir->max_entries = newmax; + } + + /* Count the len as utf-8. */ + w = dw.cFileName; + z = 1; + while (*w) + z += fz_runelen(*w++); + + u = dir->entries[dir->num_entries] = fz_malloc(ctx, z); + dir->num_entries++; + + /* Copy the name across. */ + w = dw.cFileName; + while (*w) + u += fz_runetochar(u, *w++); + *u = 0; + } + while (FindNextFileW(h, &dw)); +#else + dp = opendir(path); + if (dp == NULL) + break; + + while ((ep = readdir(dp)) != NULL) + { + if (dir->max_entries == dir->num_entries) + { + int newmax = dir->max_entries * 2; + if (newmax == 0) + newmax = 32; + + dir->entries = fz_realloc(ctx, dir->entries, sizeof(*dir->entries) * newmax); + dir->max_entries = newmax; + } + + dir->entries[dir->num_entries] = fz_strdup(ctx, ep->d_name); + dir->num_entries++; + } +#endif dir->path = fz_strdup(ctx, path); } + fz_always(ctx) + { +#ifdef _MSC_VER + fz_free(ctx, wpath); + if (h) + (void)FindClose(h); +#else + if (dp) + (void)closedir(dp); +#endif + } fz_catch(ctx) { fz_drop_archive(ctx, &dir->super); diff --git a/source/fitz/document.c b/source/fitz/document.c index afba13f603..16412cae55 100644 --- a/source/fitz/document.c +++ b/source/fitz/document.c @@ -249,9 +249,9 @@ fz_open_document_with_stream(fz_context *ctx, const char *magic, fz_stream *stre } fz_document * -fz_open_document_with_stream_and_dir(fz_context *ctx, const char *magic, fz_stream *stream, fz_archive *zip) +fz_open_document_with_stream_and_dir(fz_context *ctx, const char *magic, fz_stream *stream, fz_archive *dir) { - return fz_open_accelerated_document_with_stream_and_dir(ctx, magic, stream, NULL, zip); + return fz_open_accelerated_document_with_stream_and_dir(ctx, magic, stream, NULL, dir); } fz_document * @@ -288,12 +288,12 @@ fz_open_accelerated_document(fz_context *ctx, const char *filename, const char * if (fz_is_directory(ctx, filename)) { /* Cannot accelerate directories, currently. */ - fz_archive *zip = fz_open_directory(ctx, filename); + fz_archive *dir = fz_open_directory(ctx, filename); fz_try(ctx) - doc = fz_open_accelerated_document_with_stream_and_dir(ctx, filename, NULL, NULL, zip); + doc = fz_open_accelerated_document_with_stream_and_dir(ctx, filename, NULL, NULL, dir); fz_always(ctx) - fz_drop_archive(ctx, zip); + fz_drop_archive(ctx, dir); fz_catch(ctx) fz_rethrow(ctx); diff --git a/source/fitz/gz-doc.c b/source/fitz/gz-doc.c index 7b430cc100..148125fa2c 100644 --- a/source/fitz/gz-doc.c +++ b/source/fitz/gz-doc.c @@ -27,7 +27,7 @@ #endif static fz_document * -gz_open_document(fz_context *ctx, fz_stream *ostm, fz_stream *accel, fz_archive *zip) +gz_open_document(fz_context *ctx, fz_stream *ostm, fz_stream *accel, fz_archive *dir) { fz_stream *stm = fz_open_flated(ctx, ostm, 16 + MAX_WBITS); fz_buffer *buf = NULL; diff --git a/source/html/html-doc.c b/source/html/html-doc.c index 2a28f76f25..650511166e 100644 --- a/source/html/html-doc.c +++ b/source/html/html-doc.c @@ -213,12 +213,12 @@ generic_parse(fz_context *ctx, fz_html_font_set *set, fz_archive *zip, const cha } fz_document * -fz_htdoc_open_document_with_buffer(fz_context *ctx, fz_archive *zip, fz_buffer *buf, const fz_htdoc_format_t *format) +fz_htdoc_open_document_with_buffer(fz_context *ctx, fz_archive *dir, fz_buffer *buf, const fz_htdoc_format_t *format) { html_document *doc = NULL; fz_var(doc); - fz_var(zip); + fz_var(dir); fz_try(ctx) { @@ -234,7 +234,7 @@ fz_htdoc_open_document_with_buffer(fz_context *ctx, fz_archive *zip, fz_buffer * doc->super.lookup_metadata = htdoc_lookup_metadata; doc->super.is_reflowable = 1; - doc->zip = fz_keep_archive(ctx, zip); + doc->zip = fz_keep_archive(ctx, dir); doc->format = format; doc->set = fz_new_html_font_set(ctx); doc->html = generic_parse(ctx, doc->set, doc->zip, ".", buf, fz_user_css(ctx), format); @@ -252,14 +252,14 @@ fz_htdoc_open_document_with_buffer(fz_context *ctx, fz_archive *zip, fz_buffer * } fz_document * -fz_htdoc_open_document_with_stream_and_dir(fz_context *ctx, fz_stream *stm, fz_archive *zip, const fz_htdoc_format_t *format) +fz_htdoc_open_document_with_stream_and_dir(fz_context *ctx, fz_stream *stm, fz_archive *dir, const fz_htdoc_format_t *format) { fz_buffer *buf = NULL; if (stm) buf = fz_read_all(ctx, stm, 0); - return fz_htdoc_open_document_with_buffer(ctx, zip, buf, format); + return fz_htdoc_open_document_with_buffer(ctx, dir, buf, format); } /* Variant specific functions */ @@ -274,9 +274,9 @@ static const fz_htdoc_format_t fz_htdoc_html5 = }; static fz_document * -htdoc_open_document(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *zip) +htdoc_open_document(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *dir) { - return fz_htdoc_open_document_with_stream_and_dir(ctx, file, zip, &fz_htdoc_html5); + return fz_htdoc_open_document_with_stream_and_dir(ctx, file, dir, &fz_htdoc_html5); } static const char *htdoc_extensions[] = @@ -310,9 +310,9 @@ static const fz_htdoc_format_t fz_htdoc_xhtml = }; static fz_document * -xhtdoc_open_document(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *zip) +xhtdoc_open_document(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *dir) { - return fz_htdoc_open_document_with_stream_and_dir(ctx, file, zip, &fz_htdoc_xhtml); + return fz_htdoc_open_document_with_stream_and_dir(ctx, file, dir, &fz_htdoc_xhtml); } static const char *xhtdoc_extensions[] = @@ -345,9 +345,9 @@ static const fz_htdoc_format_t fz_htdoc_fb2 = }; static fz_document * -fb2doc_open_document(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *zip) +fb2doc_open_document(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *dir) { - return fz_htdoc_open_document_with_stream_and_dir(ctx, file, zip, &fz_htdoc_fb2); + return fz_htdoc_open_document_with_stream_and_dir(ctx, file, dir, &fz_htdoc_fb2); } static const char *fb2doc_extensions[] = @@ -385,13 +385,13 @@ static const fz_htdoc_format_t fz_htdoc_mobi = static fz_document * mobi_open_document_with_buffer(fz_context *ctx, fz_buffer *mobi) { - fz_archive *zip = NULL; + fz_archive *dir = NULL; fz_buffer *html; - fz_var(zip); + fz_var(dir); fz_try(ctx) { - zip = fz_extract_html_from_mobi(ctx, mobi); - html = fz_read_archive_entry(ctx, zip, "index.html"); + dir = fz_extract_html_from_mobi(ctx, mobi); + html = fz_read_archive_entry(ctx, dir, "index.html"); } fz_always(ctx) { @@ -399,14 +399,14 @@ mobi_open_document_with_buffer(fz_context *ctx, fz_buffer *mobi) } fz_catch(ctx) { - fz_drop_archive(ctx, zip); + fz_drop_archive(ctx, dir); fz_rethrow(ctx); } - return fz_htdoc_open_document_with_buffer(ctx, zip, html, &fz_htdoc_mobi); + return fz_htdoc_open_document_with_buffer(ctx, dir, html, &fz_htdoc_mobi); } static fz_document * -mobi_open_document(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *zip) +mobi_open_document(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *dir) { return mobi_open_document_with_buffer(ctx, fz_read_all(ctx, file, 0)); } diff --git a/source/html/html-imp.h b/source/html/html-imp.h index 144d756c76..cfe2903c66 100644 --- a/source/html/html-imp.h +++ b/source/html/html-imp.h @@ -524,7 +524,7 @@ void fz_add_html_font_face(fz_context *ctx, fz_html_font_set *set, fz_font *fz_load_html_font(fz_context *ctx, fz_html_font_set *set, const char *family, int is_bold, int is_italic, int is_small_caps); void fz_drop_html_font_set(fz_context *ctx, fz_html_font_set *htx); -void fz_add_css_font_faces(fz_context *ctx, fz_html_font_set *set, fz_archive *zip, const char *base_uri, fz_css *css); +void fz_add_css_font_faces(fz_context *ctx, fz_html_font_set *set, fz_archive *dir, const char *base_uri, fz_css *css); void fz_layout_html(fz_context *ctx, fz_html *html, float w, float h, float em); void fz_draw_html(fz_context *ctx, fz_device *dev, fz_matrix ctm, fz_html *html, int page); @@ -551,7 +551,7 @@ fz_archive *fz_extract_html_from_mobi(fz_context *ctx, fz_buffer *mobi); fz_structure fz_html_tag_to_structure(const char *tag); fz_html *fz_parse_html(fz_context *ctx, - fz_html_font_set *set, fz_archive *zip, const char *base_uri, fz_buffer *buf, const char *user_css, + fz_html_font_set *set, fz_archive *dir, const char *base_uri, fz_buffer *buf, const char *user_css, int try_xml, int try_html5, int patch_mobi); fz_buffer *fz_txt_buffer_to_html(fz_context *ctx, fz_buffer *in); diff --git a/source/html/office.c b/source/html/office.c index c951528516..1d631bfaf0 100644 --- a/source/html/office.c +++ b/source/html/office.c @@ -1091,7 +1091,7 @@ process_office_document_properties(fz_context *ctx, fz_archive *arch, const char } static fz_buffer * -fz_office_to_html(fz_context *ctx, fz_html_font_set *set, fz_buffer *buffer_in, fz_archive *zip, const char *user_css, fz_office_to_html_opts *opts) +fz_office_to_html(fz_context *ctx, fz_html_font_set *set, fz_buffer *buffer_in, fz_archive *dir, const char *user_css, fz_office_to_html_opts *opts) { fz_stream *stream = NULL; fz_archive *archive = NULL; @@ -1120,7 +1120,7 @@ fz_office_to_html(fz_context *ctx, fz_html_font_set *set, fz_buffer *buffer_in, archive = fz_open_archive_with_stream(ctx, stream); } else - archive = fz_keep_archive(ctx, zip); + archive = fz_keep_archive(ctx, dir); buffer_out = fz_new_buffer(ctx, 1024); info.out = fz_new_output_with_buffer(ctx, buffer_out); diff --git a/source/xps/xps-doc.c b/source/xps/xps-doc.c index 494afa0c83..40defeccbf 100644 --- a/source/xps/xps-doc.c +++ b/source/xps/xps-doc.c @@ -567,12 +567,12 @@ xps_recognize_doc_content(fz_context *ctx, fz_stream *stream, fz_archive *dir) } static fz_document * -xps_open(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *zip) +xps_open(fz_context *ctx, fz_stream *file, fz_stream *accel, fz_archive *dir) { if (file) return xps_open_document_with_stream(ctx, file); else - return xps_open_document_with_directory(ctx, zip); + return xps_open_document_with_directory(ctx, dir); } fz_document_handler xps_document_handler =