summaryrefslogtreecommitdiff
path: root/source/fitz
diff options
context:
space:
mode:
Diffstat (limited to 'source/fitz')
-rw-r--r--source/fitz/error.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/source/fitz/error.c b/source/fitz/error.c
index 414b993f..6d0b831d 100644
--- a/source/fitz/error.c
+++ b/source/fitz/error.c
@@ -86,7 +86,8 @@ static void throw(fz_error_context *ex)
{
if (ex->top >= 0)
{
- fz_longjmp(ex->stack[ex->top].buffer, ex->stack[ex->top].code + 2);
+ ex->stack[ex->top].code += 2;
+ fz_longjmp(ex->stack[ex->top].buffer, ex->stack[ex->top].code);
}
else
{
@@ -101,23 +102,25 @@ static void throw(fz_error_context *ex)
}
}
-int fz_push_try(fz_error_context *ex)
+void fz_push_try(fz_error_context *ex)
{
- assert(ex);
ex->top++;
/* Normal case, get out of here quick */
if (ex->top < nelem(ex->stack)-1)
- return 1; /* We exit here, and the setjmp sets the code to 0 */
+ {
+ ex->stack[ex->top].code = 0;
+ return;
+ }
/* We reserve the top slot on the exception stack purely to cope with
* the case when we overflow. If we DO hit this, then we 'throw'
- * immediately - returning 0 stops the setjmp happening and takes us
- * direct to the always/catch clauses. */
- assert(ex->top == nelem(ex->stack)-1);
+ * immediately. */
+ assert(ex->top == nelem(ex->stack));
+ ex->top--;
+ ex->errcode = FZ_ERROR_GENERIC;
strcpy(ex->message, "exception stack overflow!");
- ex->stack[ex->top].code = 2;
fprintf(stderr, "error: %s\n", ex->message);
LOGE("error: %s\n", ex->message);
- return 0;
+ throw(ex);
}
int fz_caught(fz_context *ctx)