From c6aa389a2c3430396a5e818bbb849410ab29d617 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Thu, 1 Mar 2012 15:25:43 +0000 Subject: Setjmp/longjmp exception tweaks. First, fix a couple of the 'alternative formulations' of the try/catch code in the comments. Secondly, work around a Mac OS X compiler bug. --- fitz/fitz.h | 4 ++-- pdf/pdf_parse.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/fitz/fitz.h b/fitz/fitz.h index 825ed4ba..f72aecb9 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -210,7 +210,7 @@ execution. Again this was felt to be too high a cost to use. #define fz_always(ctx) \ } while (0); \ - longjmp(ctx->error->stack[ctx->error->top].buffer, 3); \ + fz_longjmp(ctx->error->stack[ctx->error->top].buffer, 3); \ } \ else if (ctx->error->stack[ctx->error->top].code & 1) \ { do { @@ -218,7 +218,7 @@ execution. Again this was felt to be too high a cost to use. #define fz_catch(ctx) \ } while(0); \ if (ctx->error->stack[ctx->error->top].code == 1) \ - longjmp(ctx->error->stack[ctx->error->top].buffer, 2); \ + fz_longjmp(ctx->error->stack[ctx->error->top].buffer, 2); \ ctx->error->top--;\ } \ else if (ctx->error->top--, 1) diff --git a/pdf/pdf_parse.c b/pdf/pdf_parse.c index e171e698..57ba1d6f 100644 --- a/pdf/pdf_parse.c +++ b/pdf/pdf_parse.c @@ -313,19 +313,18 @@ end: pdf_obj * pdf_parse_dict(pdf_document *xref, fz_stream *file, pdf_lexbuf *buf) { - pdf_obj *dict = NULL; + pdf_obj *dict; pdf_obj *key = NULL; pdf_obj *val = NULL; int tok; int a, b; fz_context *ctx = file->ctx; - fz_var(dict); + dict = pdf_new_dict(ctx, 8); + fz_var(key); fz_var(val); - dict = pdf_new_dict(ctx, 8); - fz_try(ctx) { while (1) -- cgit v1.2.3