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/pdf/pdf-js.c | |
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/pdf/pdf-js.c')
-rw-r--r-- | source/pdf/pdf-js.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/pdf/pdf-js.c b/source/pdf/pdf-js.c index 0024670a..d5fb1e4b 100644 --- a/source/pdf/pdf-js.c +++ b/source/pdf/pdf-js.c @@ -618,9 +618,9 @@ static pdf_js *pdf_new_js(fz_context *ctx, pdf_document *doc) pdf_obj *root, *acroform; /* Find the form array */ - root = pdf_dict_get(ctx, pdf_trailer(ctx, doc), PDF_NAME_Root); - acroform = pdf_dict_get(ctx, root, PDF_NAME_AcroForm); - js->form = pdf_dict_get(ctx, acroform, PDF_NAME_Fields); + root = pdf_dict_get(ctx, pdf_trailer(ctx, doc), PDF_NAME(Root)); + acroform = pdf_dict_get(ctx, root, PDF_NAME(AcroForm)); + js->form = pdf_dict_get(ctx, acroform, PDF_NAME(Fields)); /* Initialise the javascript engine, passing the fz_context for use in memory allocation. */ js->imp = js_newstate(pdf_js_alloc, ctx, 0); @@ -649,7 +649,7 @@ static void pdf_js_load_document_level(pdf_js *js) pdf_obj *javascript; int len, i; - javascript = pdf_load_name_tree(ctx, doc, PDF_NAME_JavaScript); + javascript = pdf_load_name_tree(ctx, doc, PDF_NAME(JavaScript)); len = pdf_dict_len(ctx, javascript); fz_try(ctx) @@ -657,7 +657,7 @@ static void pdf_js_load_document_level(pdf_js *js) for (i = 0; i < len; i++) { pdf_obj *fragment = pdf_dict_get_val(ctx, javascript, i); - pdf_obj *code = pdf_dict_get(ctx, fragment, PDF_NAME_JS); + pdf_obj *code = pdf_dict_get(ctx, fragment, PDF_NAME(JS)); char *codebuf = pdf_load_stream_or_string_as_utf8(ctx, code); pdf_js_execute(js, codebuf); fz_free(ctx, codebuf); |