From 2597722d7aa1be523058bc8449120d32768f44b3 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 28 Aug 2012 17:34:23 +0200 Subject: Add fz_open_document_with_stream function. Use a "magic" string for filetype detection: filename or mime-type. --- cbz/mucbz.c | 5 ++--- cbz/mucbz.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'cbz') 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. -- cgit v1.2.3