diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-09-21 00:11:22 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-09-21 00:11:22 +0200 |
commit | 69ed4a8f4dbfac7f2f1de925e34807e4fee3b27c (patch) | |
tree | b7f82296a259d360ce90f0826e475321d630a222 /pdf/pdf_type3.c | |
parent | 99ba154018b7c4a2c47b4c7e721ffe6d9164f9f3 (diff) | |
download | mupdf-69ed4a8f4dbfac7f2f1de925e34807e4fee3b27c.tar.xz |
Don't thread ctx through safe fz_obj functions.
Diffstat (limited to 'pdf/pdf_type3.c')
-rw-r--r-- | pdf/pdf_type3.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/pdf/pdf_type3.c b/pdf/pdf_type3.c index 7f055f9f..b6306b47 100644 --- a/pdf/pdf_type3.c +++ b/pdf/pdf_type3.c @@ -24,18 +24,18 @@ pdf_load_type3_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_o fz_matrix matrix; fz_context *ctx = xref->ctx; - obj = fz_dict_gets(ctx, dict, "Name"); - if (fz_is_name(ctx, obj)) - fz_strlcpy(buf, fz_to_name(ctx, obj), sizeof buf); + obj = fz_dict_gets(dict, "Name"); + if (fz_is_name(obj)) + fz_strlcpy(buf, fz_to_name(obj), sizeof buf); else sprintf(buf, "Unnamed-T3"); fontdesc = pdf_new_font_desc(ctx); - obj = fz_dict_gets(ctx, dict, "FontMatrix"); + obj = fz_dict_gets(dict, "FontMatrix"); matrix = pdf_to_matrix(ctx, obj); - obj = fz_dict_gets(ctx, dict, "FontBBox"); + obj = fz_dict_gets(dict, "FontBBox"); bbox = pdf_to_rect(ctx, obj); fontdesc->font = fz_new_type3_font(ctx, buf, matrix); @@ -47,36 +47,36 @@ pdf_load_type3_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_o for (i = 0; i < 256; i++) estrings[i] = NULL; - encoding = fz_dict_gets(ctx, dict, "Encoding"); + encoding = fz_dict_gets(dict, "Encoding"); if (!encoding) { error = fz_error_make("syntaxerror: Type3 font missing Encoding"); goto cleanup; } - if (fz_is_name(ctx, encoding)) - pdf_load_encoding(estrings, fz_to_name(ctx, encoding)); + if (fz_is_name(encoding)) + pdf_load_encoding(estrings, fz_to_name(encoding)); - if (fz_is_dict(ctx, encoding)) + if (fz_is_dict(encoding)) { fz_obj *base, *diff, *item; - base = fz_dict_gets(ctx, encoding, "BaseEncoding"); - if (fz_is_name(ctx, base)) - pdf_load_encoding(estrings, fz_to_name(ctx, base)); + base = fz_dict_gets(encoding, "BaseEncoding"); + if (fz_is_name(base)) + pdf_load_encoding(estrings, fz_to_name(base)); - diff = fz_dict_gets(ctx, encoding, "Differences"); - if (fz_is_array(ctx, diff)) + diff = fz_dict_gets(encoding, "Differences"); + if (fz_is_array(diff)) { - n = fz_array_len(ctx, diff); + n = fz_array_len(diff); k = 0; for (i = 0; i < n; i++) { - item = fz_array_get(ctx, diff, i); - if (fz_is_int(ctx, item)) - k = fz_to_int(ctx, item); - if (fz_is_name(ctx, item)) - estrings[k++] = fz_to_name(ctx, item); + item = fz_array_get(diff, i); + if (fz_is_int(item)) + k = fz_to_int(item); + if (fz_is_name(item)) + estrings[k++] = fz_to_name(item); if (k < 0) k = 0; if (k > 255) k = 255; } @@ -85,7 +85,7 @@ pdf_load_type3_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_o fontdesc->encoding = pdf_new_identity_cmap(ctx, 0, 1); - error = pdf_load_to_unicode(fontdesc, xref, estrings, NULL, fz_dict_gets(ctx, dict, "ToUnicode")); + error = pdf_load_to_unicode(fontdesc, xref, estrings, NULL, fz_dict_gets(dict, "ToUnicode")); if (error) goto cleanup; @@ -93,10 +93,10 @@ pdf_load_type3_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_o pdf_set_default_hmtx(fontdesc, 0); - first = fz_to_int(ctx, fz_dict_gets(ctx, dict, "FirstChar")); - last = fz_to_int(ctx, fz_dict_gets(ctx, dict, "LastChar")); + first = fz_to_int(fz_dict_gets(dict, "FirstChar")); + last = fz_to_int(fz_dict_gets(dict, "LastChar")); - widths = fz_dict_gets(ctx, dict, "Widths"); + widths = fz_dict_gets(dict, "Widths"); if (!widths) { error = fz_error_make("syntaxerror: Type3 font missing Widths"); @@ -105,7 +105,7 @@ pdf_load_type3_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_o for (i = first; i <= last; i++) { - float w = fz_to_real(ctx, fz_array_get(ctx, widths, i - first)); + float w = fz_to_real(fz_array_get(widths, i - first)); w = fontdesc->font->t3matrix.a * w * 1000; fontdesc->font->t3widths[i] = w * 0.001f; pdf_add_hmtx(ctx, fontdesc, i, i, w); @@ -115,7 +115,7 @@ pdf_load_type3_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_o /* Resources -- inherit page resources if the font doesn't have its own */ - fontdesc->font->t3resources = fz_dict_gets(ctx, dict, "Resources"); + fontdesc->font->t3resources = fz_dict_gets(dict, "Resources"); if (!fontdesc->font->t3resources) fontdesc->font->t3resources = rdb; if (fontdesc->font->t3resources) @@ -128,7 +128,7 @@ pdf_load_type3_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_o /* CharProcs */ - charprocs = fz_dict_gets(ctx, dict, "CharProcs"); + charprocs = fz_dict_gets(dict, "CharProcs"); if (!charprocs) { error = fz_error_make("syntaxerror: Type3 font missing CharProcs"); @@ -139,7 +139,7 @@ pdf_load_type3_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_o { if (estrings[i]) { - obj = fz_dict_gets(ctx, charprocs, estrings[i]); + obj = fz_dict_gets(charprocs, estrings[i]); if (pdf_is_stream(xref, fz_to_num(obj), fz_to_gen(obj))) { error = pdf_load_stream(&fontdesc->font->t3procs[i], xref, fz_to_num(obj), fz_to_gen(obj)); |