diff options
author | Robin Watts <robin.watts@artifex.com> | 2014-09-05 20:26:41 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2014-09-09 15:53:52 +0100 |
commit | 9172100d6d9f2f5aa4594aaa130fbfaef7162afd (patch) | |
tree | 607402c0f0e9a1f7a5e15518515c41e44e3290c1 /source/fitz/error.c | |
parent | a55648c9d009cdd94977fc5b7152932e59c975ad (diff) | |
download | mupdf-9172100d6d9f2f5aa4594aaa130fbfaef7162afd.tar.xz |
test-device: Abort interpretation when color found.
Add a new class of errors and use them to abort interpretation when
the test device detects a color page.
Diffstat (limited to 'source/fitz/error.c')
-rw-r--r-- | source/fitz/error.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/source/fitz/error.c b/source/fitz/error.c index e8225ee3..414b993f 100644 --- a/source/fitz/error.c +++ b/source/fitz/error.c @@ -140,14 +140,17 @@ void fz_throw(fz_context *ctx, int code, const char *fmt, ...) vsnprintf(ctx->error->message, sizeof ctx->error->message, fmt, args); va_end(args); - fz_flush_warnings(ctx); - fprintf(stderr, "error: %s\n", ctx->error->message); - LOGE("error: %s\n", ctx->error->message); + if (code != FZ_ERROR_ABORT) + { + fz_flush_warnings(ctx); + fprintf(stderr, "error: %s\n", ctx->error->message); + LOGE("error: %s\n", ctx->error->message); #ifdef USE_OUTPUT_DEBUG_STRING - OutputDebugStringA("error: "); - OutputDebugStringA(ctx->error->message); - OutputDebugStringA("\n"); + OutputDebugStringA("error: "); + OutputDebugStringA(ctx->error->message); + OutputDebugStringA("\n"); #endif + } throw(ctx->error); } @@ -168,14 +171,17 @@ void fz_rethrow_message(fz_context *ctx, const char *fmt, ...) vsnprintf(ctx->error->message, sizeof ctx->error->message, fmt, args); va_end(args); - fz_flush_warnings(ctx); - fprintf(stderr, "error: %s\n", ctx->error->message); - LOGE("error: %s\n", ctx->error->message); + if (ctx->error->errcode != FZ_ERROR_ABORT) + { + fz_flush_warnings(ctx); + fprintf(stderr, "error: %s\n", ctx->error->message); + LOGE("error: %s\n", ctx->error->message); #ifdef USE_OUTPUT_DEBUG_STRING - OutputDebugStringA("error: "); - OutputDebugStringA(ctx->error->message); - OutputDebugStringA("\n"); + OutputDebugStringA("error: "); + OutputDebugStringA(ctx->error->message); + OutputDebugStringA("\n"); #endif + } throw(ctx->error); } |