diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2011-10-04 18:44:19 +0100 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2011-10-04 18:44:19 +0100 |
commit | d208be26537db558edb70236ae517cea31b7ebab (patch) | |
tree | 57da95b97e354a53bd4517a42010e90968f007d9 /pdf/pdf_annot.c | |
parent | ba46cad4b09bb957085900a203206c8fa5868cd4 (diff) | |
download | mupdf-d208be26537db558edb70236ae517cea31b7ebab.tar.xz |
Move to exception handling rather than error passing throughout.
This frees us from passing errors back everywhere, and hence enables us
to pass results back as return values.
Rather than having to explicitly check for errors everywhere and bubble
them, we now allow exception handling to do the work for us; the
downside to this is that we no longer emit as much debugging information
as we did before (though this could be put back in). For now, the
debugging information we have lost has been retained in comments
with 'RJW:' at the start.
This code needs fuller testing, but is being committed as a work in
progress.
Diffstat (limited to 'pdf/pdf_annot.c')
-rw-r--r-- | pdf/pdf_annot.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pdf/pdf_annot.c b/pdf/pdf_annot.c index aa640610..2a569e5c 100644 --- a/pdf/pdf_annot.c +++ b/pdf/pdf_annot.c @@ -192,7 +192,6 @@ pdf_load_annots(pdf_annot **annotp, pdf_xref *xref, fz_obj *annots) pdf_annot *annot, *head, *tail; fz_obj *obj, *ap, *as, *n, *rect; pdf_xobject *form; - fz_error error; int i, len; fz_context *ctx = xref->ctx; @@ -217,10 +216,13 @@ pdf_load_annots(pdf_annot **annotp, pdf_xref *xref, fz_obj *annots) if (pdf_is_stream(xref, fz_to_num(n), fz_to_gen(n))) { - error = pdf_load_xobject(&form, xref, n); - if (error) + fz_try(ctx) { - fz_error_handle(error, "ignoring broken annotation"); + form = pdf_load_xobject(xref, n); + } + fz_catch(ctx) + { + fz_warn(ctx, "ignoring broken annotation"); continue; } |