diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-03-29 22:25:09 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-04-24 16:47:43 +0200 |
commit | 51b8205a513e86c62121a927a067632c1a933839 (patch) | |
tree | c2882a6c253a715bfc2ea72854c75350f0b2024b /source/tools | |
parent | 67a7449fc1f186f318942b9c6b8d66d4458b7d87 (diff) | |
download | mupdf-51b8205a513e86c62121a927a067632c1a933839.tar.xz |
Remove need for namedump by using macros and preprocessor.
Add a PDF_NAME(Foo) macro that evaluates to a pdf_obj for /Foo.
Use the C preprocessor to create the enum values and string table
from one include file instead of using a separate code generator tool.
Diffstat (limited to 'source/tools')
-rw-r--r-- | source/tools/pdfcreate.c | 12 | ||||
-rw-r--r-- | source/tools/pdfextract.c | 24 | ||||
-rw-r--r-- | source/tools/pdfinfo.c | 82 | ||||
-rw-r--r-- | source/tools/pdfmerge.c | 8 | ||||
-rw-r--r-- | source/tools/pdfpages.c | 14 | ||||
-rw-r--r-- | source/tools/pdfposter.c | 24 | ||||
-rw-r--r-- | source/tools/pdfshow.c | 2 |
7 files changed, 83 insertions, 83 deletions
diff --git a/source/tools/pdfcreate.c b/source/tools/pdfcreate.c index 74929fe9..33892b45 100644 --- a/source/tools/pdfcreate.c +++ b/source/tools/pdfcreate.c @@ -45,11 +45,11 @@ static void add_font_res(pdf_obj *resources, char *name, char *path, char *encna else font = fz_new_font_from_file(ctx, NULL, path, 0, 0); - subres = pdf_dict_get(ctx, resources, PDF_NAME_Font); + subres = pdf_dict_get(ctx, resources, PDF_NAME(Font)); if (!subres) { subres = pdf_new_dict(ctx, doc, 10); - pdf_dict_put_drop(ctx, resources, PDF_NAME_Font, subres); + pdf_dict_put_drop(ctx, resources, PDF_NAME(Font), subres); } enc = PDF_SIMPLE_ENCODING_LATIN; @@ -83,11 +83,11 @@ static void add_cjkfont_res(pdf_obj *resources, char *name, char *on) data = fz_lookup_cjk_font(ctx, ordering, 0, 0, &size, &index); font = fz_new_font_from_memory(ctx, NULL, data, size, index, 0); - subres = pdf_dict_get(ctx, resources, PDF_NAME_Font); + subres = pdf_dict_get(ctx, resources, PDF_NAME(Font)); if (!subres) { subres = pdf_new_dict(ctx, doc, 10); - pdf_dict_put_drop(ctx, resources, PDF_NAME_Font, subres); + pdf_dict_put_drop(ctx, resources, PDF_NAME(Font), subres); } ref = pdf_add_cjk_font(ctx, doc, font, ordering); @@ -104,11 +104,11 @@ static void add_image_res(pdf_obj *resources, char *name, char *path) image = fz_new_image_from_file(ctx, path); - subres = pdf_dict_get(ctx, resources, PDF_NAME_XObject); + subres = pdf_dict_get(ctx, resources, PDF_NAME(XObject)); if (!subres) { subres = pdf_new_dict(ctx, doc, 10); - pdf_dict_put_drop(ctx, resources, PDF_NAME_XObject, subres); + pdf_dict_put_drop(ctx, resources, PDF_NAME(XObject), subres); } ref = pdf_add_image(ctx, doc, image, 0); diff --git a/source/tools/pdfextract.c b/source/tools/pdfextract.c index 6de26689..65bfb496 100644 --- a/source/tools/pdfextract.c +++ b/source/tools/pdfextract.c @@ -22,14 +22,14 @@ static void usage(void) static int isimage(pdf_obj *obj) { - pdf_obj *type = pdf_dict_get(ctx, obj, PDF_NAME_Subtype); - return pdf_name_eq(ctx, type, PDF_NAME_Image); + pdf_obj *type = pdf_dict_get(ctx, obj, PDF_NAME(Subtype)); + return pdf_name_eq(ctx, type, PDF_NAME(Image)); } static int isfontdesc(pdf_obj *obj) { - pdf_obj *type = pdf_dict_get(ctx, obj, PDF_NAME_Type); - return pdf_name_eq(ctx, type, PDF_NAME_FontDescriptor); + pdf_obj *type = pdf_dict_get(ctx, obj, PDF_NAME(Type)); + return pdf_name_eq(ctx, type, PDF_NAME(FontDescriptor)); } static void writepixmap(fz_context *ctx, fz_pixmap *pix, char *file, int dorgb) @@ -152,38 +152,38 @@ static void savefont(pdf_obj *dict, int num) size_t len; unsigned char *data; - obj = pdf_dict_get(ctx, dict, PDF_NAME_FontName); + obj = pdf_dict_get(ctx, dict, PDF_NAME(FontName)); if (obj) fontname = pdf_to_name(ctx, obj); - obj = pdf_dict_get(ctx, dict, PDF_NAME_FontFile); + obj = pdf_dict_get(ctx, dict, PDF_NAME(FontFile)); if (obj) { stream = obj; ext = "pfa"; } - obj = pdf_dict_get(ctx, dict, PDF_NAME_FontFile2); + obj = pdf_dict_get(ctx, dict, PDF_NAME(FontFile2)); if (obj) { stream = obj; ext = "ttf"; } - obj = pdf_dict_get(ctx, dict, PDF_NAME_FontFile3); + obj = pdf_dict_get(ctx, dict, PDF_NAME(FontFile3)); if (obj) { stream = obj; - obj = pdf_dict_get(ctx, obj, PDF_NAME_Subtype); + obj = pdf_dict_get(ctx, obj, PDF_NAME(Subtype)); if (obj && !pdf_is_name(ctx, obj)) fz_throw(ctx, FZ_ERROR_GENERIC, "invalid font descriptor subtype"); - if (pdf_name_eq(ctx, obj, PDF_NAME_Type1C)) + if (pdf_name_eq(ctx, obj, PDF_NAME(Type1C))) ext = "cff"; - else if (pdf_name_eq(ctx, obj, PDF_NAME_CIDFontType0C)) + else if (pdf_name_eq(ctx, obj, PDF_NAME(CIDFontType0C))) ext = "cid"; - else if (pdf_name_eq(ctx, obj, PDF_NAME_OpenType)) + else if (pdf_name_eq(ctx, obj, PDF_NAME(OpenType))) ext = "otf"; else fz_throw(ctx, FZ_ERROR_GENERIC, "unhandled font type '%s'", pdf_to_name(ctx, obj)); diff --git a/source/tools/pdfinfo.c b/source/tools/pdfinfo.c index ba95db0c..65178561 100644 --- a/source/tools/pdfinfo.c +++ b/source/tools/pdfinfo.c @@ -185,14 +185,14 @@ showglobalinfo(fz_context *ctx, globals *glo) fz_write_printf(ctx, out, "\nPDF-%d.%d\n", doc->version / 10, doc->version % 10); - obj = pdf_dict_get(ctx, pdf_trailer(ctx, doc), PDF_NAME_Info); + obj = pdf_dict_get(ctx, pdf_trailer(ctx, doc), PDF_NAME(Info)); if (obj) { fz_write_printf(ctx, out, "Info object (%d 0 R):\n", pdf_to_num(ctx, obj)); pdf_print_obj(ctx, out, pdf_resolve_indirect(ctx, obj), 1); } - obj = pdf_dict_get(ctx, pdf_trailer(ctx, doc), PDF_NAME_Encrypt); + obj = pdf_dict_get(ctx, pdf_trailer(ctx, doc), PDF_NAME(Encrypt)); if (obj) { fz_write_printf(ctx, out, "\nEncryption object (%d 0 R):\n", pdf_to_num(ctx, obj)); @@ -209,13 +209,13 @@ gatherdimensions(fz_context *ctx, globals *glo, int page, pdf_obj *pageref) pdf_obj *obj; int j; - obj = pdf_dict_get(ctx, pageref, PDF_NAME_MediaBox); + obj = pdf_dict_get(ctx, pageref, PDF_NAME(MediaBox)); if (!pdf_is_array(ctx, obj)) return; pdf_to_rect(ctx, obj, &bbox); - obj = pdf_dict_get(ctx, pageref, PDF_NAME_UserUnit); + obj = pdf_dict_get(ctx, pageref, PDF_NAME(UserUnit)); if (pdf_is_real(ctx, obj)) { float unit = pdf_to_real(ctx, obj); @@ -265,13 +265,13 @@ gatherfonts(fz_context *ctx, globals *glo, int page, pdf_obj *pageref, pdf_obj * continue; } - subtype = pdf_dict_get(ctx, fontdict, PDF_NAME_Subtype); - basefont = pdf_dict_get(ctx, fontdict, PDF_NAME_BaseFont); + subtype = pdf_dict_get(ctx, fontdict, PDF_NAME(Subtype)); + basefont = pdf_dict_get(ctx, fontdict, PDF_NAME(BaseFont)); if (!basefont || pdf_is_null(ctx, basefont)) - name = pdf_dict_get(ctx, fontdict, PDF_NAME_Name); - encoding = pdf_dict_get(ctx, fontdict, PDF_NAME_Encoding); + name = pdf_dict_get(ctx, fontdict, PDF_NAME(Name)); + encoding = pdf_dict_get(ctx, fontdict, PDF_NAME(Encoding)); if (pdf_is_dict(ctx, encoding)) - encoding = pdf_dict_get(ctx, encoding, PDF_NAME_BaseEncoding); + encoding = pdf_dict_get(ctx, encoding, PDF_NAME(BaseEncoding)); for (k = 0; k < glo->fonts; k++) if (!pdf_objcmp(ctx, glo->font[k].u.font.obj, fontdict)) @@ -317,20 +317,20 @@ gatherimages(fz_context *ctx, globals *glo, int page, pdf_obj *pageref, pdf_obj continue; } - type = pdf_dict_get(ctx, imagedict, PDF_NAME_Subtype); - if (!pdf_name_eq(ctx, type, PDF_NAME_Image)) + type = pdf_dict_get(ctx, imagedict, PDF_NAME(Subtype)); + if (!pdf_name_eq(ctx, type, PDF_NAME(Image))) continue; - filter = pdf_dict_get(ctx, imagedict, PDF_NAME_Filter); + filter = pdf_dict_get(ctx, imagedict, PDF_NAME(Filter)); altcs = NULL; - cs = pdf_dict_get(ctx, imagedict, PDF_NAME_ColorSpace); + cs = pdf_dict_get(ctx, imagedict, PDF_NAME(ColorSpace)); if (pdf_is_array(ctx, cs)) { pdf_obj *cses = cs; cs = pdf_array_get(ctx, cses, 0); - if (pdf_name_eq(ctx, cs, PDF_NAME_DeviceN) || pdf_name_eq(ctx, cs, PDF_NAME_Separation)) + if (pdf_name_eq(ctx, cs, PDF_NAME(DeviceN)) || pdf_name_eq(ctx, cs, PDF_NAME(Separation))) { altcs = pdf_array_get(ctx, cses, 2); if (pdf_is_array(ctx, altcs)) @@ -338,9 +338,9 @@ gatherimages(fz_context *ctx, globals *glo, int page, pdf_obj *pageref, pdf_obj } } - width = pdf_dict_get(ctx, imagedict, PDF_NAME_Width); - height = pdf_dict_get(ctx, imagedict, PDF_NAME_Height); - bpc = pdf_dict_get(ctx, imagedict, PDF_NAME_BitsPerComponent); + width = pdf_dict_get(ctx, imagedict, PDF_NAME(Width)); + height = pdf_dict_get(ctx, imagedict, PDF_NAME(Height)); + bpc = pdf_dict_get(ctx, imagedict, PDF_NAME(BitsPerComponent)); for (k = 0; k < glo->images; k++) if (!pdf_objcmp(ctx, glo->image[k].u.image.obj, imagedict)) @@ -387,17 +387,17 @@ gatherforms(fz_context *ctx, globals *glo, int page, pdf_obj *pageref, pdf_obj * continue; } - type = pdf_dict_get(ctx, xobjdict, PDF_NAME_Subtype); - if (!pdf_name_eq(ctx, type, PDF_NAME_Form)) + type = pdf_dict_get(ctx, xobjdict, PDF_NAME(Subtype)); + if (!pdf_name_eq(ctx, type, PDF_NAME(Form))) continue; - subtype = pdf_dict_get(ctx, xobjdict, PDF_NAME_Subtype2); - if (!pdf_name_eq(ctx, subtype, PDF_NAME_PS)) + subtype = pdf_dict_get(ctx, xobjdict, PDF_NAME(Subtype2)); + if (!pdf_name_eq(ctx, subtype, PDF_NAME(PS))) continue; - group = pdf_dict_get(ctx, xobjdict, PDF_NAME_Group); - groupsubtype = pdf_dict_get(ctx, group, PDF_NAME_S); - reference = pdf_dict_get(ctx, xobjdict, PDF_NAME_Ref); + group = pdf_dict_get(ctx, xobjdict, PDF_NAME(Group)); + groupsubtype = pdf_dict_get(ctx, group, PDF_NAME(S)); + reference = pdf_dict_get(ctx, xobjdict, PDF_NAME(Ref)); for (k = 0; k < glo->forms; k++) if (!pdf_objcmp(ctx, glo->form[k].u.form.obj, xobjdict)) @@ -437,10 +437,10 @@ gatherpsobjs(fz_context *ctx, globals *glo, int page, pdf_obj *pageref, pdf_obj continue; } - type = pdf_dict_get(ctx, xobjdict, PDF_NAME_Subtype); - subtype = pdf_dict_get(ctx, xobjdict, PDF_NAME_Subtype2); - if (!pdf_name_eq(ctx, type, PDF_NAME_PS) && - (!pdf_name_eq(ctx, type, PDF_NAME_Form) || !pdf_name_eq(ctx, subtype, PDF_NAME_PS))) + type = pdf_dict_get(ctx, xobjdict, PDF_NAME(Subtype)); + subtype = pdf_dict_get(ctx, xobjdict, PDF_NAME(Subtype2)); + if (!pdf_name_eq(ctx, type, PDF_NAME(PS)) && + (!pdf_name_eq(ctx, type, PDF_NAME(Form)) || !pdf_name_eq(ctx, subtype, PDF_NAME(PS)))) continue; for (k = 0; k < glo->psobjs; k++) @@ -478,7 +478,7 @@ gathershadings(fz_context *ctx, globals *glo, int page, pdf_obj *pageref, pdf_ob continue; } - type = pdf_dict_get(ctx, shade, PDF_NAME_ShadingType); + type = pdf_dict_get(ctx, shade, PDF_NAME(ShadingType)); if (!pdf_is_int(ctx, type) || pdf_to_int(ctx, type) < 1 || pdf_to_int(ctx, type) > 7) { fz_warn(ctx, "not a shading type (%d 0 R)", pdf_to_num(ctx, shade)); @@ -524,7 +524,7 @@ gatherpatterns(fz_context *ctx, globals *glo, int page, pdf_obj *pageref, pdf_ob continue; } - type = pdf_dict_get(ctx, patterndict, PDF_NAME_PatternType); + type = pdf_dict_get(ctx, patterndict, PDF_NAME(PatternType)); if (!pdf_is_int(ctx, type) || pdf_to_int(ctx, type) < 1 || pdf_to_int(ctx, type) > 2) { fz_warn(ctx, "not a pattern type (%d 0 R)", pdf_to_num(ctx, patterndict)); @@ -533,14 +533,14 @@ gatherpatterns(fz_context *ctx, globals *glo, int page, pdf_obj *pageref, pdf_ob if (pdf_to_int(ctx, type) == 1) { - paint = pdf_dict_get(ctx, patterndict, PDF_NAME_PaintType); + paint = pdf_dict_get(ctx, patterndict, PDF_NAME(PaintType)); if (!pdf_is_int(ctx, paint) || pdf_to_int(ctx, paint) < 1 || pdf_to_int(ctx, paint) > 2) { fz_warn(ctx, "not a pattern paint type (%d 0 R)", pdf_to_num(ctx, patterndict)); paint = NULL; } - tiling = pdf_dict_get(ctx, patterndict, PDF_NAME_TilingType); + tiling = pdf_dict_get(ctx, patterndict, PDF_NAME(TilingType)); if (!pdf_is_int(ctx, tiling) || pdf_to_int(ctx, tiling) < 1 || pdf_to_int(ctx, tiling) > 3) { fz_warn(ctx, "not a pattern tiling type (%d 0 R)", pdf_to_num(ctx, patterndict)); @@ -549,7 +549,7 @@ gatherpatterns(fz_context *ctx, globals *glo, int page, pdf_obj *pageref, pdf_ob } else { - shading = pdf_dict_get(ctx, patterndict, PDF_NAME_Shading); + shading = pdf_dict_get(ctx, patterndict, PDF_NAME(Shading)); } for (k = 0; k < glo->patterns; k++) @@ -593,7 +593,7 @@ gatherresourceinfo(fz_context *ctx, globals *glo, int page, pdf_obj *rsrc, int s fz_try(ctx) { - font = pdf_dict_get(ctx, rsrc, PDF_NAME_Font); + font = pdf_dict_get(ctx, rsrc, PDF_NAME(Font)); if (show & FONTS && font) { int n; @@ -604,13 +604,13 @@ gatherresourceinfo(fz_context *ctx, globals *glo, int page, pdf_obj *rsrc, int s { pdf_obj *obj = pdf_dict_get_val(ctx, font, i); - subrsrc = pdf_dict_get(ctx, obj, PDF_NAME_Resources); + subrsrc = pdf_dict_get(ctx, obj, PDF_NAME(Resources)); if (subrsrc && pdf_objcmp(ctx, rsrc, subrsrc)) gatherresourceinfo(ctx, glo, page, subrsrc, show); } } - xobj = pdf_dict_get(ctx, rsrc, PDF_NAME_XObject); + xobj = pdf_dict_get(ctx, rsrc, PDF_NAME(XObject)); if (show & (IMAGES|XOBJS) && xobj) { int n; @@ -626,17 +626,17 @@ gatherresourceinfo(fz_context *ctx, globals *glo, int page, pdf_obj *rsrc, int s for (i = 0; i < n; i++) { pdf_obj *obj = pdf_dict_get_val(ctx, xobj, i); - subrsrc = pdf_dict_get(ctx, obj, PDF_NAME_Resources); + subrsrc = pdf_dict_get(ctx, obj, PDF_NAME(Resources)); if (subrsrc && pdf_objcmp(ctx, rsrc, subrsrc)) gatherresourceinfo(ctx, glo, page, subrsrc, show); } } - shade = pdf_dict_get(ctx, rsrc, PDF_NAME_Shading); + shade = pdf_dict_get(ctx, rsrc, PDF_NAME(Shading)); if (show & SHADINGS && shade) gathershadings(ctx, glo, page, pageref, shade); - pattern = pdf_dict_get(ctx, rsrc, PDF_NAME_Pattern); + pattern = pdf_dict_get(ctx, rsrc, PDF_NAME(Pattern)); if (show & PATTERNS && pattern) { int n; @@ -645,7 +645,7 @@ gatherresourceinfo(fz_context *ctx, globals *glo, int page, pdf_obj *rsrc, int s for (i = 0; i < n; i++) { pdf_obj *obj = pdf_dict_get_val(ctx, pattern, i); - subrsrc = pdf_dict_get(ctx, obj, PDF_NAME_Resources); + subrsrc = pdf_dict_get(ctx, obj, PDF_NAME(Resources)); if (subrsrc && pdf_objcmp(ctx, rsrc, subrsrc)) gatherresourceinfo(ctx, glo, page, subrsrc, show); } @@ -670,7 +670,7 @@ gatherpageinfo(fz_context *ctx, globals *glo, int page, int show) gatherdimensions(ctx, glo, page, pageref); - rsrc = pdf_dict_get(ctx, pageref, PDF_NAME_Resources); + rsrc = pdf_dict_get(ctx, pageref, PDF_NAME(Resources)); gatherresourceinfo(ctx, glo, page, rsrc, show); } diff --git a/source/tools/pdfmerge.c b/source/tools/pdfmerge.c index 86e8a27b..f0d124d8 100644 --- a/source/tools/pdfmerge.c +++ b/source/tools/pdfmerge.c @@ -36,9 +36,9 @@ static void page_merge(int page_from, int page_to, pdf_graft_map *graft_map) int i; /* Copy as few key/value pairs as we can. Do not include items that reference other pages. */ - static pdf_obj * const copy_list[] = { PDF_NAME_Contents, PDF_NAME_Resources, - PDF_NAME_MediaBox, PDF_NAME_CropBox, PDF_NAME_BleedBox, PDF_NAME_TrimBox, PDF_NAME_ArtBox, - PDF_NAME_Rotate, PDF_NAME_UserUnit }; + static pdf_obj * const copy_list[] = { PDF_NAME(Contents), PDF_NAME(Resources), + PDF_NAME(MediaBox), PDF_NAME(CropBox), PDF_NAME(BleedBox), PDF_NAME(TrimBox), PDF_NAME(ArtBox), + PDF_NAME(Rotate), PDF_NAME(UserUnit) }; fz_var(ref); @@ -50,7 +50,7 @@ static void page_merge(int page_from, int page_to, pdf_graft_map *graft_map) /* Make a new page object dictionary to hold the items we copy from the source page. */ page_dict = pdf_new_dict(ctx, doc_des, 4); - pdf_dict_put(ctx, page_dict, PDF_NAME_Type, PDF_NAME_Page); + pdf_dict_put(ctx, page_dict, PDF_NAME(Type), PDF_NAME(Page)); for (i = 0; i < nelem(copy_list); i++) { diff --git a/source/tools/pdfpages.c b/source/tools/pdfpages.c index 70f601cd..cf5a8bf2 100644 --- a/source/tools/pdfpages.c +++ b/source/tools/pdfpages.c @@ -88,13 +88,13 @@ showpage(fz_context *ctx, pdf_document *doc, fz_output *out, int page) if (!failed) { - failed |= showbox(ctx, out, pageref, "MediaBox", PDF_NAME_MediaBox); - failed |= showbox(ctx, out, pageref, "CropBox", PDF_NAME_CropBox); - failed |= showbox(ctx, out, pageref, "ArtBox", PDF_NAME_ArtBox); - failed |= showbox(ctx, out, pageref, "BleedBox", PDF_NAME_BleedBox); - failed |= showbox(ctx, out, pageref, "TrimBox", PDF_NAME_TrimBox); - failed |= shownum(ctx, out, pageref, "Rotate", PDF_NAME_Rotate); - failed |= shownum(ctx, out, pageref, "UserUnit", PDF_NAME_UserUnit); + failed |= showbox(ctx, out, pageref, "MediaBox", PDF_NAME(MediaBox)); + failed |= showbox(ctx, out, pageref, "CropBox", PDF_NAME(CropBox)); + failed |= showbox(ctx, out, pageref, "ArtBox", PDF_NAME(ArtBox)); + failed |= showbox(ctx, out, pageref, "BleedBox", PDF_NAME(BleedBox)); + failed |= showbox(ctx, out, pageref, "TrimBox", PDF_NAME(TrimBox)); + failed |= shownum(ctx, out, pageref, "Rotate", PDF_NAME(Rotate)); + failed |= shownum(ctx, out, pageref, "UserUnit", PDF_NAME(UserUnit)); } fz_write_printf(ctx, out, "</page>\n"); diff --git a/source/tools/pdfposter.c b/source/tools/pdfposter.c index 8f16834d..dc51d113 100644 --- a/source/tools/pdfposter.c +++ b/source/tools/pdfposter.c @@ -66,12 +66,12 @@ static void decimatepages(fz_context *ctx, pdf_document *doc) fz_rect mediabox; fz_matrix page_ctm; - oldroot = pdf_dict_get(ctx, pdf_trailer(ctx, doc), PDF_NAME_Root); - pages = pdf_dict_get(ctx, oldroot, PDF_NAME_Pages); + oldroot = pdf_dict_get(ctx, pdf_trailer(ctx, doc), PDF_NAME(Root)); + pages = pdf_dict_get(ctx, oldroot, PDF_NAME(Pages)); root = pdf_new_dict(ctx, doc, 2); - pdf_dict_put(ctx, root, PDF_NAME_Type, pdf_dict_get(ctx, oldroot, PDF_NAME_Type)); - pdf_dict_put(ctx, root, PDF_NAME_Pages, pdf_dict_get(ctx, oldroot, PDF_NAME_Pages)); + pdf_dict_put(ctx, root, PDF_NAME(Type), pdf_dict_get(ctx, oldroot, PDF_NAME(Type))); + pdf_dict_put(ctx, root, PDF_NAME(Pages), pdf_dict_get(ctx, oldroot, PDF_NAME(Pages))); pdf_update_object(ctx, doc, pdf_to_num(ctx, oldroot), root); @@ -136,13 +136,13 @@ static void decimatepages(fz_context *ctx, pdf_document *doc) pdf_array_push_real(ctx, newmediabox, mb.x1); pdf_array_push_real(ctx, newmediabox, mb.y1); - pdf_dict_put(ctx, newpageobj, PDF_NAME_Parent, pages); - pdf_dict_put_drop(ctx, newpageobj, PDF_NAME_MediaBox, newmediabox); + pdf_dict_put(ctx, newpageobj, PDF_NAME(Parent), pages); + pdf_dict_put_drop(ctx, newpageobj, PDF_NAME(MediaBox), newmediabox); - intersect_box(ctx, doc, newpageobj, PDF_NAME_CropBox, &mb); - intersect_box(ctx, doc, newpageobj, PDF_NAME_BleedBox, &mb); - intersect_box(ctx, doc, newpageobj, PDF_NAME_TrimBox, &mb); - intersect_box(ctx, doc, newpageobj, PDF_NAME_ArtBox, &mb); + intersect_box(ctx, doc, newpageobj, PDF_NAME(CropBox), &mb); + intersect_box(ctx, doc, newpageobj, PDF_NAME(BleedBox), &mb); + intersect_box(ctx, doc, newpageobj, PDF_NAME(TrimBox), &mb); + intersect_box(ctx, doc, newpageobj, PDF_NAME(ArtBox), &mb); /* Store page object in new kids array */ pdf_drop_obj(ctx, newpageobj); @@ -154,8 +154,8 @@ static void decimatepages(fz_context *ctx, pdf_document *doc) } /* Update page count and kids array */ - pdf_dict_put_int(ctx, pages, PDF_NAME_Count, kidcount); - pdf_dict_put_drop(ctx, pages, PDF_NAME_Kids, kids); + pdf_dict_put_int(ctx, pages, PDF_NAME(Count), kidcount); + pdf_dict_put_drop(ctx, pages, PDF_NAME(Kids), kids); } int pdfposter_main(int argc, char **argv) diff --git a/source/tools/pdfshow.c b/source/tools/pdfshow.c index 2649dab1..d53b701e 100644 --- a/source/tools/pdfshow.c +++ b/source/tools/pdfshow.c @@ -40,7 +40,7 @@ static void showencrypt(void) if (!doc) fz_throw(ctx, FZ_ERROR_GENERIC, "no file specified"); - encrypt = pdf_dict_get(ctx, pdf_trailer(ctx, doc), PDF_NAME_Encrypt); + encrypt = pdf_dict_get(ctx, pdf_trailer(ctx, doc), PDF_NAME(Encrypt)); if (!encrypt) fz_throw(ctx, FZ_ERROR_GENERIC, "document not encrypted"); fz_write_printf(ctx, out, "encryption dictionary\n"); |