From 0bc02c152bd0c178a5946196e2054a5cdc7650f4 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 26 Feb 2018 21:02:52 +0000 Subject: Add some more missing consts. Get things out of the .data section. Change-Id: I375cf00186a3d5d8d10f5d147bd4b692f5db3683 Reviewed-on: https://pdfium-review.googlesource.com/27130 Commit-Queue: Tom Sepez Reviewed-by: dsinclair --- xfa/fxfa/fm2js/cxfa_fmlexer.cpp | 2 +- xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.cpp | 10 ---------- xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h | 8 ++++++-- 3 files changed, 7 insertions(+), 13 deletions(-) (limited to 'xfa/fxfa/fm2js') diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp index 41989f0a2d..3559fb7aeb 100644 --- a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp @@ -78,7 +78,7 @@ const XFA_FMKeyword keyWords[] = { }; #ifndef NDEBUG -const wchar_t* tokenStrings[] = { +const wchar_t* const tokenStrings[] = { L"TOKand", L"TOKlparen", L"TOKrparen", L"TOKmul", L"TOKplus", L"TOKcomma", L"TOKminus", L"TOKdot", L"TOKdiv", L"TOKlt", L"TOKassign", L"TOKgt", diff --git a/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.cpp b/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.cpp index 6312ba6b3d..023516bb6e 100644 --- a/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.cpp @@ -4,17 +4,7 @@ #include "xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h" -namespace { - -// Arbitarily picked by looking at how deep a translation got before hitting -// the getting fuzzer memory limits. Should be larger then |kMaxParseDepth| in -// cxfa_fmparser.cpp. -const unsigned int kMaxDepth = 5000; - -} // namespace - unsigned long CXFA_FMToJavaScriptDepth::depth_ = 0; -unsigned long CXFA_FMToJavaScriptDepth::max_depth_ = kMaxDepth; void CXFA_FMToJavaScriptDepth::Reset() { depth_ = 0; diff --git a/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h b/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h index 14f87a68f5..f4cd1be472 100644 --- a/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h +++ b/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h @@ -10,13 +10,17 @@ class CXFA_FMToJavaScriptDepth { CXFA_FMToJavaScriptDepth() { depth_++; } ~CXFA_FMToJavaScriptDepth() { depth_--; } - bool IsWithinMaxDepth() const { return depth_ <= max_depth_; } + bool IsWithinMaxDepth() const { return depth_ <= kMaxDepth; } static void Reset(); private: + // Arbitarily picked by looking at how deep a translation got before hitting + // the getting fuzzer memory limits. Should be larger then |kMaxParseDepth| in + // cxfa_fmparser.cpp. + const unsigned long kMaxDepth = 5000; + static unsigned long depth_; - static unsigned long max_depth_; }; #endif // XFA_FXFA_FM2JS_CXFA_FMTOJAVASCRIPTDEPTH_H_ -- cgit v1.2.3