From 9172100d6d9f2f5aa4594aaa130fbfaef7162afd Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Fri, 5 Sep 2014 20:26:41 +0100 Subject: 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. --- source/fitz/error.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'source/fitz/error.c') 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); } -- cgit v1.2.3