diff options
author | Paul Gardiner <paulg.artifex@glidos.net> | 2013-01-30 16:46:01 +0000 |
---|---|---|
committer | Paul Gardiner <paulg.artifex@glidos.net> | 2013-01-30 16:46:01 +0000 |
commit | 0203bd8921ffa9569273a077c1cb8bb92a35e520 (patch) | |
tree | 0d1e65f90a1ca06f87216c7aaee944f884ce2c7a /pdf | |
parent | fbdcae154d85010fef6d84e8d89569d2395e6d31 (diff) | |
download | mupdf-0203bd8921ffa9569273a077c1cb8bb92a35e520.tar.xz |
Improve exception handling in fz_bound_t3_glyph
Also simplify some other functions using pdf_dict_puts_drop
Diffstat (limited to 'pdf')
-rw-r--r-- | pdf/pdf_form.c | 17 | ||||
-rw-r--r-- | pdf/pdf_xobject.c | 25 |
2 files changed, 8 insertions, 34 deletions
diff --git a/pdf/pdf_form.c b/pdf/pdf_form.c index 8603986c..8fbebbc8 100644 --- a/pdf/pdf_form.c +++ b/pdf/pdf_form.c @@ -1151,7 +1151,6 @@ static pdf_xobject *load_or_create_form(pdf_document *doc, pdf_obj *obj, fz_rect { fz_context *ctx = doc->ctx; pdf_obj *ap = NULL; - pdf_obj *tobj = NULL; fz_matrix mat; int rot; pdf_obj *formobj = NULL; @@ -1161,7 +1160,6 @@ static pdf_xobject *load_or_create_form(pdf_document *doc, pdf_obj *obj, fz_rect int create_form = 0; fz_var(formobj); - fz_var(tobj); fz_var(form); fz_var(fzbuf); fz_try(ctx) @@ -1176,21 +1174,15 @@ static pdf_xobject *load_or_create_form(pdf_document *doc, pdf_obj *obj, fz_rect ap = pdf_dict_gets(obj, "AP"); if (ap == NULL) { - tobj = pdf_new_dict(ctx, 1); - pdf_dict_puts(obj, "AP", tobj); - ap = tobj; - pdf_drop_obj(tobj); - tobj = NULL; + ap = pdf_new_dict(ctx, 1); + pdf_dict_puts_drop(obj, "AP", ap); } formobj = pdf_dict_gets(ap, dn); if (formobj == NULL) { - tobj = pdf_new_xobject(doc, *rect, mat); - pdf_dict_puts(ap, dn, tobj); - formobj = tobj; - pdf_drop_obj(tobj); - tobj = NULL; + formobj = pdf_new_xobject(doc, *rect, mat); + pdf_dict_puts_drop(ap, dn, formobj); create_form = 1; } @@ -1205,7 +1197,6 @@ static pdf_xobject *load_or_create_form(pdf_document *doc, pdf_obj *obj, fz_rect } fz_always(ctx) { - pdf_drop_obj(tobj); fz_drop_buffer(ctx, fzbuf); } fz_catch(ctx) diff --git a/pdf/pdf_xobject.c b/pdf/pdf_xobject.c index e236edd0..17d8300f 100644 --- a/pdf/pdf_xobject.c +++ b/pdf/pdf_xobject.c @@ -226,25 +226,8 @@ pdf_new_xobject(pdf_document *xref, fz_rect bbox, fz_matrix mat) void pdf_update_xobject_contents(pdf_document *xref, pdf_xobject *form, fz_buffer *buffer) { - fz_context *ctx = xref->ctx; - pdf_obj *len = NULL; - - fz_var(len); - - fz_try(ctx) - { - len = pdf_new_int(ctx, buffer->len); - pdf_dict_dels(form->contents, "Filter"); - pdf_dict_puts(form->contents, "Length", len); - pdf_update_stream(xref, pdf_to_num(form->contents), buffer); - form->iteration ++; - } - fz_always(ctx) - { - pdf_drop_obj(len); - } - fz_catch(ctx) - { - fz_rethrow(ctx); - } + pdf_dict_dels(form->contents, "Filter"); + pdf_dict_puts_drop(form->contents, "Length", pdf_new_int(xref->ctx, buffer->len)); + pdf_update_stream(xref, pdf_to_num(form->contents), buffer); + form->iteration ++; } |