From 520dbcb30f9f303fa13f4f2dbd5e7589dd5d7ca6 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 14 Feb 2014 14:14:13 +0100 Subject: pdf-js: Pass a name string to type constructor. --- include/mupdf/pdf/javascript.h | 2 +- source/pdf/js/pdf-js.c | 8 ++++---- source/pdf/js/pdf-jsimp-cpp.c | 2 +- source/pdf/js/pdf-jsimp-jscore.c | 3 +-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/mupdf/pdf/javascript.h b/include/mupdf/pdf/javascript.h index a2a308a4..647d74a1 100644 --- a/include/mupdf/pdf/javascript.h +++ b/include/mupdf/pdf/javascript.h @@ -42,7 +42,7 @@ enum pdf_jsimp *pdf_new_jsimp(fz_context *ctx, void *jsctx); void pdf_drop_jsimp(pdf_jsimp *imp); -pdf_jsimp_type *pdf_jsimp_new_type(pdf_jsimp *imp, pdf_jsimp_dtr *dtr); +pdf_jsimp_type *pdf_jsimp_new_type(pdf_jsimp *imp, pdf_jsimp_dtr *dtr, char *name); void pdf_jsimp_drop_type(pdf_jsimp *imp, pdf_jsimp_type *type); void pdf_jsimp_addmethod(pdf_jsimp *imp, pdf_jsimp_type *type, char *name, pdf_jsimp_method *meth); void pdf_jsimp_addproperty(pdf_jsimp *imp, pdf_jsimp_type *type, char *name, pdf_jsimp_getter *get, pdf_jsimp_setter *set); diff --git a/source/pdf/js/pdf-js.c b/source/pdf/js/pdf-js.c index ee7f979b..b6129bfa 100644 --- a/source/pdf/js/pdf-js.c +++ b/source/pdf/js/pdf-js.c @@ -711,7 +711,7 @@ static void declare_dom(pdf_js *js) pdf_jsimp *imp = js->imp; /* Create the document type */ - js->doctype = pdf_jsimp_new_type(imp, NULL); + js->doctype = pdf_jsimp_new_type(imp, NULL, "Document"); pdf_jsimp_addmethod(imp, js->doctype, "getField", doc_getField); pdf_jsimp_addmethod(imp, js->doctype, "resetForm", doc_resetForm); pdf_jsimp_addmethod(imp, js->doctype, "print", doc_print); @@ -720,14 +720,14 @@ static void declare_dom(pdf_js *js) pdf_jsimp_addproperty(imp, js->doctype, "app", doc_getApp, doc_setApp); /* Create the event type */ - js->eventtype = pdf_jsimp_new_type(imp, NULL); + js->eventtype = pdf_jsimp_new_type(imp, NULL, "Event"); pdf_jsimp_addproperty(imp, js->eventtype, "target", event_getTarget, event_setTarget); pdf_jsimp_addproperty(imp, js->eventtype, "value", event_getValue, event_setValue); pdf_jsimp_addproperty(imp, js->eventtype, "willCommit", event_getWillCommit, event_setWillCommit); pdf_jsimp_addproperty(imp, js->eventtype, "rc", event_getRC, event_setRC); /* Create the field type */ - js->fieldtype = pdf_jsimp_new_type(imp, NULL); + js->fieldtype = pdf_jsimp_new_type(imp, NULL, "Field"); pdf_jsimp_addproperty(imp, js->fieldtype, "value", field_getValue, field_setValue); pdf_jsimp_addproperty(imp, js->fieldtype, "borderStyle", field_getBorderStyle, field_setBorderStyle); pdf_jsimp_addproperty(imp, js->fieldtype, "textColor", field_getTextColor, field_setTextColor); @@ -737,7 +737,7 @@ static void declare_dom(pdf_js *js) pdf_jsimp_addmethod(imp, js->fieldtype, "buttonSetCaption", field_buttonSetCaption); /* Create the app type */ - js->apptype = pdf_jsimp_new_type(imp, NULL); + js->apptype = pdf_jsimp_new_type(imp, NULL, "Application"); pdf_jsimp_addmethod(imp, js->apptype, "alert", app_alert); pdf_jsimp_addmethod(imp, js->apptype, "execDialog", app_execDialog); pdf_jsimp_addmethod(imp, js->apptype, "execMenuItem", app_execMenuItem); diff --git a/source/pdf/js/pdf-jsimp-cpp.c b/source/pdf/js/pdf-jsimp-cpp.c index 7e8031a6..a23c15f6 100644 --- a/source/pdf/js/pdf-jsimp-cpp.c +++ b/source/pdf/js/pdf-jsimp-cpp.c @@ -26,7 +26,7 @@ void pdf_drop_jsimp(pdf_jsimp *imp) } } -pdf_jsimp_type *pdf_jsimp_new_type(pdf_jsimp *imp, pdf_jsimp_dtr *dtr) +pdf_jsimp_type *pdf_jsimp_new_type(pdf_jsimp *imp, pdf_jsimp_dtr *dtr, char *name) { pdf_jsimp_type *type = NULL; const char *err = pdf_jsimp_new_type_cpp(imp, dtr, &type); diff --git a/source/pdf/js/pdf-jsimp-jscore.c b/source/pdf/js/pdf-jsimp-jscore.c index 55808b4c..364b08b5 100644 --- a/source/pdf/js/pdf-jsimp-jscore.c +++ b/source/pdf/js/pdf-jsimp-jscore.c @@ -293,12 +293,11 @@ void pdf_drop_jsimp(pdf_jsimp *imp) } } -pdf_jsimp_type *pdf_jsimp_new_type(pdf_jsimp *imp, pdf_jsimp_dtr *dtr) +pdf_jsimp_type *pdf_jsimp_new_type(pdf_jsimp *imp, pdf_jsimp_dtr *dtr, char *name) { pdf_jsimp_type *type = fz_malloc_struct(imp->ctx, pdf_jsimp_type); type->imp = imp; type->dtr = dtr; - return type; } -- cgit v1.2.3