From c94a793413938c4142bc8bedd40ae2fe2527f71a Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 26 Oct 2017 16:48:57 -0400 Subject: Make spec arrays const This CL marks all of the Spec arrays as const. Change-Id: Ie36f670a4230fcac2cba5544b9c6e5179b0c7073 Reviewed-on: https://pdfium-review.googlesource.com/16951 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- fpdfsdk/javascript/Document.cpp | 4 +-- fpdfsdk/javascript/Document.h | 4 +-- fpdfsdk/javascript/Field.cpp | 4 +-- fpdfsdk/javascript/Field.h | 4 +-- fpdfsdk/javascript/Icon.cpp | 2 +- fpdfsdk/javascript/Icon.h | 2 +- fpdfsdk/javascript/PublicMethods.cpp | 2 +- fpdfsdk/javascript/PublicMethods.h | 2 +- fpdfsdk/javascript/app.cpp | 47 ++++++++++++++++++------------------ fpdfsdk/javascript/app.h | 4 +-- fpdfsdk/javascript/cjs_annot.cpp | 2 +- fpdfsdk/javascript/cjs_annot.h | 2 +- fpdfsdk/javascript/cjs_border.cpp | 2 +- fpdfsdk/javascript/cjs_border.h | 2 +- fpdfsdk/javascript/cjs_display.cpp | 11 +++++---- fpdfsdk/javascript/cjs_display.h | 2 +- fpdfsdk/javascript/cjs_font.cpp | 2 +- fpdfsdk/javascript/cjs_font.h | 2 +- fpdfsdk/javascript/cjs_global.cpp | 2 +- fpdfsdk/javascript/cjs_global.h | 2 +- fpdfsdk/javascript/cjs_highlight.cpp | 2 +- fpdfsdk/javascript/cjs_highlight.h | 2 +- fpdfsdk/javascript/cjs_position.cpp | 2 +- fpdfsdk/javascript/cjs_position.h | 2 +- fpdfsdk/javascript/cjs_scalehow.cpp | 2 +- fpdfsdk/javascript/cjs_scalehow.h | 2 +- fpdfsdk/javascript/cjs_scalewhen.cpp | 2 +- fpdfsdk/javascript/cjs_scalewhen.h | 2 +- fpdfsdk/javascript/cjs_style.cpp | 2 +- fpdfsdk/javascript/cjs_style.h | 2 +- fpdfsdk/javascript/cjs_zoomtype.cpp | 2 +- fpdfsdk/javascript/cjs_zoomtype.h | 2 +- fpdfsdk/javascript/color.cpp | 10 ++++---- fpdfsdk/javascript/color.h | 4 +-- fpdfsdk/javascript/console.cpp | 10 ++++---- fpdfsdk/javascript/console.h | 2 +- fpdfsdk/javascript/event.cpp | 2 +- fpdfsdk/javascript/event.h | 2 +- fpdfsdk/javascript/report.cpp | 6 ++--- fpdfsdk/javascript/report.h | 2 +- fpdfsdk/javascript/util.cpp | 2 +- fpdfsdk/javascript/util.h | 2 +- 42 files changed, 86 insertions(+), 84 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index 5ff66e9c8d..02cf82b9b1 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -69,7 +69,7 @@ PrintParamsObj::PrintParamsObj(CJS_Object* pJSObject) #define MINWIDTH 5.0f #define MINHEIGHT 5.0f -JSPropertySpec CJS_Document::PropertySpecs[] = { +const JSPropertySpec CJS_Document::PropertySpecs[] = { {"ADBE", get_ADBE_static, set_ADBE_static}, {"author", get_author_static, set_author_static}, {"baseURL", get_base_URL_static, set_base_URL_static}, @@ -106,7 +106,7 @@ JSPropertySpec CJS_Document::PropertySpecs[] = { {"zoomType", get_zoom_type_static, set_zoom_type_static}, {0, 0, 0}}; -JSMethodSpec CJS_Document::MethodSpecs[] = { +const JSMethodSpec CJS_Document::MethodSpecs[] = { {"addAnnot", addAnnot_static}, {"addField", addField_static}, {"addLink", addLink_static}, diff --git a/fpdfsdk/javascript/Document.h b/fpdfsdk/javascript/Document.h index 6f9acd2cfb..92199838f1 100644 --- a/fpdfsdk/javascript/Document.h +++ b/fpdfsdk/javascript/Document.h @@ -354,8 +354,8 @@ class CJS_Document : public CJS_Object { private: static int ObjDefnID; - static JSPropertySpec PropertySpecs[]; - static JSMethodSpec MethodSpecs[]; + static const JSPropertySpec PropertySpecs[]; + static const JSMethodSpec MethodSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_DOCUMENT_H_ diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index 2a1040655e..2c49859ae1 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -72,7 +72,7 @@ bool SetWidgetDisplayStatus(CPDFSDK_Widget* pWidget, int value) { } // namespace -JSPropertySpec CJS_Field::PropertySpecs[] = { +const JSPropertySpec CJS_Field::PropertySpecs[] = { {"alignment", get_alignment_static, set_alignment_static}, {"borderStyle", get_border_style_static, set_border_style_static}, {"buttonAlignX", get_button_align_x_static, set_button_align_x_static}, @@ -136,7 +136,7 @@ JSPropertySpec CJS_Field::PropertySpecs[] = { {"source", get_source_static, set_source_static}, {0, 0, 0}}; -JSMethodSpec CJS_Field::MethodSpecs[] = { +const JSMethodSpec CJS_Field::MethodSpecs[] = { {"browseForFileToSubmit", browseForFileToSubmit_static}, {"buttonGetCaption", buttonGetCaption_static}, {"buttonGetIcon", buttonGetIcon_static}, diff --git a/fpdfsdk/javascript/Field.h b/fpdfsdk/javascript/Field.h index 1bfd44eef1..75a00e69d6 100644 --- a/fpdfsdk/javascript/Field.h +++ b/fpdfsdk/javascript/Field.h @@ -449,8 +449,8 @@ class CJS_Field : public CJS_Object { private: static int ObjDefnID; - static JSPropertySpec PropertySpecs[]; - static JSMethodSpec MethodSpecs[]; + static const JSPropertySpec PropertySpecs[]; + static const JSMethodSpec MethodSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_FIELD_H_ diff --git a/fpdfsdk/javascript/Icon.cpp b/fpdfsdk/javascript/Icon.cpp index ffb9b81011..e096e3a4ba 100644 --- a/fpdfsdk/javascript/Icon.cpp +++ b/fpdfsdk/javascript/Icon.cpp @@ -10,7 +10,7 @@ #include "fpdfsdk/javascript/JS_Object.h" #include "fpdfsdk/javascript/JS_Value.h" -JSPropertySpec CJS_Icon::PropertySpecs[] = { +const JSPropertySpec CJS_Icon::PropertySpecs[] = { {"name", get_name_static, set_name_static}, {0, 0, 0}}; diff --git a/fpdfsdk/javascript/Icon.h b/fpdfsdk/javascript/Icon.h index 33ee554c02..fdfb36d0e7 100644 --- a/fpdfsdk/javascript/Icon.h +++ b/fpdfsdk/javascript/Icon.h @@ -38,7 +38,7 @@ class CJS_Icon : public CJS_Object { private: static int ObjDefnID; - static JSPropertySpec PropertySpecs[]; + static const JSPropertySpec PropertySpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_ICON_H_ diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index 08c8147cc1..acd01bb6db 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -32,7 +32,7 @@ #define DOUBLE_CORRECT 0.000000000000001 -JSMethodSpec CJS_PublicMethods::GlobalFunctionSpecs[] = { +const JSMethodSpec CJS_PublicMethods::GlobalFunctionSpecs[] = { {"AFNumber_Format", AFNumber_Format_static}, {"AFNumber_Keystroke", AFNumber_Keystroke_static}, {"AFPercent_Format", AFPercent_Format_static}, diff --git a/fpdfsdk/javascript/PublicMethods.h b/fpdfsdk/javascript/PublicMethods.h index 12223b03cc..9e9d56aabd 100644 --- a/fpdfsdk/javascript/PublicMethods.h +++ b/fpdfsdk/javascript/PublicMethods.h @@ -128,7 +128,7 @@ class CJS_PublicMethods : public CJS_Object { static void AFExtractNums_static( const v8::FunctionCallbackInfo& info); - static JSMethodSpec GlobalFunctionSpecs[]; + static const JSMethodSpec GlobalFunctionSpecs[]; static void DefineJSObjects(CFXJS_Engine* pEngine); static int ParseStringInteger(const WideString& string, size_t nStart, diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp index 9cc13ea21d..0c55ee6123 100644 --- a/fpdfsdk/javascript/app.cpp +++ b/fpdfsdk/javascript/app.cpp @@ -176,7 +176,7 @@ void TimerObj::SetTimer(GlobalTimer* pTimer) { #endif // PDF_ENABLE_XFA #define JS_NUM_FORMSVERSION 7 -JSPropertySpec CJS_App::PropertySpecs[] = { +const JSPropertySpec CJS_App::PropertySpecs[] = { {"activeDocs", get_active_docs_static, set_active_docs_static}, {"calculate", get_calculate_static, set_calculate_static}, {"formsVersion", get_forms_version_static, set_forms_version_static}, @@ -193,28 +193,29 @@ JSPropertySpec CJS_App::PropertySpecs[] = { {"viewerVersion", get_viewer_version_static, set_viewer_version_static}, {0, 0, 0}}; -JSMethodSpec CJS_App::MethodSpecs[] = {{"alert", alert_static}, - {"beep", beep_static}, - {"browseForDoc", browseForDoc_static}, - {"clearInterval", clearInterval_static}, - {"clearTimeOut", clearTimeOut_static}, - {"execDialog", execDialog_static}, - {"execMenuItem", execMenuItem_static}, - {"findComponent", findComponent_static}, - {"goBack", goBack_static}, - {"goForward", goForward_static}, - {"launchURL", launchURL_static}, - {"mailMsg", mailMsg_static}, - {"newFDF", newFDF_static}, - {"newDoc", newDoc_static}, - {"openDoc", openDoc_static}, - {"openFDF", openFDF_static}, - {"popUpMenuEx", popUpMenuEx_static}, - {"popUpMenu", popUpMenu_static}, - {"response", response_static}, - {"setInterval", setInterval_static}, - {"setTimeOut", setTimeOut_static}, - {0, 0}}; +const JSMethodSpec CJS_App::MethodSpecs[] = { + {"alert", alert_static}, + {"beep", beep_static}, + {"browseForDoc", browseForDoc_static}, + {"clearInterval", clearInterval_static}, + {"clearTimeOut", clearTimeOut_static}, + {"execDialog", execDialog_static}, + {"execMenuItem", execMenuItem_static}, + {"findComponent", findComponent_static}, + {"goBack", goBack_static}, + {"goForward", goForward_static}, + {"launchURL", launchURL_static}, + {"mailMsg", mailMsg_static}, + {"newFDF", newFDF_static}, + {"newDoc", newDoc_static}, + {"openDoc", openDoc_static}, + {"openFDF", openFDF_static}, + {"popUpMenuEx", popUpMenuEx_static}, + {"popUpMenu", popUpMenu_static}, + {"response", response_static}, + {"setInterval", setInterval_static}, + {"setTimeOut", setTimeOut_static}, + {0, 0}}; int CJS_App::ObjDefnID = -1; diff --git a/fpdfsdk/javascript/app.h b/fpdfsdk/javascript/app.h index 53794736f2..7307a73d97 100644 --- a/fpdfsdk/javascript/app.h +++ b/fpdfsdk/javascript/app.h @@ -186,8 +186,8 @@ class CJS_App : public CJS_Object { private: static int ObjDefnID; - static JSPropertySpec PropertySpecs[]; - static JSMethodSpec MethodSpecs[]; + static const JSPropertySpec PropertySpecs[]; + static const JSMethodSpec MethodSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_APP_H_ diff --git a/fpdfsdk/javascript/cjs_annot.cpp b/fpdfsdk/javascript/cjs_annot.cpp index 27ce8cddec..29601cd4a6 100644 --- a/fpdfsdk/javascript/cjs_annot.cpp +++ b/fpdfsdk/javascript/cjs_annot.cpp @@ -19,7 +19,7 @@ CPDFSDK_BAAnnot* ToBAAnnot(CPDFSDK_Annot* annot) { } // namespace -JSPropertySpec CJS_Annot::PropertySpecs[] = { +const JSPropertySpec CJS_Annot::PropertySpecs[] = { {"hidden", get_hidden_static, set_hidden_static}, {"name", get_name_static, set_name_static}, {"type", get_type_static, set_type_static}, diff --git a/fpdfsdk/javascript/cjs_annot.h b/fpdfsdk/javascript/cjs_annot.h index 810cea155f..d61b5038c4 100644 --- a/fpdfsdk/javascript/cjs_annot.h +++ b/fpdfsdk/javascript/cjs_annot.h @@ -44,7 +44,7 @@ class CJS_Annot : public CJS_Object { private: static int ObjDefnID; - static JSPropertySpec PropertySpecs[]; + static const JSPropertySpec PropertySpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_CJS_ANNOT_H_ diff --git a/fpdfsdk/javascript/cjs_border.cpp b/fpdfsdk/javascript/cjs_border.cpp index f751fcc0b4..c1f72cdad9 100644 --- a/fpdfsdk/javascript/cjs_border.cpp +++ b/fpdfsdk/javascript/cjs_border.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/javascript/cjs_border.h" -JSConstSpec CJS_Border::ConstSpecs[] = { +const JSConstSpec CJS_Border::ConstSpecs[] = { {"s", JSConstSpec::String, 0, "solid"}, {"b", JSConstSpec::String, 0, "beveled"}, {"d", JSConstSpec::String, 0, "dashed"}, diff --git a/fpdfsdk/javascript/cjs_border.h b/fpdfsdk/javascript/cjs_border.h index c9f550d8ff..732ecd8d85 100644 --- a/fpdfsdk/javascript/cjs_border.h +++ b/fpdfsdk/javascript/cjs_border.h @@ -18,7 +18,7 @@ class CJS_Border : public CJS_Object { private: static int ObjDefnID; - static JSConstSpec ConstSpecs[]; + static const JSConstSpec ConstSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_CJS_BORDER_H_ diff --git a/fpdfsdk/javascript/cjs_display.cpp b/fpdfsdk/javascript/cjs_display.cpp index b196623743..329675dbc3 100644 --- a/fpdfsdk/javascript/cjs_display.cpp +++ b/fpdfsdk/javascript/cjs_display.cpp @@ -6,11 +6,12 @@ #include "fpdfsdk/javascript/cjs_display.h" -JSConstSpec CJS_Display::ConstSpecs[] = {{"visible", JSConstSpec::Number, 0, 0}, - {"hidden", JSConstSpec::Number, 1, 0}, - {"noPrint", JSConstSpec::Number, 2, 0}, - {"noView", JSConstSpec::Number, 3, 0}, - {0, JSConstSpec::Number, 0, 0}}; +const JSConstSpec CJS_Display::ConstSpecs[] = { + {"visible", JSConstSpec::Number, 0, 0}, + {"hidden", JSConstSpec::Number, 1, 0}, + {"noPrint", JSConstSpec::Number, 2, 0}, + {"noView", JSConstSpec::Number, 3, 0}, + {0, JSConstSpec::Number, 0, 0}}; int CJS_Display::ObjDefnID = -1; diff --git a/fpdfsdk/javascript/cjs_display.h b/fpdfsdk/javascript/cjs_display.h index faf779dbcb..53975e6c42 100644 --- a/fpdfsdk/javascript/cjs_display.h +++ b/fpdfsdk/javascript/cjs_display.h @@ -18,7 +18,7 @@ class CJS_Display : public CJS_Object { private: static int ObjDefnID; - static JSConstSpec ConstSpecs[]; + static const JSConstSpec ConstSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_CJS_DISPLAY_H_ diff --git a/fpdfsdk/javascript/cjs_font.cpp b/fpdfsdk/javascript/cjs_font.cpp index 5189666a8f..403da400d4 100644 --- a/fpdfsdk/javascript/cjs_font.cpp +++ b/fpdfsdk/javascript/cjs_font.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/javascript/cjs_font.h" -JSConstSpec CJS_Font::ConstSpecs[] = { +const JSConstSpec CJS_Font::ConstSpecs[] = { {"Times", JSConstSpec::String, 0, "Times-Roman"}, {"TimesB", JSConstSpec::String, 0, "Times-Bold"}, {"TimesI", JSConstSpec::String, 0, "Times-Italic"}, diff --git a/fpdfsdk/javascript/cjs_font.h b/fpdfsdk/javascript/cjs_font.h index 73bca9e104..680a3e81a2 100644 --- a/fpdfsdk/javascript/cjs_font.h +++ b/fpdfsdk/javascript/cjs_font.h @@ -18,7 +18,7 @@ class CJS_Font : public CJS_Object { private: static int ObjDefnID; - static JSConstSpec ConstSpecs[]; + static const JSConstSpec ConstSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_CJS_FONT_H_ diff --git a/fpdfsdk/javascript/cjs_global.cpp b/fpdfsdk/javascript/cjs_global.cpp index 826d26c638..d38455d8be 100644 --- a/fpdfsdk/javascript/cjs_global.cpp +++ b/fpdfsdk/javascript/cjs_global.cpp @@ -174,7 +174,7 @@ class JSGlobalAlternate : public CJS_EmbedObj { } // namespace -JSMethodSpec CJS_Global::MethodSpecs[] = { +const JSMethodSpec CJS_Global::MethodSpecs[] = { {"setPersistent", setPersistent_static}, {0, 0}}; diff --git a/fpdfsdk/javascript/cjs_global.h b/fpdfsdk/javascript/cjs_global.h index 499a66b7c2..b99b071e9a 100644 --- a/fpdfsdk/javascript/cjs_global.h +++ b/fpdfsdk/javascript/cjs_global.h @@ -36,7 +36,7 @@ class CJS_Global : public CJS_Object { private: static int ObjDefnID; - static JSMethodSpec MethodSpecs[]; + static const JSMethodSpec MethodSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_CJS_GLOBAL_H_ diff --git a/fpdfsdk/javascript/cjs_highlight.cpp b/fpdfsdk/javascript/cjs_highlight.cpp index 97c561867d..167e059ed4 100644 --- a/fpdfsdk/javascript/cjs_highlight.cpp +++ b/fpdfsdk/javascript/cjs_highlight.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/javascript/cjs_highlight.h" -JSConstSpec CJS_Highlight::ConstSpecs[] = { +const JSConstSpec CJS_Highlight::ConstSpecs[] = { {"n", JSConstSpec::String, 0, "none"}, {"i", JSConstSpec::String, 0, "invert"}, {"p", JSConstSpec::String, 0, "push"}, diff --git a/fpdfsdk/javascript/cjs_highlight.h b/fpdfsdk/javascript/cjs_highlight.h index 1fca9bc9ae..3e7118762a 100644 --- a/fpdfsdk/javascript/cjs_highlight.h +++ b/fpdfsdk/javascript/cjs_highlight.h @@ -18,7 +18,7 @@ class CJS_Highlight : public CJS_Object { private: static int ObjDefnID; - static JSConstSpec ConstSpecs[]; + static const JSConstSpec ConstSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_CJS_HIGHLIGHT_H_ diff --git a/fpdfsdk/javascript/cjs_position.cpp b/fpdfsdk/javascript/cjs_position.cpp index f62efc9d6e..d53c514b73 100644 --- a/fpdfsdk/javascript/cjs_position.cpp +++ b/fpdfsdk/javascript/cjs_position.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/javascript/cjs_position.h" -JSConstSpec CJS_Position::ConstSpecs[] = { +const JSConstSpec CJS_Position::ConstSpecs[] = { {"textOnly", JSConstSpec::Number, 0, 0}, {"iconOnly", JSConstSpec::Number, 1, 0}, {"iconTextV", JSConstSpec::Number, 2, 0}, diff --git a/fpdfsdk/javascript/cjs_position.h b/fpdfsdk/javascript/cjs_position.h index 8a38cf28bd..fda2b6cba5 100644 --- a/fpdfsdk/javascript/cjs_position.h +++ b/fpdfsdk/javascript/cjs_position.h @@ -18,7 +18,7 @@ class CJS_Position : public CJS_Object { private: static int ObjDefnID; - static JSConstSpec ConstSpecs[]; + static const JSConstSpec ConstSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_CJS_POSITION_H_ diff --git a/fpdfsdk/javascript/cjs_scalehow.cpp b/fpdfsdk/javascript/cjs_scalehow.cpp index b2c04854e9..0da304b8d9 100644 --- a/fpdfsdk/javascript/cjs_scalehow.cpp +++ b/fpdfsdk/javascript/cjs_scalehow.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/javascript/cjs_scalehow.h" -JSConstSpec CJS_ScaleHow::ConstSpecs[] = { +const JSConstSpec CJS_ScaleHow::ConstSpecs[] = { {"proportional", JSConstSpec::Number, 0, 0}, {"anamorphic", JSConstSpec::Number, 1, 0}, {0, JSConstSpec::Number, 0, 0}}; diff --git a/fpdfsdk/javascript/cjs_scalehow.h b/fpdfsdk/javascript/cjs_scalehow.h index bc3548487e..4ddf943a65 100644 --- a/fpdfsdk/javascript/cjs_scalehow.h +++ b/fpdfsdk/javascript/cjs_scalehow.h @@ -18,7 +18,7 @@ class CJS_ScaleHow : public CJS_Object { private: static int ObjDefnID; - static JSConstSpec ConstSpecs[]; + static const JSConstSpec ConstSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_CJS_SCALEHOW_H_ diff --git a/fpdfsdk/javascript/cjs_scalewhen.cpp b/fpdfsdk/javascript/cjs_scalewhen.cpp index 7c45956632..95314a2ba0 100644 --- a/fpdfsdk/javascript/cjs_scalewhen.cpp +++ b/fpdfsdk/javascript/cjs_scalewhen.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/javascript/cjs_scalewhen.h" -JSConstSpec CJS_ScaleWhen::ConstSpecs[] = { +const JSConstSpec CJS_ScaleWhen::ConstSpecs[] = { {"always", JSConstSpec::Number, 0, 0}, {"never", JSConstSpec::Number, 1, 0}, {"tooBig", JSConstSpec::Number, 2, 0}, diff --git a/fpdfsdk/javascript/cjs_scalewhen.h b/fpdfsdk/javascript/cjs_scalewhen.h index 7aa97213f5..50a723b285 100644 --- a/fpdfsdk/javascript/cjs_scalewhen.h +++ b/fpdfsdk/javascript/cjs_scalewhen.h @@ -18,7 +18,7 @@ class CJS_ScaleWhen : public CJS_Object { private: static int ObjDefnID; - static JSConstSpec ConstSpecs[]; + static const JSConstSpec ConstSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_CJS_SCALEWHEN_H_ diff --git a/fpdfsdk/javascript/cjs_style.cpp b/fpdfsdk/javascript/cjs_style.cpp index 25bd3524e1..03e3f6d789 100644 --- a/fpdfsdk/javascript/cjs_style.cpp +++ b/fpdfsdk/javascript/cjs_style.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/javascript/cjs_style.h" -JSConstSpec CJS_Style::ConstSpecs[] = { +const JSConstSpec CJS_Style::ConstSpecs[] = { {"ch", JSConstSpec::String, 0, "check"}, {"cr", JSConstSpec::String, 0, "cross"}, {"di", JSConstSpec::String, 0, "diamond"}, diff --git a/fpdfsdk/javascript/cjs_style.h b/fpdfsdk/javascript/cjs_style.h index 1907555027..a7f3999c26 100644 --- a/fpdfsdk/javascript/cjs_style.h +++ b/fpdfsdk/javascript/cjs_style.h @@ -18,7 +18,7 @@ class CJS_Style : public CJS_Object { private: static int ObjDefnID; - static JSConstSpec ConstSpecs[]; + static const JSConstSpec ConstSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_CJS_STYLE_H_ diff --git a/fpdfsdk/javascript/cjs_zoomtype.cpp b/fpdfsdk/javascript/cjs_zoomtype.cpp index 1069d8e06e..682308c8d8 100644 --- a/fpdfsdk/javascript/cjs_zoomtype.cpp +++ b/fpdfsdk/javascript/cjs_zoomtype.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/javascript/cjs_zoomtype.h" -JSConstSpec CJS_Zoomtype::ConstSpecs[] = { +const JSConstSpec CJS_Zoomtype::ConstSpecs[] = { {"none", JSConstSpec::String, 0, "NoVary"}, {"fitP", JSConstSpec::String, 0, "FitPage"}, {"fitW", JSConstSpec::String, 0, "FitWidth"}, diff --git a/fpdfsdk/javascript/cjs_zoomtype.h b/fpdfsdk/javascript/cjs_zoomtype.h index 9387481106..84cecee9e2 100644 --- a/fpdfsdk/javascript/cjs_zoomtype.h +++ b/fpdfsdk/javascript/cjs_zoomtype.h @@ -18,7 +18,7 @@ class CJS_Zoomtype : public CJS_Object { private: static int ObjDefnID; - static JSConstSpec ConstSpecs[]; + static const JSConstSpec ConstSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_CJS_ZOOMTYPE_H_ diff --git a/fpdfsdk/javascript/color.cpp b/fpdfsdk/javascript/color.cpp index 3c8d3425d9..300565b5c8 100644 --- a/fpdfsdk/javascript/color.cpp +++ b/fpdfsdk/javascript/color.cpp @@ -15,7 +15,7 @@ #include "fpdfsdk/javascript/cjs_eventhandler.h" #include "fpdfsdk/javascript/cjs_runtime.h" -JSPropertySpec CJS_Color::PropertySpecs[] = { +const JSPropertySpec CJS_Color::PropertySpecs[] = { {"black", get_black_static, set_black_static}, {"blue", get_blue_static, set_blue_static}, {"cyan", get_cyan_static, set_cyan_static}, @@ -30,11 +30,11 @@ JSPropertySpec CJS_Color::PropertySpecs[] = { {"yellow", get_yellow_static, set_yellow_static}, {0, 0, 0}}; -int CJS_Color::ObjDefnID = -1; +const JSMethodSpec CJS_Color::MethodSpecs[] = {{"convert", convert_static}, + {"equal", equal_static}, + {0, 0}}; -JSMethodSpec CJS_Color::MethodSpecs[] = {{"convert", convert_static}, - {"equal", equal_static}, - {0, 0}}; +int CJS_Color::ObjDefnID = -1; // static void CJS_Color::DefineJSObjects(CFXJS_Engine* pEngine, FXJSOBJTYPE eObjType) { diff --git a/fpdfsdk/javascript/color.h b/fpdfsdk/javascript/color.h index 49dec3c5e8..7fc0a60aff 100644 --- a/fpdfsdk/javascript/color.h +++ b/fpdfsdk/javascript/color.h @@ -108,8 +108,8 @@ class CJS_Color : public CJS_Object { private: static int ObjDefnID; - static JSPropertySpec PropertySpecs[]; - static JSMethodSpec MethodSpecs[]; + static const JSPropertySpec PropertySpecs[]; + static const JSMethodSpec MethodSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_COLOR_H_ diff --git a/fpdfsdk/javascript/console.cpp b/fpdfsdk/javascript/console.cpp index 720f5f092e..adfbb444e0 100644 --- a/fpdfsdk/javascript/console.cpp +++ b/fpdfsdk/javascript/console.cpp @@ -14,11 +14,11 @@ #include "fpdfsdk/javascript/cjs_event_context.h" #include "fpdfsdk/javascript/cjs_eventhandler.h" -JSMethodSpec CJS_Console::MethodSpecs[] = {{"clear", clear_static}, - {"hide", hide_static}, - {"println", println_static}, - {"show", show_static}, - {0, 0}}; +const JSMethodSpec CJS_Console::MethodSpecs[] = {{"clear", clear_static}, + {"hide", hide_static}, + {"println", println_static}, + {"show", show_static}, + {0, 0}}; int CJS_Console::ObjDefnID = -1; diff --git a/fpdfsdk/javascript/console.h b/fpdfsdk/javascript/console.h index 96c2daec21..78743e62d9 100644 --- a/fpdfsdk/javascript/console.h +++ b/fpdfsdk/javascript/console.h @@ -41,7 +41,7 @@ class CJS_Console : public CJS_Object { private: static int ObjDefnID; - static JSMethodSpec MethodSpecs[]; + static const JSMethodSpec MethodSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_CONSOLE_H_ diff --git a/fpdfsdk/javascript/event.cpp b/fpdfsdk/javascript/event.cpp index a320adaad3..07e439be47 100644 --- a/fpdfsdk/javascript/event.cpp +++ b/fpdfsdk/javascript/event.cpp @@ -13,7 +13,7 @@ #include "fpdfsdk/javascript/cjs_event_context.h" #include "fpdfsdk/javascript/cjs_eventhandler.h" -JSPropertySpec CJS_Event::PropertySpecs[] = { +const JSPropertySpec CJS_Event::PropertySpecs[] = { {"change", get_change_static, set_change_static}, {"changeEx", get_change_ex_static, set_change_ex_static}, {"commitKey", get_commit_key_static, set_commit_key_static}, diff --git a/fpdfsdk/javascript/event.h b/fpdfsdk/javascript/event.h index d78902f5e3..2041efc297 100644 --- a/fpdfsdk/javascript/event.h +++ b/fpdfsdk/javascript/event.h @@ -105,7 +105,7 @@ class CJS_Event : public CJS_Object { private: static int ObjDefnID; - static JSPropertySpec PropertySpecs[]; + static const JSPropertySpec PropertySpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_EVENT_H_ diff --git a/fpdfsdk/javascript/report.cpp b/fpdfsdk/javascript/report.cpp index f52ffc5201..3e18cb8909 100644 --- a/fpdfsdk/javascript/report.cpp +++ b/fpdfsdk/javascript/report.cpp @@ -12,9 +12,9 @@ #include "fpdfsdk/javascript/JS_Object.h" #include "fpdfsdk/javascript/JS_Value.h" -JSMethodSpec CJS_Report::MethodSpecs[] = {{"save", save_static}, - {"writeText", writeText_static}, - {0, 0}}; +const JSMethodSpec CJS_Report::MethodSpecs[] = {{"save", save_static}, + {"writeText", writeText_static}, + {0, 0}}; int CJS_Report::ObjDefnID = -1; diff --git a/fpdfsdk/javascript/report.h b/fpdfsdk/javascript/report.h index b9cad59824..7765ae5a9e 100644 --- a/fpdfsdk/javascript/report.h +++ b/fpdfsdk/javascript/report.h @@ -35,7 +35,7 @@ class CJS_Report : public CJS_Object { private: static int ObjDefnID; - static JSMethodSpec MethodSpecs[]; + static const JSMethodSpec MethodSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_REPORT_H_ diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp index 6ff9f05bca..4493a47d46 100644 --- a/fpdfsdk/javascript/util.cpp +++ b/fpdfsdk/javascript/util.cpp @@ -58,7 +58,7 @@ const TbConvert TbConvertTable[] = { } // namespace -JSMethodSpec CJS_Util::MethodSpecs[] = { +const JSMethodSpec CJS_Util::MethodSpecs[] = { {"printd", printd_static}, {"printf", printf_static}, {"printx", printx_static}, {"scand", scand_static}, {"byteToChar", byteToChar_static}, {0, 0}}; diff --git a/fpdfsdk/javascript/util.h b/fpdfsdk/javascript/util.h index 7e1b3886e4..68f82e7d1b 100644 --- a/fpdfsdk/javascript/util.h +++ b/fpdfsdk/javascript/util.h @@ -57,7 +57,7 @@ class CJS_Util : public CJS_Object { private: static int ObjDefnID; - static JSMethodSpec MethodSpecs[]; + static const JSMethodSpec MethodSpecs[]; }; #endif // FPDFSDK_JAVASCRIPT_UTIL_H_ -- cgit v1.2.3