diff options
-rw-r--r-- | fitz/base_error.c | 2 | ||||
-rw-r--r-- | fitz/fitz.h | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/fitz/base_error.c b/fitz/base_error.c index 6b54fb69..f3ca4efa 100644 --- a/fitz/base_error.c +++ b/fitz/base_error.c @@ -46,7 +46,7 @@ void fz_warn(fz_context *ctx, char *fmt, ...) static void throw(fz_error_context *ex) { if (ex->top >= 0) { - longjmp(ex->stack[ex->top].buffer, 1); + fz_longjmp(ex->stack[ex->top].buffer, 1); } else { fprintf(stderr, "uncaught exception: %s\n", ex->message); LOGE("uncaught exception: %s\n", ex->message); diff --git a/fitz/fitz.h b/fitz/fitz.h index e24d3fbb..0d0d657a 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -22,6 +22,14 @@ #include "memento.h" +#ifdef __APPLE__ +#define fz_setjmp _setjmp +#define fz_longjmp _longjmp +#else +#define fz_setjmp setjmp +#define fz_longjmp longjmp +#endif + #ifdef __ANDROID__ #include <android/log.h> #define LOG_TAG "libmupdf" @@ -143,7 +151,7 @@ void fz_var_imp(void *); #define fz_try(ctx) \ if (fz_push_try(ctx->error), \ - (ctx->error->stack[ctx->error->top].code = setjmp(ctx->error->stack[ctx->error->top].buffer)) == 0) \ + (ctx->error->stack[ctx->error->top].code = fz_setjmp(ctx->error->stack[ctx->error->top].buffer)) == 0) \ { do { #define fz_always(ctx) \ @@ -169,7 +177,7 @@ instead. This was held as too high a price to pay to drop limitation 2. #define fz_try(ctx) \ if (fz_push_try(ctx->error), \ - (ctx->error->stack[ctx->error->top].code = setjmp(ctx->error->stack[ctx->error->top].buffer)) == 0) \ + (ctx->error->stack[ctx->error->top].code = fz_setjmp(ctx->error->stack[ctx->error->top].buffer)) == 0) \ { do { #define fz_always_(ctx, label) \ @@ -197,7 +205,7 @@ execution. Again this was felt to be too high a cost to use. #define fz_try(ctx) \ if (fz_push_try(ctx->error), \ - (ctx->error->stack[ctx->error->top].code = setjmp(ctx->error->stack[ctx->error->top].buffer)) == 0) \ + (ctx->error->stack[ctx->error->top].code = fz_setjmp(ctx->error->stack[ctx->error->top].buffer)) == 0) \ { do { #define fz_always(ctx) \ |