From 1ef1a581229dfc0b0466600bb8bc01b3109be02f Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Fri, 6 Jan 2012 18:55:50 +0000 Subject: Android tweaks. Include android headers in fitz.h so we can debug. Arrange for error throwing to output to android error stream as well as stderr. Change jpeg library to not use backing store. Solves bug 692473. --- fitz/base_error.c | 6 ++++++ fitz/fitz.h | 10 ++++++++++ 2 files changed, 16 insertions(+) (limited to 'fitz') diff --git a/fitz/base_error.c b/fitz/base_error.c index 1184981c..94876d96 100644 --- a/fitz/base_error.c +++ b/fitz/base_error.c @@ -10,7 +10,10 @@ void fz_var_imp(void *var) void fz_flush_warnings(fz_context *ctx) { if (ctx->warn->count > 1) + { fprintf(stderr, "warning: ... repeated %d times ...\n", ctx->warn->count); + LOGE("warning: %s\n", ctx->warn->count); + } ctx->warn->message[0] = 0; ctx->warn->count = 0; } @@ -32,6 +35,7 @@ void fz_warn(fz_context *ctx, char *fmt, ...) { fz_flush_warnings(ctx); fprintf(stderr, "warning: %s\n", buf); + LOGE("warning: %s\n", buf); fz_strlcpy(ctx->warn->message, buf, sizeof ctx->warn->message); ctx->warn->count = 1; } @@ -45,6 +49,7 @@ static void throw(fz_error_context *ex) longjmp(ex->stack[ex->top--].buffer, 1); } else { fprintf(stderr, "uncaught exception: %s\n", ex->message); + LOGE("uncaught exception: %s\n", ex->message); exit(EXIT_FAILURE); } } @@ -75,6 +80,7 @@ void fz_throw(fz_context *ctx, char *fmt, ...) va_end(args); fprintf(stderr, "error: %s\n", ctx->error->message); + LOGE("error: %s\n", ctx->error->message); throw(ctx->error); } diff --git a/fitz/fitz.h b/fitz/fitz.h index fe0e4d6b..a5695d56 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -22,6 +22,16 @@ #include "memento.h" +#ifdef __ANDROID__ +#include +#define LOG_TAG "libmupdf" +#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) +#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) +#else +#define LOGI(...) do {} while(0) +#define LOGE(...) do {} while(0) +#endif + #define nelem(x) (sizeof(x)/sizeof((x)[0])) #define ABS(x) ( (x) < 0 ? -(x) : (x) ) -- cgit v1.2.3