diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-05-30 14:29:08 +0200 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-05-30 17:49:19 +0100 |
commit | e74df981077189c6408be4cdfb1f9dc4738e4ed0 (patch) | |
tree | a868de66b31c973876e7036d7fe0bb7a013a035a /source/fitz | |
parent | 0b73a8ddf620894112cd212b43f5d4cccec9d90e (diff) | |
download | mupdf-e74df981077189c6408be4cdfb1f9dc4738e4ed0.tar.xz |
Respect FZ_ENABLE_PDF=0 to allow dropping all PDF specific code in tools.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/document.c | 12 | ||||
-rw-r--r-- | source/fitz/writer.c | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/source/fitz/document.c b/source/fitz/document.c index 227c93e1..5c913012 100644 --- a/source/fitz/document.c +++ b/source/fitz/document.c @@ -70,8 +70,10 @@ fz_open_document_with_stream(fz_context *ctx, const char *magic, fz_stream *stre int best_i, best_score; fz_document_handler_context *dc; - if (ctx == NULL || magic == NULL || stream == NULL) + if (ctx == NULL) return NULL; + if (magic == NULL || stream == NULL) + fz_throw(ctx, FZ_ERROR_GENERIC, "no document to open"); dc = ctx->handler; if (dc->count == 0) @@ -92,7 +94,7 @@ fz_open_document_with_stream(fz_context *ctx, const char *magic, fz_stream *stre if (best_i >= 0) return dc->handler[best_i]->open_with_stream(ctx, stream); - return NULL; + fz_throw(ctx, FZ_ERROR_GENERIC, "cannot find document handler for file type: %s", magic); } fz_document * @@ -102,8 +104,10 @@ fz_open_document(fz_context *ctx, const char *filename) int best_i, best_score; fz_document_handler_context *dc; - if (ctx == NULL || filename == NULL) + if (ctx == NULL) return NULL; + if (filename == NULL) + fz_throw(ctx, FZ_ERROR_GENERIC, "no document to open"); dc = ctx->handler; if (dc->count == 0) @@ -124,7 +128,7 @@ fz_open_document(fz_context *ctx, const char *filename) if (best_i >= 0) return dc->handler[best_i]->open(ctx, filename); - return NULL; + fz_throw(ctx, FZ_ERROR_GENERIC, "cannot find document handler for file: '%s'", filename); } void * diff --git a/source/fitz/writer.c b/source/fitz/writer.c index 94f601b5..2a344e52 100644 --- a/source/fitz/writer.c +++ b/source/fitz/writer.c @@ -54,8 +54,10 @@ fz_new_document_writer(fz_context *ctx, const char *path, const char *format, co if (!fz_strcasecmp(format, "cbz")) return fz_new_cbz_writer(ctx, path, options); +#if FZ_ENABLE_PDF if (!fz_strcasecmp(format, "pdf")) return fz_new_pdf_writer(ctx, path, options); +#endif fz_throw(ctx, FZ_ERROR_GENERIC, "unknown document format: %s", format); } |