diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-11-07 14:35:56 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-11-07 14:54:40 +0100 |
commit | 80540880944bb9c1cdf4d2e955d3f1378dfbacb8 (patch) | |
tree | e311abd40c91af1bddb4ac0b15a759229f0894d0 | |
parent | 135a83731df60dc321ea6a2b66c010f6232530dc (diff) | |
download | mupdf-80540880944bb9c1cdf4d2e955d3f1378dfbacb8.tar.xz |
Add explicit jmp_buf dereferencing to allow using fz_try from C++.
-rw-r--r-- | include/mupdf/fitz/context.h | 4 | ||||
-rw-r--r-- | source/fitz/error.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/include/mupdf/fitz/context.h b/include/mupdf/fitz/context.h index de83d0e6..d8d5bcc0 100644 --- a/include/mupdf/fitz/context.h +++ b/include/mupdf/fitz/context.h @@ -57,12 +57,12 @@ void fz_var_imp(void *); attention to the man behind the curtain. */ -void *fz_push_try(fz_context *ctx); +fz_jmp_buf *fz_push_try(fz_context *ctx); int fz_do_try(fz_context *ctx); int fz_do_always(fz_context *ctx); int fz_do_catch(fz_context *ctx); -#define fz_try(ctx) if (!fz_setjmp(fz_push_try(ctx))) if (fz_do_try(ctx)) do +#define fz_try(ctx) if (!fz_setjmp(*fz_push_try(ctx))) if (fz_do_try(ctx)) do #define fz_always(ctx) while (0); if (fz_do_always(ctx)) do #define fz_catch(ctx) while (0); if (fz_do_catch(ctx)) diff --git a/source/fitz/error.c b/source/fitz/error.c index 8f4d6f50..ddbde925 100644 --- a/source/fitz/error.c +++ b/source/fitz/error.c @@ -123,7 +123,7 @@ FZ_NORETURN static void throw(fz_context *ctx) } } -void *fz_push_try(fz_context *ctx) +fz_jmp_buf *fz_push_try(fz_context *ctx) { /* If we would overflow the exception stack, throw an exception instead * of entering the try block. We assume that we always have room for @@ -154,7 +154,7 @@ void *fz_push_try(fz_context *ctx) ctx->error->top++; ctx->error->top->code = 0; } - return ctx->error->top->buffer; + return &ctx->error->top->buffer; } int fz_do_try(fz_context *ctx) |