diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2012-08-28 17:34:23 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2012-08-28 17:34:23 +0200 |
commit | 2597722d7aa1be523058bc8449120d32768f44b3 (patch) | |
tree | 63090b06d0479a237e32d28795d279c511eee25f /cbz | |
parent | 25552e9f2ec3f17a0ce1cbd8d7818170d132959a (diff) | |
download | mupdf-2597722d7aa1be523058bc8449120d32768f44b3.tar.xz |
Add fz_open_document_with_stream function.
Use a "magic" string for filetype detection: filename or mime-type.
Diffstat (limited to 'cbz')
-rw-r--r-- | cbz/mucbz.c | 5 | ||||
-rw-r--r-- | cbz/mucbz.h | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/cbz/mucbz.c b/cbz/mucbz.c index df6be18f..8dc08798 100644 --- a/cbz/mucbz.c +++ b/cbz/mucbz.c @@ -285,9 +285,8 @@ cbz_read_zip_dir(cbz_document *doc) } cbz_document * -cbz_open_document_with_stream(fz_stream *file) +cbz_open_document_with_stream(fz_context *ctx, fz_stream *file) { - fz_context *ctx = file->ctx; cbz_document *doc; doc = fz_malloc_struct(ctx, cbz_document); @@ -323,7 +322,7 @@ cbz_open_document(fz_context *ctx, char *filename) fz_throw(ctx, "cannot open file '%s': %s", filename, strerror(errno)); fz_try(ctx) { - doc = cbz_open_document_with_stream(file); + doc = cbz_open_document_with_stream(ctx, file); } fz_always(ctx) { fz_close(file); } fz_catch(ctx) { diff --git a/cbz/mucbz.h b/cbz/mucbz.h index 080423bf..05288eb3 100644 --- a/cbz/mucbz.h +++ b/cbz/mucbz.h @@ -30,7 +30,7 @@ cbz_document *cbz_open_document(fz_context *ctx, char *filename); fz_open_file_w or fz_open_fd for opening a stream, and fz_close for closing an open stream. */ -cbz_document *cbz_open_document_with_stream(fz_stream *file); +cbz_document *cbz_open_document_with_stream(fz_context *ctx, fz_stream *file); /* cbz_close_document: Closes and frees an opened document. |