From 3f157c7c6a5cdb92dd5df2a0b06c10ed83b472e8 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 29 Feb 2016 16:10:24 -0500 Subject: Remove xfa_fm2js.h and IWYU. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1745023003 . --- BUILD.gn | 1 - testing/libfuzzer/pdf_fm2js_fuzzer.cc | 2 +- xfa.gyp | 1 - xfa/src/fxfa/src/common/xfa_fm2jsapi.h | 1 + xfa/src/fxfa/src/fm2js/xfa_error.cpp | 12 +++++----- xfa/src/fxfa/src/fm2js/xfa_error.h | 4 ++++ xfa/src/fxfa/src/fm2js/xfa_expression.cpp | 6 ++++- xfa/src/fxfa/src/fm2js/xfa_fm2js.h | 32 ------------------------- xfa/src/fxfa/src/fm2js/xfa_fm2jsapi.cpp | 9 ++++++- xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp | 7 +++++- xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.h | 2 ++ xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp | 2 +- xfa/src/fxfa/src/fm2js/xfa_fmparse.h | 1 + xfa/src/fxfa/src/fm2js/xfa_lexer.cpp | 3 ++- xfa/src/fxfa/src/fm2js/xfa_lexer.h | 3 +++ xfa/src/fxfa/src/fm2js/xfa_program.cpp | 3 ++- xfa/src/fxfa/src/fm2js/xfa_program.h | 3 +++ xfa/src/fxfa/src/fm2js/xfa_simpleexpression.cpp | 3 ++- xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h | 6 +++++ 19 files changed, 53 insertions(+), 48 deletions(-) delete mode 100644 xfa/src/fxfa/src/fm2js/xfa_fm2js.h diff --git a/BUILD.gn b/BUILD.gn index 222a1f4b14..22506ccb38 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1328,7 +1328,6 @@ if (pdf_enable_xfa) { "xfa/src/fxfa/src/fm2js/xfa_error.h", "xfa/src/fxfa/src/fm2js/xfa_expression.cpp", "xfa/src/fxfa/src/fm2js/xfa_expression.h", - "xfa/src/fxfa/src/fm2js/xfa_fm2js.h", "xfa/src/fxfa/src/fm2js/xfa_fm2jsapi.cpp", "xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp", "xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.h", diff --git a/testing/libfuzzer/pdf_fm2js_fuzzer.cc b/testing/libfuzzer/pdf_fm2js_fuzzer.cc index 803ef7c843..c4881c358c 100644 --- a/testing/libfuzzer/pdf_fm2js_fuzzer.cc +++ b/testing/libfuzzer/pdf_fm2js_fuzzer.cc @@ -7,7 +7,7 @@ #include "core/include/fxcrt/fx_basic.h" #include "core/include/fxcrt/fx_string.h" -#include "xfa/src/fxfa/src/fm2js/xfa_fm2js.h" +#include "xfa/src/fxfa/src/fm2js/xfa_program.h" extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size > std::numeric_limits::max()) diff --git a/xfa.gyp b/xfa.gyp index 691afcd3f4..f2047440f8 100644 --- a/xfa.gyp +++ b/xfa.gyp @@ -577,7 +577,6 @@ "xfa/src/fxfa/src/fm2js/xfa_error.h", "xfa/src/fxfa/src/fm2js/xfa_expression.cpp", "xfa/src/fxfa/src/fm2js/xfa_expression.h", - "xfa/src/fxfa/src/fm2js/xfa_fm2js.h", "xfa/src/fxfa/src/fm2js/xfa_fm2jsapi.cpp", "xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp", "xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.h", diff --git a/xfa/src/fxfa/src/common/xfa_fm2jsapi.h b/xfa/src/fxfa/src/common/xfa_fm2jsapi.h index 80a723aae2..f392c5cdbf 100644 --- a/xfa/src/fxfa/src/common/xfa_fm2jsapi.h +++ b/xfa/src/fxfa/src/common/xfa_fm2jsapi.h @@ -9,6 +9,7 @@ #include "core/include/fxcrt/fx_basic.h" #include "xfa/include/fxjse/fxjse.h" +#include "xfa/src/fxfa/src/common/xfa_document.h" #define FOXIT_XFA_FM2JS_FORMCALC_RUNTIME "foxit_xfa_formcalc_runtime" diff --git a/xfa/src/fxfa/src/fm2js/xfa_error.cpp b/xfa/src/fxfa/src/fm2js/xfa_error.cpp index a7d061f1e9..fdeee363bb 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_error.cpp +++ b/xfa/src/fxfa/src/fm2js/xfa_error.cpp @@ -4,17 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/src/fxfa/src/fm2js/xfa_fm2js.h" -static const FX_WCHAR* gs_lpStrErrorMsgInfo[] = { +#include "xfa/src/fxfa/src/fm2js/xfa_error.h" + +static const FX_WCHAR* const gs_lpStrErrorMsgInfo[] = { L"unsupported char '%c'", L"bad suffix on number", L"invalidate char '%c'", L"expected identifier instead of '%s'", L"expected '%s' instead of '%s'", L"expected 'endif' instead of '%s'", L"unexpected expression '%s'", L"expected operator '%s' instead of '%s'", }; + const FX_WCHAR* XFA_FM_ErrorMsg(XFA_FM_ERRMSG msg) { - if (msg < FMERR_MAXIMUM) { + if (msg < FMERR_MAXIMUM) return gs_lpStrErrorMsgInfo[msg]; - } else { - return L""; - } + return L""; } diff --git a/xfa/src/fxfa/src/fm2js/xfa_error.h b/xfa/src/fxfa/src/fm2js/xfa_error.h index 87318d5491..41b1942215 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_error.h +++ b/xfa/src/fxfa/src/fm2js/xfa_error.h @@ -7,6 +7,9 @@ #ifndef XFA_SRC_FXFA_SRC_FM2JS_XFA_ERROR_H_ #define XFA_SRC_FXFA_SRC_FM2JS_XFA_ERROR_H_ +#include "core/include/fxcrt/fx_string.h" +#include "core/include/fxcrt/fx_system.h" + enum XFA_FM_ERRMSG { FMERR_UNSUPPORTED_CHAR, FMERR_BAD_SUFFIX_NUMBER, @@ -18,6 +21,7 @@ enum XFA_FM_ERRMSG { FMERR_EXPTECTED_OPERATOR, FMERR_MAXIMUM }; + class CXFA_FMErrorInfo { public: CXFA_FMErrorInfo() : linenum(0){}; diff --git a/xfa/src/fxfa/src/fm2js/xfa_expression.cpp b/xfa/src/fxfa/src/fm2js/xfa_expression.cpp index 95bd809bad..6f135c8645 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_expression.cpp +++ b/xfa/src/fxfa/src/fm2js/xfa_expression.cpp @@ -4,11 +4,15 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/src/fxfa/src/fm2js/xfa_fm2js.h" +#include "xfa/src/fxfa/src/fm2js/xfa_expression.h" + +#include "core/include/fxcrt/fx_basic.h" + static CFX_WideStringC RUNTIMEBLOCKTEMPARRAY = FX_WSTRC(L"foxit_xfa_formcalc_runtime_block_temp_array"); static CFX_WideStringC RUNTIMEBLOCKTEMPARRAYINDEX = FX_WSTRC(L"foxit_xfa_formcalc_runtime_block_temp_array_index"); + CXFA_FMExpression::CXFA_FMExpression(FX_DWORD line) : m_type(XFA_FM_EXPTYPE_UNKNOWN), m_line(line) { } diff --git a/xfa/src/fxfa/src/fm2js/xfa_fm2js.h b/xfa/src/fxfa/src/fm2js/xfa_fm2js.h deleted file mode 100644 index 10ff415141..0000000000 --- a/xfa/src/fxfa/src/fm2js/xfa_fm2js.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_SRC_FXFA_SRC_FM2JS_XFA_FM2JS_H_ -#define XFA_SRC_FXFA_SRC_FM2JS_XFA_FM2JS_H_ - -#include "xfa/src/fxfa/src/common/xfa_docdata.h" -#include "xfa/src/fxfa/src/common/xfa_doclayout.h" -#include "xfa/src/fxfa/src/common/xfa_document.h" -#include "xfa/src/fxfa/src/common/xfa_fm2jsapi.h" -#include "xfa/src/fxfa/src/common/xfa_localemgr.h" -#include "xfa/src/fxfa/src/common/xfa_object.h" -#include "xfa/src/fxfa/src/common/xfa_parser.h" -#include "xfa/src/fxfa/src/common/xfa_script.h" -#include "xfa/src/fxfa/src/common/xfa_utils.h" -#include "xfa/src/fxfa/src/fm2js/xfa_error.h" -#include "xfa/src/fxfa/src/fm2js/xfa_expression.h" -#include "xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.h" -#include "xfa/src/fxfa/src/fm2js/xfa_fmparse.h" -#include "xfa/src/fxfa/src/fm2js/xfa_lexer.h" -#include "xfa/src/fxfa/src/fm2js/xfa_program.h" -#include "xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h" - -#define RUNTIMEFUNCTIONRETURNVALUE \ - (FX_WSTRC(L"foxit_xfa_formcalc_runtime_func_return_value")) -#define EXCLAMATION_IN_IDENTIFIER \ - (FX_WSTRC(L"foxit_xfa_formcalc__exclamation__")) - -#endif // XFA_SRC_FXFA_SRC_FM2JS_XFA_FM2JS_H_ diff --git a/xfa/src/fxfa/src/fm2js/xfa_fm2jsapi.cpp b/xfa/src/fxfa/src/fm2js/xfa_fm2jsapi.cpp index 4aa39d8f09..146a4a3643 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_fm2jsapi.cpp +++ b/xfa/src/fxfa/src/fm2js/xfa_fm2jsapi.cpp @@ -4,10 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/src/fxfa/src/fm2js/xfa_fm2js.h" +#include "xfa/src/fxfa/src/common/xfa_fm2jsapi.h" + +#include "core/include/fxcrt/fx_basic.h" +#include "xfa/src/fxfa/src/common/xfa_document.h" +#include "xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.h" +#include "xfa/src/fxfa/src/fm2js/xfa_program.h" + #ifdef __cplusplus extern "C" { #endif + int32_t XFA_FM2JS_Translate(const CFX_WideStringC& wsFormcalc, CFX_WideTextBuf& wsJavascript, CFX_WideString& wsError) { diff --git a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp index 10f9e8aab4..1c80e62cf9 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp @@ -4,11 +4,16 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.h" + #include #include "core/include/fxcrt/fx_ext.h" +#include "xfa/src/fgas/include/fx_locale.h" #include "xfa/src/fxfa/src/common/fxfa_localevalue.h" -#include "xfa/src/fxfa/src/fm2js/xfa_fm2js.h" +#include "xfa/src/fxfa/src/common/xfa_document.h" +#include "xfa/src/fxfa/src/common/xfa_fm2jsapi.h" +#include "xfa/src/fxfa/src/common/xfa_parser.h" #define FINANCIAL_PRECISION 0.00000001 diff --git a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.h b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.h index 75d3b15583..da6df4f102 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.h +++ b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.h @@ -7,6 +7,8 @@ #ifndef XFA_SRC_FXFA_SRC_FM2JS_XFA_FM2JSCONTEXT_H_ #define XFA_SRC_FXFA_SRC_FM2JS_XFA_FM2JSCONTEXT_H_ +#include "xfa/src/fxfa/src/common/xfa_script.h" + class CXFA_FM2JSContext { public: static void Abs(FXJSE_HOBJECT hThis, diff --git a/xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp b/xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp index c5f6efb4f5..6841cdaca5 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp +++ b/xfa/src/fxfa/src/fm2js/xfa_fmparse.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/src/fxfa/src/fm2js/xfa_fm2js.h" +#include "xfa/src/fxfa/src/fm2js/xfa_fmparse.h" #include diff --git a/xfa/src/fxfa/src/fm2js/xfa_fmparse.h b/xfa/src/fxfa/src/fm2js/xfa_fmparse.h index bac6729795..3b8a0586f3 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_fmparse.h +++ b/xfa/src/fxfa/src/fm2js/xfa_fmparse.h @@ -9,6 +9,7 @@ #include +#include "xfa/src/fxfa/src/fm2js/xfa_expression.h" #include "xfa/src/fxfa/src/fm2js/xfa_lexer.h" class CXFA_FMParse { diff --git a/xfa/src/fxfa/src/fm2js/xfa_lexer.cpp b/xfa/src/fxfa/src/fm2js/xfa_lexer.cpp index caaeb49474..0afdeb6e9f 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_lexer.cpp +++ b/xfa/src/fxfa/src/fm2js/xfa_lexer.cpp @@ -4,8 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "xfa/src/fxfa/src/fm2js/xfa_lexer.h" + #include "core/include/fxcrt/fx_ext.h" -#include "xfa/src/fxfa/src/fm2js/xfa_fm2js.h" namespace { diff --git a/xfa/src/fxfa/src/fm2js/xfa_lexer.h b/xfa/src/fxfa/src/fm2js/xfa_lexer.h index ccfa9f546e..841d27307a 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_lexer.h +++ b/xfa/src/fxfa/src/fm2js/xfa_lexer.h @@ -9,6 +9,9 @@ #include +#include "core/include/fxcrt/fx_string.h" +#include "xfa/src/fxfa/src/fm2js/xfa_error.h" + enum XFA_FM_TOKEN { TOKand, TOKlparen, diff --git a/xfa/src/fxfa/src/fm2js/xfa_program.cpp b/xfa/src/fxfa/src/fm2js/xfa_program.cpp index 03462d2f01..fe592dcbd7 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_program.cpp +++ b/xfa/src/fxfa/src/fm2js/xfa_program.cpp @@ -4,7 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/src/fxfa/src/fm2js/xfa_fm2js.h" +#include "xfa/src/fxfa/src/fm2js/xfa_program.h" + CXFA_FMProgram::CXFA_FMProgram() : m_globalFunction(0) {} CXFA_FMProgram::~CXFA_FMProgram() { if (m_globalFunction != 0) { diff --git a/xfa/src/fxfa/src/fm2js/xfa_program.h b/xfa/src/fxfa/src/fm2js/xfa_program.h index 6f3a390991..e1f62bbed8 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_program.h +++ b/xfa/src/fxfa/src/fm2js/xfa_program.h @@ -7,6 +7,9 @@ #ifndef XFA_SRC_FXFA_SRC_FM2JS_XFA_PROGRAM_H_ #define XFA_SRC_FXFA_SRC_FM2JS_XFA_PROGRAM_H_ +#include "xfa/src/fxfa/src/fm2js/xfa_error.h" +#include "xfa/src/fxfa/src/fm2js/xfa_fmparse.h" + class CXFA_FMProgram { public: CXFA_FMProgram(); diff --git a/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.cpp b/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.cpp index e1da83747d..a8f6ad135d 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.cpp +++ b/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.cpp @@ -4,8 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h" + #include "core/include/fxcrt/fx_ext.h" -#include "xfa/src/fxfa/src/fm2js/xfa_fm2js.h" namespace { diff --git a/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h b/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h index 2fb9b8fc1c..bc84ab784d 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h +++ b/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h @@ -7,8 +7,14 @@ #ifndef XFA_SRC_FXFA_SRC_FM2JS_XFA_SIMPLEEXPRESSION_H_ #define XFA_SRC_FXFA_SRC_FM2JS_XFA_SIMPLEEXPRESSION_H_ +#include "core/include/fxcrt/fx_basic.h" #include "xfa/src/fxfa/src/fm2js/xfa_lexer.h" +#define RUNTIMEFUNCTIONRETURNVALUE \ + (FX_WSTRC(L"foxit_xfa_formcalc_runtime_func_return_value")) +#define EXCLAMATION_IN_IDENTIFIER \ + (FX_WSTRC(L"foxit_xfa_formcalc__exclamation__")) + enum XFA_FM_SimpleExpressionType { ASSIGN, LOGICALOR, -- cgit v1.2.3