From cfb1944e245e20fe2ce0e94feebc06526db34fa1 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 20 Apr 2017 13:13:04 -0400 Subject: Cleanup the fx_extension code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL cleans up the fx_extension file. The stream code was moved to fx_stream. IFX_FileAccess was removed and CFX_CRTFileAccess split to its own file. Code shuffled from header to cpp file. Change-Id: I700fdfcc9797cf4e8050cd9ba010ad8854feefbf Reviewed-on: https://pdfium-review.googlesource.com/4371 Reviewed-by: Nicolás Peña Commit-Queue: dsinclair --- BUILD.gn | 7 +- core/fpdfapi/edit/fpdf_edit_create.cpp | 2 +- core/fpdfapi/font/fpdf_font.cpp | 2 +- core/fpdfapi/font/fpdf_font_cid.cpp | 2 +- core/fpdfapi/page/cpdf_streamparser.cpp | 2 +- core/fpdfapi/parser/cpdf_data_avail.cpp | 2 +- core/fpdfapi/parser/cpdf_parser.cpp | 2 +- core/fpdfapi/parser/cpdf_parser_unittest.cpp | 2 +- core/fpdfapi/parser/cpdf_syntax_parser.cpp | 2 +- .../fpdfapi/parser/cpdf_syntax_parser_unittest.cpp | 2 +- core/fpdfapi/parser/fpdf_parser_decode.cpp | 2 +- core/fpdfapi/parser/fpdf_parser_utility.cpp | 2 +- core/fpdftext/cpdf_linkextract.cpp | 2 +- core/fpdftext/cpdf_textpage.cpp | 2 +- core/fxcodec/codec/fx_codec.cpp | 2 +- core/fxcodec/codec/fx_codec_flate.cpp | 2 +- core/fxcrt/cfx_crtfileaccess.cpp | 17 + core/fxcrt/cfx_crtfileaccess.h | 28 ++ core/fxcrt/cfx_seekablestreamproxy.cpp | 2 +- core/fxcrt/cfx_widestring.cpp | 2 +- core/fxcrt/extension.h | 61 --- core/fxcrt/fx_basic_coords.cpp | 2 +- core/fxcrt/fx_basic_gcc.cpp | 2 +- core/fxcrt/fx_basic_util.cpp | 2 +- core/fxcrt/fx_ext.h | 108 ----- core/fxcrt/fx_extension.cpp | 523 +++------------------ core/fxcrt/fx_extension.h | 103 ++++ core/fxcrt/fx_extension_unittest.cpp | 3 +- core/fxcrt/fx_stream.cpp | 307 ++++++++++++ core/fxcrt/fx_stream.h | 12 - core/fxcrt/fxcrt_posix.h | 2 +- core/fxcrt/fxcrt_windows.h | 2 +- core/fxcrt/ifxcrt_fileaccess.h | 37 ++ core/fxcrt/xml/cfx_xmlattributenode.cpp | 2 +- core/fxcrt/xml/cfx_xmlelement.cpp | 2 +- core/fxcrt/xml/cfx_xmlinstruction.cpp | 2 +- core/fxcrt/xml/cfx_xmlsyntaxparser.cpp | 2 +- core/fxcrt/xml/cxml_parser.cpp | 2 +- core/fxge/android/cfpf_skiafontmgr.cpp | 2 +- core/fxge/apple/fx_quartz_device.cpp | 2 +- fpdfsdk/cpdfsdk_datetime.cpp | 2 +- fpdfsdk/fpdfsave.cpp | 2 +- fpdfsdk/javascript/PublicMethods.cpp | 2 +- fpdfsdk/javascript/global.cpp | 2 +- fpdfsdk/javascript/util.cpp | 2 +- xfa/fde/css/cfde_cssdeclaration.cpp | 2 +- xfa/fde/css/fde_cssdatatable.cpp | 2 +- xfa/fgas/crt/cfgas_formatstring.cpp | 2 +- xfa/fgas/font/cfgas_fontmgr.cpp | 8 +- xfa/fgas/font/cfgas_fontmgr.h | 5 +- xfa/fgas/font/fgas_fontutils.cpp | 2 +- xfa/fwl/cfwl_notedriver.cpp | 2 +- xfa/fxfa/app/xfa_ffbarcode.cpp | 2 +- xfa/fxfa/cxfa_ffdoc.cpp | 2 +- xfa/fxfa/cxfa_ffdocview.cpp | 2 +- xfa/fxfa/cxfa_fontmgr.h | 2 +- xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 2 +- xfa/fxfa/fm2js/xfa_lexer.cpp | 2 +- xfa/fxfa/fm2js/xfa_simpleexpression.cpp | 2 +- xfa/fxfa/parser/cxfa_data.cpp | 2 +- xfa/fxfa/parser/cxfa_document.cpp | 5 +- xfa/fxfa/parser/cxfa_localevalue.cpp | 2 +- xfa/fxfa/parser/cxfa_measurement.cpp | 2 +- xfa/fxfa/parser/cxfa_node.cpp | 2 +- xfa/fxfa/parser/cxfa_nodehelper.cpp | 2 +- xfa/fxfa/parser/cxfa_nodelist.cpp | 2 +- xfa/fxfa/parser/cxfa_object.cpp | 2 +- xfa/fxfa/parser/cxfa_resolveprocessor.cpp | 2 +- xfa/fxfa/parser/cxfa_scriptcontext.cpp | 2 +- xfa/fxfa/parser/cxfa_simple_parser.cpp | 2 +- xfa/fxfa/parser/cxfa_widgetdata.cpp | 2 +- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 2 +- xfa/fxfa/parser/xfa_utils.cpp | 2 +- 73 files changed, 623 insertions(+), 719 deletions(-) create mode 100644 core/fxcrt/cfx_crtfileaccess.cpp create mode 100644 core/fxcrt/cfx_crtfileaccess.h delete mode 100644 core/fxcrt/extension.h delete mode 100644 core/fxcrt/fx_ext.h create mode 100644 core/fxcrt/fx_extension.h create mode 100644 core/fxcrt/fx_stream.cpp create mode 100644 core/fxcrt/ifxcrt_fileaccess.h diff --git a/BUILD.gn b/BUILD.gn index 9824658194..2f8123798e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -762,7 +762,6 @@ static_library("fxcrt") { "core/fxcrt/cfx_weak_ptr.h", "core/fxcrt/cfx_widestring.cpp", "core/fxcrt/cfx_widestring.h", - "core/fxcrt/extension.h", "core/fxcrt/fx_basic.h", "core/fxcrt/fx_basic_buffer.cpp", "core/fxcrt/fx_basic_coords.cpp", @@ -774,10 +773,11 @@ static_library("fxcrt") { "core/fxcrt/fx_bidi.h", "core/fxcrt/fx_codepage.h", "core/fxcrt/fx_coordinates.h", - "core/fxcrt/fx_ext.h", "core/fxcrt/fx_extension.cpp", + "core/fxcrt/fx_extension.h", "core/fxcrt/fx_memory.h", "core/fxcrt/fx_safe_types.h", + "core/fxcrt/fx_stream.cpp", "core/fxcrt/fx_stream.h", "core/fxcrt/fx_string.h", "core/fxcrt/fx_system.h", @@ -789,6 +789,7 @@ static_library("fxcrt") { "core/fxcrt/fxcrt_stream.cpp", "core/fxcrt/fxcrt_windows.cpp", "core/fxcrt/fxcrt_windows.h", + "core/fxcrt/ifxcrt_fileaccess.h", "core/fxcrt/xml/cxml_attritem.cpp", "core/fxcrt/xml/cxml_attritem.h", "core/fxcrt/xml/cxml_attrmap.cpp", @@ -821,6 +822,8 @@ static_library("fxcrt") { "core/fxcrt/cfx_chariter.h", "core/fxcrt/cfx_checksumcontext.cpp", "core/fxcrt/cfx_checksumcontext.h", + "core/fxcrt/cfx_crtfileaccess.cpp", + "core/fxcrt/cfx_crtfileaccess.h", "core/fxcrt/cfx_datetime.cpp", "core/fxcrt/cfx_datetime.h", "core/fxcrt/cfx_decimal.cpp", diff --git a/core/fpdfapi/edit/fpdf_edit_create.cpp b/core/fpdfapi/edit/fpdf_edit_create.cpp index 38b7565960..24ec0d7b55 100644 --- a/core/fpdfapi/edit/fpdf_edit_create.cpp +++ b/core/fpdfapi/edit/fpdf_edit_create.cpp @@ -25,7 +25,7 @@ #include "core/fpdfapi/parser/fpdf_parser_decode.h" #include "core/fpdfapi/parser/fpdf_parser_utility.h" #include "core/fxcrt/cfx_maybe_owned.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/font/fpdf_font.cpp b/core/fpdfapi/font/fpdf_font.cpp index a5616ea963..6c48098c8a 100644 --- a/core/fpdfapi/font/fpdf_font.cpp +++ b/core/fpdfapi/font/fpdf_font.cpp @@ -20,7 +20,7 @@ #include "core/fpdfapi/parser/cpdf_number.h" #include "core/fpdfapi/parser/cpdf_simple_parser.h" #include "core/fpdfapi/parser/cpdf_stream_acc.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_safe_types.h" #include "core/fxge/fx_freetype.h" #include "third_party/base/numerics/safe_conversions.h" diff --git a/core/fpdfapi/font/fpdf_font_cid.cpp b/core/fpdfapi/font/fpdf_font_cid.cpp index 434fe62ede..51e7957909 100644 --- a/core/fpdfapi/font/fpdf_font_cid.cpp +++ b/core/fpdfapi/font/fpdf_font_cid.cpp @@ -16,7 +16,7 @@ #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_simple_parser.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxge/fx_freetype.h" #include "third_party/base/logging.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp index e0c6e25aef..76b58c9f4a 100644 --- a/core/fpdfapi/page/cpdf_streamparser.cpp +++ b/core/fpdfapi/page/cpdf_streamparser.cpp @@ -25,7 +25,7 @@ #include "core/fpdfapi/parser/fpdf_parser_decode.h" #include "core/fpdfapi/parser/fpdf_parser_utility.h" #include "core/fxcodec/fx_codec.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" namespace { diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index 0d6154a73b..f99cb467e5 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -21,7 +21,7 @@ #include "core/fpdfapi/parser/cpdf_reference.h" #include "core/fpdfapi/parser/cpdf_stream.h" #include "core/fpdfapi/parser/fpdf_parser_utility.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_safe_types.h" #include "third_party/base/numerics/safe_conversions.h" #include "third_party/base/ptr_util.h" diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index f009798058..c18a183a33 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -22,7 +22,7 @@ #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "core/fpdfapi/parser/cpdf_syntax_parser.h" #include "core/fpdfapi/parser/fpdf_parser_utility.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_safe_types.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/parser/cpdf_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_parser_unittest.cpp index a90477f930..bbf707a34d 100644 --- a/core/fpdfapi/parser/cpdf_parser_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_parser_unittest.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/parser/cpdf_parser.h" #include "core/fpdfapi/parser/cpdf_syntax_parser.h" #include "core/fxcrt/cfx_retain_ptr.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_stream.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/utils/path_service.h" diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp index ecf2cf6e5b..45a5a8a709 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp @@ -23,7 +23,7 @@ #include "core/fpdfapi/parser/cpdf_string.h" #include "core/fpdfapi/parser/fpdf_parser_decode.h" #include "core/fpdfapi/parser/fpdf_parser_utility.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "third_party/base/numerics/safe_math.h" #include "third_party/base/ptr_util.h" diff --git a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp index 64c33ba9cd..5c7aa6054b 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/parser/cpdf_object.h" #include "core/fpdfapi/parser/cpdf_parser.h" #include "core/fpdfapi/parser/cpdf_syntax_parser.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_stream.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/utils/path_service.h" diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp index cc8b507025..306e6fe3ac 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp @@ -17,7 +17,7 @@ #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/fpdf_parser_utility.h" #include "core/fxcodec/fx_codec.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "third_party/base/stl_util.h" namespace { diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp index d6ea1a2c50..d953d4c3e8 100644 --- a/core/fpdfapi/parser/fpdf_parser_utility.cpp +++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp @@ -15,7 +15,7 @@ #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "core/fpdfapi/parser/cpdf_string.h" #include "core/fpdfapi/parser/fpdf_parser_decode.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" // Indexed by 8-bit character code, contains either: // 'W' - for whitespace: NUL, TAB, CR, LF, FF, SPACE, 0x80, 0xff diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp index 47d0754bd2..56a3ab4ec7 100644 --- a/core/fpdftext/cpdf_linkextract.cpp +++ b/core/fpdftext/cpdf_linkextract.cpp @@ -9,7 +9,7 @@ #include #include "core/fpdftext/cpdf_textpage.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index c81d4fa407..a1f056cc37 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -20,7 +20,7 @@ #include "core/fpdfapi/parser/cpdf_string.h" #include "core/fpdftext/unicodenormalizationdata.h" #include "core/fxcrt/fx_bidi.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_ucd.h" #include "third_party/base/stl_util.h" diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp index 900fed2d87..c47231c9af 100644 --- a/core/fxcodec/codec/fx_codec.cpp +++ b/core/fxcodec/codec/fx_codec.cpp @@ -12,7 +12,7 @@ #include #include "core/fxcodec/codec/codec_int.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_safe_types.h" #include "third_party/base/logging.h" #include "third_party/base/ptr_util.h" diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp index 3747b20cc3..5af3e99c2e 100644 --- a/core/fxcodec/codec/fx_codec_flate.cpp +++ b/core/fxcodec/codec/fx_codec_flate.cpp @@ -12,7 +12,7 @@ #include #include "core/fxcodec/fx_codec.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "third_party/base/numerics/safe_conversions.h" #include "third_party/base/ptr_util.h" diff --git a/core/fxcrt/cfx_crtfileaccess.cpp b/core/fxcrt/cfx_crtfileaccess.cpp new file mode 100644 index 0000000000..ddca68e144 --- /dev/null +++ b/core/fxcrt/cfx_crtfileaccess.cpp @@ -0,0 +1,17 @@ +// Copyright 2017 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 + +#include "core/fxcrt/cfx_crtfileaccess.h" + +CFX_CRTFileAccess::CFX_CRTFileAccess(const CFX_WideStringC& wsPath) + : m_path(wsPath) {} + +CFX_CRTFileAccess::~CFX_CRTFileAccess() {} + +CFX_RetainPtr CFX_CRTFileAccess::CreateFileStream( + uint32_t dwModes) { + return IFX_SeekableStream::CreateFromFilename(m_path.c_str(), dwModes); +} diff --git a/core/fxcrt/cfx_crtfileaccess.h b/core/fxcrt/cfx_crtfileaccess.h new file mode 100644 index 0000000000..cb2a034f20 --- /dev/null +++ b/core/fxcrt/cfx_crtfileaccess.h @@ -0,0 +1,28 @@ +// Copyright 2017 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 CORE_FXCRT_CFX_CRTFILEACCESS_H_ +#define CORE_FXCRT_CFX_CRTFILEACCESS_H_ + +#include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/fx_stream.h" +#include "core/fxcrt/fx_string.h" + +class CFX_CRTFileAccess : public CFX_Retainable { + public: + template + friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + + CFX_RetainPtr CreateFileStream(uint32_t dwModes); + + private: + explicit CFX_CRTFileAccess(const CFX_WideStringC& wsPath); + ~CFX_CRTFileAccess() override; + + CFX_WideString m_path; +}; + +#endif // CORE_FXCRT_CFX_CRTFILEACCESS_H_ diff --git a/core/fxcrt/cfx_seekablestreamproxy.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp index fe6b8dd375..8be2e0898f 100644 --- a/core/fxcrt/cfx_seekablestreamproxy.cpp +++ b/core/fxcrt/cfx_seekablestreamproxy.cpp @@ -18,7 +18,7 @@ #include #include "core/fxcrt/fx_codepage.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" diff --git a/core/fxcrt/cfx_widestring.cpp b/core/fxcrt/cfx_widestring.cpp index c9a89fe112..2b98ce59a4 100644 --- a/core/fxcrt/cfx_widestring.cpp +++ b/core/fxcrt/cfx_widestring.cpp @@ -13,7 +13,7 @@ #include "core/fxcrt/cfx_string_pool_template.h" #include "core/fxcrt/fx_basic.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_safe_types.h" #include "third_party/base/numerics/safe_math.h" #include "third_party/base/stl_util.h" diff --git a/core/fxcrt/extension.h b/core/fxcrt/extension.h deleted file mode 100644 index b62f67772b..0000000000 --- a/core/fxcrt/extension.h +++ /dev/null @@ -1,61 +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 CORE_FXCRT_EXTENSION_H_ -#define CORE_FXCRT_EXTENSION_H_ - -#include -#include - -#include "core/fxcrt/fx_basic.h" -#include "core/fxcrt/fx_safe_types.h" - -class IFXCRT_FileAccess { - public: - static IFXCRT_FileAccess* Create(); - virtual ~IFXCRT_FileAccess() {} - - virtual bool Open(const CFX_ByteStringC& fileName, uint32_t dwMode) = 0; - virtual bool Open(const CFX_WideStringC& fileName, uint32_t dwMode) = 0; - virtual void Close() = 0; - virtual FX_FILESIZE GetSize() const = 0; - virtual FX_FILESIZE GetPosition() const = 0; - virtual FX_FILESIZE SetPosition(FX_FILESIZE pos) = 0; - virtual size_t Read(void* pBuffer, size_t szBuffer) = 0; - virtual size_t Write(const void* pBuffer, size_t szBuffer) = 0; - virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos) = 0; - virtual size_t WritePos(const void* pBuffer, - size_t szBuffer, - FX_FILESIZE pos) = 0; - virtual bool Flush() = 0; - virtual bool Truncate(FX_FILESIZE szFile) = 0; -}; - -#ifdef __cplusplus -extern "C" { -#endif -#define MT_N 848 -#define MT_M 456 -#define MT_Matrix_A 0x9908b0df -#define MT_Upper_Mask 0x80000000 -#define MT_Lower_Mask 0x7fffffff -struct FX_MTRANDOMCONTEXT { - FX_MTRANDOMCONTEXT() { - mti = MT_N + 1; - bHaveSeed = false; - } - uint32_t mti; - bool bHaveSeed; - uint32_t mt[MT_N]; -}; -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -bool FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount); -#endif -#ifdef __cplusplus -} -#endif - -#endif // CORE_FXCRT_EXTENSION_H_ diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp index 71a15c0cec..f4f369a746 100644 --- a/core/fxcrt/fx_basic_coords.cpp +++ b/core/fxcrt/fx_basic_coords.cpp @@ -8,7 +8,7 @@ #include #include "core/fxcrt/fx_coordinates.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" namespace { diff --git a/core/fxcrt/fx_basic_gcc.cpp b/core/fxcrt/fx_basic_gcc.cpp index 2033265f10..c42b762daf 100644 --- a/core/fxcrt/fx_basic_gcc.cpp +++ b/core/fxcrt/fx_basic_gcc.cpp @@ -8,7 +8,7 @@ #include #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_string.h" template diff --git a/core/fxcrt/fx_basic_util.cpp b/core/fxcrt/fx_basic_util.cpp index 58d54a3b10..ee3e9e7fd5 100644 --- a/core/fxcrt/fx_basic_util.cpp +++ b/core/fxcrt/fx_basic_util.cpp @@ -10,7 +10,7 @@ #include #include "core/fxcrt/fx_basic.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "third_party/base/ptr_util.h" bool FX_atonum(const CFX_ByteStringC& strc, void* pData) { diff --git a/core/fxcrt/fx_ext.h b/core/fxcrt/fx_ext.h deleted file mode 100644 index 8224087d88..0000000000 --- a/core/fxcrt/fx_ext.h +++ /dev/null @@ -1,108 +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 CORE_FXCRT_FX_EXT_H_ -#define CORE_FXCRT_FX_EXT_H_ - -#include -#include -#include - -#include "core/fxcrt/fx_basic.h" - -#define FX_INVALID_OFFSET static_cast(-1) - -float FXSYS_strtof(const char* pcsStr, - int32_t iLength = -1, - int32_t* pUsedLen = nullptr); -float FXSYS_wcstof(const wchar_t* pwsStr, - int32_t iLength = -1, - int32_t* pUsedLen = nullptr); -wchar_t* FXSYS_wcsncpy(wchar_t* dstStr, const wchar_t* srcStr, size_t count); -int32_t FXSYS_wcsnicmp(const wchar_t* s1, const wchar_t* s2, size_t count); -int32_t FXSYS_strnicmp(const char* s1, const char* s2, size_t count); - -inline bool FXSYS_islower(int32_t ch) { - return ch >= 'a' && ch <= 'z'; -} - -inline bool FXSYS_isupper(int32_t ch) { - return ch >= 'A' && ch <= 'Z'; -} - -inline int32_t FXSYS_tolower(int32_t ch) { - return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20); -} - -inline int32_t FXSYS_toupper(int32_t ch) { - return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); -} - -inline bool FXSYS_iswalpha(wchar_t wch) { - return (wch >= L'A' && wch <= L'Z') || (wch >= L'a' && wch <= L'z'); -} - -inline bool FXSYS_iswdigit(wchar_t wch) { - return wch >= L'0' && wch <= L'9'; -} - -inline bool FXSYS_iswalnum(wchar_t wch) { - return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch); -} - -inline bool FXSYS_iswspace(wchar_t c) { - return (c == 0x20) || (c == 0x0d) || (c == 0x0a) || (c == 0x09); -} - -inline bool FXSYS_isHexDigit(const char c) { - return !((c & 0x80) || !std::isxdigit(c)); -} - -inline int FXSYS_toHexDigit(const char c) { - if (!FXSYS_isHexDigit(c)) - return 0; - char upchar = std::toupper(c); - return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; -} - -inline bool FXSYS_isDecimalDigit(const char c) { - return !((c & 0x80) || !std::isdigit(c)); -} - -inline bool FXSYS_isDecimalDigit(const wchar_t c) { - return !!std::iswdigit(c); -} - -inline int FXSYS_toDecimalDigit(const char c) { - return FXSYS_isDecimalDigit(c) ? c - '0' : 0; -} - -inline int FXSYS_toDecimalDigit(const wchar_t c) { - return std::iswdigit(c) ? c - L'0' : 0; -} - -float FXSYS_FractionalScale(size_t scale_factor, int value); -int FXSYS_FractionalScaleCount(); - -void* FX_Random_MT_Start(uint32_t dwSeed); -void FX_Random_MT_Close(void* pContext); -uint32_t FX_Random_MT_Generate(void* pContext); -void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount); -void FX_Random_GenerateMT(uint32_t* pBuffer, int32_t iCount); -void FX_Random_GenerateCrypto(uint32_t* pBuffer, int32_t iCount); - -#ifdef PDF_ENABLE_XFA -struct FX_GUID { - uint32_t data1; - uint16_t data2; - uint16_t data3; - uint8_t data4[8]; -}; -void FX_GUID_CreateV4(FX_GUID* pGUID); -CFX_ByteString FX_GUID_ToString(const FX_GUID* pGUID, bool bSeparator = true); -#endif // PDF_ENABLE_XFA - -#endif // CORE_FXCRT_FX_EXT_H_ diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index f3e72fd6df..47bd937ff8 100644 --- a/core/fxcrt/fx_extension.cpp +++ b/core/fxcrt/fx_extension.cpp @@ -4,16 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fxcrt/extension.h" - -#include -#include -#include -#include - -#include "core/fxcrt/fx_basic.h" -#include "core/fxcrt/fx_ext.h" -#include "third_party/base/stl_util.h" +#include "core/fxcrt/fx_extension.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ #include @@ -21,422 +12,48 @@ #include #endif -namespace { - -#ifdef PDF_ENABLE_XFA - -class CFX_CRTFileAccess : public IFX_FileAccess { - public: - template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); - - // IFX_FileAccess - void GetPath(CFX_WideString& wsPath) override; - CFX_RetainPtr CreateFileStream(uint32_t dwModes) override; - - bool Init(const CFX_WideStringC& wsPath); - - private: - CFX_CRTFileAccess(); - ~CFX_CRTFileAccess() override; - - CFX_WideString m_path; -}; - -CFX_CRTFileAccess::CFX_CRTFileAccess() {} - -CFX_CRTFileAccess::~CFX_CRTFileAccess() {} - -void CFX_CRTFileAccess::GetPath(CFX_WideString& wsPath) { - wsPath = m_path; -} - -CFX_RetainPtr CFX_CRTFileAccess::CreateFileStream( - uint32_t dwModes) { - return IFX_SeekableStream::CreateFromFilename(m_path.c_str(), dwModes); -} - -bool CFX_CRTFileAccess::Init(const CFX_WideStringC& wsPath) { - m_path = wsPath; - return true; -} - -#endif // PDF_ENABLE_XFA - -class CFX_CRTFileStream final : public IFX_SeekableStream { - public: - template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); - - // IFX_SeekableStream: - FX_FILESIZE GetSize() override; - bool IsEOF() override; - FX_FILESIZE GetPosition() override; - bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; - size_t ReadBlock(void* buffer, size_t size) override; - bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override; - bool Flush() override; - - private: - explicit CFX_CRTFileStream(std::unique_ptr pFA); - ~CFX_CRTFileStream() override; - - std::unique_ptr m_pFile; -}; - -CFX_CRTFileStream::CFX_CRTFileStream(std::unique_ptr pFA) - : m_pFile(std::move(pFA)) {} - -CFX_CRTFileStream::~CFX_CRTFileStream() {} - -FX_FILESIZE CFX_CRTFileStream::GetSize() { - return m_pFile->GetSize(); -} - -bool CFX_CRTFileStream::IsEOF() { - return GetPosition() >= GetSize(); -} - -FX_FILESIZE CFX_CRTFileStream::GetPosition() { - return m_pFile->GetPosition(); -} - -bool CFX_CRTFileStream::ReadBlock(void* buffer, - FX_FILESIZE offset, - size_t size) { - return m_pFile->ReadPos(buffer, size, offset) > 0; -} - -size_t CFX_CRTFileStream::ReadBlock(void* buffer, size_t size) { - return m_pFile->Read(buffer, size); -} - -bool CFX_CRTFileStream::WriteBlock(const void* buffer, - FX_FILESIZE offset, - size_t size) { - return !!m_pFile->WritePos(buffer, size, offset); -} - -bool CFX_CRTFileStream::Flush() { - return m_pFile->Flush(); -} - -#define FX_MEMSTREAM_BlockSize (64 * 1024) -#define FX_MEMSTREAM_Consecutive 0x01 -#define FX_MEMSTREAM_TakeOver 0x02 - -class CFX_MemoryStream final : public IFX_MemoryStream { - public: - template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); - - // IFX_MemoryStream - FX_FILESIZE GetSize() override; - bool IsEOF() override; - FX_FILESIZE GetPosition() override; - bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; - size_t ReadBlock(void* buffer, size_t size) override; - bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override; - bool Flush() override; - bool IsConsecutive() const override; - void EstimateSize(size_t nInitSize, size_t nGrowSize) override; - uint8_t* GetBuffer() const override; - void AttachBuffer(uint8_t* pBuffer, - size_t nSize, - bool bTakeOver = false) override; - void DetachBuffer() override; - - private: - explicit CFX_MemoryStream(bool bConsecutive); - CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, bool bTakeOver); - ~CFX_MemoryStream() override; +#define MT_N 848 +#define MT_M 456 +#define MT_Matrix_A 0x9908b0df +#define MT_Upper_Mask 0x80000000 +#define MT_Lower_Mask 0x7fffffff - bool ExpandBlocks(size_t size); - - std::vector m_Blocks; - size_t m_nTotalSize; - size_t m_nCurSize; - size_t m_nCurPos; - size_t m_nGrowSize; - uint32_t m_dwFlags; -}; - -CFX_MemoryStream::CFX_MemoryStream(bool bConsecutive) - : m_nTotalSize(0), - m_nCurSize(0), - m_nCurPos(0), - m_nGrowSize(FX_MEMSTREAM_BlockSize) { - m_dwFlags = - FX_MEMSTREAM_TakeOver | (bConsecutive ? FX_MEMSTREAM_Consecutive : 0); -} - -CFX_MemoryStream::CFX_MemoryStream(uint8_t* pBuffer, - size_t nSize, - bool bTakeOver) - : m_nTotalSize(nSize), - m_nCurSize(nSize), - m_nCurPos(0), - m_nGrowSize(FX_MEMSTREAM_BlockSize) { - m_Blocks.push_back(pBuffer); - m_dwFlags = - FX_MEMSTREAM_Consecutive | (bTakeOver ? FX_MEMSTREAM_TakeOver : 0); -} - -CFX_MemoryStream::~CFX_MemoryStream() { - if (m_dwFlags & FX_MEMSTREAM_TakeOver) { - for (uint8_t* pBlock : m_Blocks) - FX_Free(pBlock); - } -} - -FX_FILESIZE CFX_MemoryStream::GetSize() { - return (FX_FILESIZE)m_nCurSize; -} - -bool CFX_MemoryStream::IsEOF() { - return m_nCurPos >= (size_t)GetSize(); -} - -FX_FILESIZE CFX_MemoryStream::GetPosition() { - return (FX_FILESIZE)m_nCurPos; -} - -bool CFX_MemoryStream::ReadBlock(void* buffer, - FX_FILESIZE offset, - size_t size) { - if (!buffer || !size || offset < 0) - return false; - - FX_SAFE_SIZE_T newPos = size; - newPos += offset; - if (!newPos.IsValid() || newPos.ValueOrDefault(0) == 0 || - newPos.ValueOrDie() > m_nCurSize) { - return false; - } - - m_nCurPos = newPos.ValueOrDie(); - if (m_dwFlags & FX_MEMSTREAM_Consecutive) { - memcpy(buffer, m_Blocks[0] + (size_t)offset, size); - return true; - } - size_t nStartBlock = (size_t)offset / m_nGrowSize; - offset -= (FX_FILESIZE)(nStartBlock * m_nGrowSize); - while (size) { - size_t nRead = m_nGrowSize - (size_t)offset; - if (nRead > size) { - nRead = size; - } - memcpy(buffer, m_Blocks[(int)nStartBlock] + (size_t)offset, nRead); - buffer = ((uint8_t*)buffer) + nRead; - size -= nRead; - nStartBlock++; - offset = 0; - } - return true; -} +namespace { -size_t CFX_MemoryStream::ReadBlock(void* buffer, size_t size) { - if (m_nCurPos >= m_nCurSize) { - return 0; - } - size_t nRead = std::min(size, m_nCurSize - m_nCurPos); - if (!ReadBlock(buffer, (int32_t)m_nCurPos, nRead)) { - return 0; +struct FX_MTRANDOMCONTEXT { + FX_MTRANDOMCONTEXT() { + mti = MT_N + 1; + bHaveSeed = false; } - return nRead; -} -bool CFX_MemoryStream::WriteBlock(const void* buffer, - FX_FILESIZE offset, - size_t size) { - if (!buffer || !size) - return false; - - if (m_dwFlags & FX_MEMSTREAM_Consecutive) { - FX_SAFE_SIZE_T newPos = size; - newPos += offset; - if (!newPos.IsValid()) - return false; - - m_nCurPos = newPos.ValueOrDie(); - if (m_nCurPos > m_nTotalSize) { - m_nTotalSize = (m_nCurPos + m_nGrowSize - 1) / m_nGrowSize * m_nGrowSize; - if (m_Blocks.empty()) { - m_Blocks.push_back(FX_Alloc(uint8_t, m_nTotalSize)); - } else { - m_Blocks[0] = FX_Realloc(uint8_t, m_Blocks[0], m_nTotalSize); - } - } - memcpy(m_Blocks[0] + (size_t)offset, buffer, size); - if (m_nCurSize < m_nCurPos) { - m_nCurSize = m_nCurPos; - } - return true; - } - - FX_SAFE_SIZE_T newPos = size; - newPos += offset; - if (!newPos.IsValid()) { - return false; - } + uint32_t mti; + bool bHaveSeed; + uint32_t mt[MT_N]; +}; - if (!ExpandBlocks(newPos.ValueOrDie())) { +#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +bool GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount) { + HCRYPTPROV hCP = 0; + if (!::CryptAcquireContext(&hCP, nullptr, nullptr, PROV_RSA_FULL, 0) || + !hCP) { return false; } - m_nCurPos = newPos.ValueOrDie(); - size_t nStartBlock = (size_t)offset / m_nGrowSize; - offset -= (FX_FILESIZE)(nStartBlock * m_nGrowSize); - while (size) { - size_t nWrite = m_nGrowSize - (size_t)offset; - if (nWrite > size) { - nWrite = size; - } - memcpy(m_Blocks[(int)nStartBlock] + (size_t)offset, buffer, nWrite); - buffer = ((uint8_t*)buffer) + nWrite; - size -= nWrite; - nStartBlock++; - offset = 0; - } - return true; -} - -bool CFX_MemoryStream::Flush() { - return true; -} - -bool CFX_MemoryStream::IsConsecutive() const { - return !!(m_dwFlags & FX_MEMSTREAM_Consecutive); -} - -void CFX_MemoryStream::EstimateSize(size_t nInitSize, size_t nGrowSize) { - if (m_dwFlags & FX_MEMSTREAM_Consecutive) { - if (m_Blocks.empty()) { - m_Blocks.push_back( - FX_Alloc(uint8_t, std::max(nInitSize, static_cast(4096)))); - } - m_nGrowSize = std::max(nGrowSize, static_cast(4096)); - } else if (m_Blocks.empty()) { - m_nGrowSize = std::max(nGrowSize, static_cast(4096)); - } -} - -uint8_t* CFX_MemoryStream::GetBuffer() const { - return !m_Blocks.empty() ? m_Blocks.front() : nullptr; -} - -void CFX_MemoryStream::AttachBuffer(uint8_t* pBuffer, - size_t nSize, - bool bTakeOver) { - if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) - return; - - m_Blocks.clear(); - m_Blocks.push_back(pBuffer); - m_nTotalSize = nSize; - m_nCurSize = nSize; - m_nCurPos = 0; - m_dwFlags = - FX_MEMSTREAM_Consecutive | (bTakeOver ? FX_MEMSTREAM_TakeOver : 0); -} - -void CFX_MemoryStream::DetachBuffer() { - if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) - return; - - m_Blocks.clear(); - m_nTotalSize = 0; - m_nCurSize = 0; - m_nCurPos = 0; - m_dwFlags = FX_MEMSTREAM_TakeOver; -} - -bool CFX_MemoryStream::ExpandBlocks(size_t size) { - if (m_nCurSize < size) - m_nCurSize = size; - - if (size <= m_nTotalSize) - return true; - - size = (size - m_nTotalSize + m_nGrowSize - 1) / m_nGrowSize; - size_t iCount = m_Blocks.size(); - m_Blocks.resize(iCount + size); - while (size--) { - m_Blocks[iCount++] = FX_Alloc(uint8_t, m_nGrowSize); - m_nTotalSize += m_nGrowSize; - } + ::CryptGenRandom(hCP, iCount * sizeof(uint32_t), + reinterpret_cast(pBuffer)); + ::CryptReleaseContext(hCP, 0); return true; } +#endif } // namespace -#ifdef PDF_ENABLE_XFA -CFX_RetainPtr IFX_FileAccess::CreateDefault( - const CFX_WideStringC& wsPath) { - if (wsPath.GetLength() == 0) - return nullptr; - - auto pFA = pdfium::MakeRetain(); - pFA->Init(wsPath); - return pFA; -} -#endif // PDF_ENABLE_XFA - -// static -CFX_RetainPtr IFX_SeekableStream::CreateFromFilename( - const char* filename, - uint32_t dwModes) { - std::unique_ptr pFA(IFXCRT_FileAccess::Create()); - if (!pFA->Open(filename, dwModes)) - return nullptr; - return pdfium::MakeRetain(std::move(pFA)); -} - -// static -CFX_RetainPtr IFX_SeekableStream::CreateFromFilename( - const wchar_t* filename, - uint32_t dwModes) { - std::unique_ptr pFA(IFXCRT_FileAccess::Create()); - if (!pFA->Open(filename, dwModes)) - return nullptr; - return pdfium::MakeRetain(std::move(pFA)); -} - -// static -CFX_RetainPtr -IFX_SeekableReadStream::CreateFromFilename(const char* filename) { - return IFX_SeekableStream::CreateFromFilename(filename, FX_FILEMODE_ReadOnly); -} - -// static -CFX_RetainPtr IFX_MemoryStream::Create(uint8_t* pBuffer, - size_t dwSize, - bool bTakeOver) { - return pdfium::MakeRetain(pBuffer, dwSize, bTakeOver); -} - -// static -CFX_RetainPtr IFX_MemoryStream::Create(bool bConsecutive) { - return pdfium::MakeRetain(bConsecutive); -} - -float FXSYS_strtof(const char* pcsStr, int32_t iLength, int32_t* pUsedLen) { - ASSERT(pcsStr); - if (iLength < 0) { - iLength = (int32_t)FXSYS_strlen(pcsStr); - } - CFX_WideString ws = - CFX_WideString::FromLocal(CFX_ByteStringC(pcsStr, iLength)); - return FXSYS_wcstof(ws.c_str(), iLength, pUsedLen); -} - float FXSYS_wcstof(const wchar_t* pwsStr, int32_t iLength, int32_t* pUsedLen) { ASSERT(pwsStr); - if (iLength < 0) { - iLength = (int32_t)FXSYS_wcslen(pwsStr); - } - if (iLength == 0) { + if (iLength < 0) + iLength = static_cast(FXSYS_wcslen(pwsStr)); + if (iLength == 0) return 0.0f; - } + int32_t iUsedLen = 0; bool bNegtive = false; switch (pwsStr[iUsedLen]) { @@ -446,16 +63,18 @@ float FXSYS_wcstof(const wchar_t* pwsStr, int32_t iLength, int32_t* pUsedLen) { iUsedLen++; break; } + float fValue = 0.0f; while (iUsedLen < iLength) { wchar_t wch = pwsStr[iUsedLen]; - if (wch >= L'0' && wch <= L'9') { + if (wch >= L'0' && wch <= L'9') fValue = fValue * 10.0f + (wch - L'0'); - } else { + else break; - } + iUsedLen++; } + if (iUsedLen < iLength && pwsStr[iUsedLen] == L'.') { float fPrecise = 0.1f; while (++iUsedLen < iLength) { @@ -468,43 +87,31 @@ float FXSYS_wcstof(const wchar_t* pwsStr, int32_t iLength, int32_t* pUsedLen) { } } } - if (pUsedLen) { + if (pUsedLen) *pUsedLen = iUsedLen; - } + return bNegtive ? -fValue : fValue; } + wchar_t* FXSYS_wcsncpy(wchar_t* dstStr, const wchar_t* srcStr, size_t count) { ASSERT(dstStr && srcStr && count > 0); for (size_t i = 0; i < count; ++i) - if ((dstStr[i] = srcStr[i]) == L'\0') { + if ((dstStr[i] = srcStr[i]) == L'\0') break; - } return dstStr; } + int32_t FXSYS_wcsnicmp(const wchar_t* s1, const wchar_t* s2, size_t count) { ASSERT(s1 && s2 && count > 0); wchar_t wch1 = 0, wch2 = 0; while (count-- > 0) { - wch1 = (wchar_t)FXSYS_tolower(*s1++); - wch2 = (wchar_t)FXSYS_tolower(*s2++); - if (wch1 != wch2) { + wch1 = static_cast(FXSYS_tolower(*s1++)); + wch2 = static_cast(FXSYS_tolower(*s2++)); + if (wch1 != wch2) break; - } } return wch1 - wch2; } -int32_t FXSYS_strnicmp(const char* s1, const char* s2, size_t count) { - ASSERT(s1 && s2 && count > 0); - char ch1 = 0, ch2 = 0; - while (count-- > 0) { - ch1 = (char)FXSYS_tolower(*s1++); - ch2 = (char)FXSYS_tolower(*s2++); - if (ch1 != ch2) { - break; - } - } - return ch1 - ch2; -} uint32_t FX_HashCode_GetA(const CFX_ByteStringC& str, bool bIgnoreCase) { uint32_t dwHashCode = 0; @@ -535,12 +142,13 @@ void* FX_Random_MT_Start(uint32_t dwSeed) { pContext->mt[0] = dwSeed; uint32_t& i = pContext->mti; uint32_t* pBuf = pContext->mt; - for (i = 1; i < MT_N; i++) { + for (i = 1; i < MT_N; i++) pBuf[i] = (1812433253UL * (pBuf[i - 1] ^ (pBuf[i - 1] >> 30)) + i); - } + pContext->bHaveSeed = true; return pContext; } + uint32_t FX_Random_MT_Generate(void* pContext) { ASSERT(pContext); FX_MTRANDOMCONTEXT* pMTC = static_cast(pContext); @@ -549,9 +157,9 @@ uint32_t FX_Random_MT_Generate(void* pContext) { uint32_t& mti = pMTC->mti; uint32_t* pBuf = pMTC->mt; if ((int)mti < 0 || mti >= MT_N) { - if (mti > MT_N && !pMTC->bHaveSeed) { + if (mti > MT_N && !pMTC->bHaveSeed) return 0; - } + uint32_t kk; for (kk = 0; kk < MT_N - MT_M; kk++) { v = (pBuf[kk] & MT_Upper_Mask) | (pBuf[kk + 1] & MT_Lower_Mask); @@ -572,25 +180,27 @@ uint32_t FX_Random_MT_Generate(void* pContext) { v ^= (v >> 18); return v; } + void FX_Random_MT_Close(void* pContext) { ASSERT(pContext); FX_Free(pContext); } + void FX_Random_GenerateMT(uint32_t* pBuffer, int32_t iCount) { uint32_t dwSeed; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - if (!FX_GenerateCryptoRandom(&dwSeed, 1)) { + if (!GenerateCryptoRandom(&dwSeed, 1)) FX_Random_GenerateBase(&dwSeed, 1); - } #else FX_Random_GenerateBase(&dwSeed, 1); #endif void* pContext = FX_Random_MT_Start(dwSeed); - while (iCount-- > 0) { + while (iCount-- > 0) *pBuffer++ = FX_Random_MT_Generate(pContext); - } + FX_Random_MT_Close(pContext); } + void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ SYSTEMTIME st1, st2; @@ -606,34 +216,13 @@ void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount) { #else time_t tmLast = time(nullptr); time_t tmCur; - while ((tmCur = time(nullptr)) == tmLast) { + while ((tmCur = time(nullptr)) == tmLast) continue; - } ::srand((tmCur << 16) | (tmLast & 0xFFFF)); #endif - while (iCount-- > 0) { - *pBuffer++ = (uint32_t)((::rand() << 16) | (::rand() & 0xFFFF)); - } -} -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -bool FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount) { - HCRYPTPROV hCP = 0; - if (!::CryptAcquireContext(&hCP, nullptr, nullptr, PROV_RSA_FULL, 0) || - !hCP) { - return false; - } - ::CryptGenRandom(hCP, iCount * sizeof(uint32_t), (uint8_t*)pBuffer); - ::CryptReleaseContext(hCP, 0); - return true; -} -#endif -void FX_Random_GenerateCrypto(uint32_t* pBuffer, int32_t iCount) { -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_GenerateCryptoRandom(pBuffer, iCount); -#else - FX_Random_GenerateBase(pBuffer, iCount); -#endif + while (iCount-- > 0) + *pBuffer++ = static_cast((::rand() << 16) | (::rand() & 0xFFFF)); } #ifdef PDF_ENABLE_XFA @@ -654,7 +243,7 @@ CFX_ByteString FX_GUID_ToString(const FX_GUID* pGUID, bool bSeparator) { *pBuf++ = gs_FX_pHexChars[b & 0x0F]; if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) *pBuf++ = L'-'; - } + } bsStr.ReleaseBuffer(bSeparator ? 36 : 32); return bsStr; } diff --git a/core/fxcrt/fx_extension.h b/core/fxcrt/fx_extension.h new file mode 100644 index 0000000000..e9d16786a9 --- /dev/null +++ b/core/fxcrt/fx_extension.h @@ -0,0 +1,103 @@ +// 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 CORE_FXCRT_FX_EXTENSION_H_ +#define CORE_FXCRT_FX_EXTENSION_H_ + +#include +#include +#include + +#include "core/fxcrt/fx_basic.h" + +#define FX_INVALID_OFFSET static_cast(-1) + +float FXSYS_wcstof(const wchar_t* pwsStr, + int32_t iLength = -1, + int32_t* pUsedLen = nullptr); +wchar_t* FXSYS_wcsncpy(wchar_t* dstStr, const wchar_t* srcStr, size_t count); +int32_t FXSYS_wcsnicmp(const wchar_t* s1, const wchar_t* s2, size_t count); + +inline bool FXSYS_islower(int32_t ch) { + return ch >= 'a' && ch <= 'z'; +} + +inline bool FXSYS_isupper(int32_t ch) { + return ch >= 'A' && ch <= 'Z'; +} + +inline int32_t FXSYS_tolower(int32_t ch) { + return ch < 'A' || ch > 'Z' ? ch : (ch + 0x20); +} + +inline int32_t FXSYS_toupper(int32_t ch) { + return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); +} + +inline bool FXSYS_iswalpha(wchar_t wch) { + return (wch >= L'A' && wch <= L'Z') || (wch >= L'a' && wch <= L'z'); +} + +inline bool FXSYS_iswdigit(wchar_t wch) { + return wch >= L'0' && wch <= L'9'; +} + +inline bool FXSYS_iswalnum(wchar_t wch) { + return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch); +} + +inline bool FXSYS_iswspace(wchar_t c) { + return (c == 0x20) || (c == 0x0d) || (c == 0x0a) || (c == 0x09); +} + +inline bool FXSYS_isHexDigit(const char c) { + return !((c & 0x80) || !std::isxdigit(c)); +} + +inline int FXSYS_toHexDigit(const char c) { + if (!FXSYS_isHexDigit(c)) + return 0; + char upchar = std::toupper(c); + return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; +} + +inline bool FXSYS_isDecimalDigit(const char c) { + return !((c & 0x80) || !std::isdigit(c)); +} + +inline bool FXSYS_isDecimalDigit(const wchar_t c) { + return !!std::iswdigit(c); +} + +inline int FXSYS_toDecimalDigit(const char c) { + return FXSYS_isDecimalDigit(c) ? c - '0' : 0; +} + +inline int FXSYS_toDecimalDigit(const wchar_t c) { + return std::iswdigit(c) ? c - L'0' : 0; +} + +float FXSYS_FractionalScale(size_t scale_factor, int value); +int FXSYS_FractionalScaleCount(); + +void* FX_Random_MT_Start(uint32_t dwSeed); +void FX_Random_MT_Close(void* pContext); +uint32_t FX_Random_MT_Generate(void* pContext); +void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount); +void FX_Random_GenerateMT(uint32_t* pBuffer, int32_t iCount); + +#ifdef PDF_ENABLE_XFA +struct FX_GUID { + uint32_t data1; + uint16_t data2; + uint16_t data3; + uint8_t data4[8]; +}; +void FX_GUID_CreateV4(FX_GUID* pGUID); +CFX_ByteString FX_GUID_ToString(const FX_GUID* pGUID, bool bSeparator = true); +#endif // PDF_ENABLE_XFA + +#endif // CORE_FXCRT_FX_EXTENSION_H_ diff --git a/core/fxcrt/fx_extension_unittest.cpp b/core/fxcrt/fx_extension_unittest.cpp index 3739a3db8c..4e4294c7ce 100644 --- a/core/fxcrt/fx_extension_unittest.cpp +++ b/core/fxcrt/fx_extension_unittest.cpp @@ -2,10 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "core/fxcrt/fx_extension.h" #include "testing/gtest/include/gtest/gtest.h" -#include "core/fxcrt/fx_ext.h" - TEST(fxcrt, FXSYS_toHexDigit) { EXPECT_EQ(10, FXSYS_toHexDigit('a')); EXPECT_EQ(10, FXSYS_toHexDigit('A')); diff --git a/core/fxcrt/fx_stream.cpp b/core/fxcrt/fx_stream.cpp new file mode 100644 index 0000000000..c60a546ddd --- /dev/null +++ b/core/fxcrt/fx_stream.cpp @@ -0,0 +1,307 @@ +// Copyright 2017 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 + +#include "core/fxcrt/fx_stream.h" + +#include +#include +#include +#include + +#include "core/fxcrt/fx_safe_types.h" +#include "core/fxcrt/ifxcrt_fileaccess.h" + +#define FX_MEMSTREAM_BlockSize (64 * 1024) +#define FX_MEMSTREAM_Consecutive 0x01 +#define FX_MEMSTREAM_TakeOver 0x02 + +namespace { + +class CFX_CRTFileStream final : public IFX_SeekableStream { + public: + template + friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + + // IFX_SeekableStream: + FX_FILESIZE GetSize() override { return m_pFile->GetSize(); } + bool IsEOF() override { return GetPosition() >= GetSize(); } + FX_FILESIZE GetPosition() override { return m_pFile->GetPosition(); } + bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { + return m_pFile->ReadPos(buffer, size, offset) > 0; + } + size_t ReadBlock(void* buffer, size_t size) override { + return m_pFile->Read(buffer, size); + } + bool WriteBlock(const void* buffer, + FX_FILESIZE offset, + size_t size) override { + return !!m_pFile->WritePos(buffer, size, offset); + } + bool Flush() override { return m_pFile->Flush(); } + + private: + explicit CFX_CRTFileStream(std::unique_ptr pFA) + : m_pFile(std::move(pFA)) {} + ~CFX_CRTFileStream() override {} + + std::unique_ptr m_pFile; +}; + +class CFX_MemoryStream final : public IFX_MemoryStream { + public: + template + friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + + // IFX_MemoryStream + FX_FILESIZE GetSize() override { + return static_cast(m_nCurSize); + } + bool IsEOF() override { return m_nCurPos >= static_cast(GetSize()); } + FX_FILESIZE GetPosition() override { + return static_cast(m_nCurPos); + } + bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; + size_t ReadBlock(void* buffer, size_t size) override; + bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override; + bool Flush() override { return true; } + bool IsConsecutive() const override { + return !!(m_dwFlags & FX_MEMSTREAM_Consecutive); + } + void EstimateSize(size_t nInitSize, size_t nGrowSize) override; + uint8_t* GetBuffer() const override { + return !m_Blocks.empty() ? m_Blocks.front() : nullptr; + } + void AttachBuffer(uint8_t* pBuffer, + size_t nSize, + bool bTakeOver = false) override; + void DetachBuffer() override; + + private: + explicit CFX_MemoryStream(bool bConsecutive); + CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, bool bTakeOver); + ~CFX_MemoryStream() override; + + bool ExpandBlocks(size_t size); + + std::vector m_Blocks; + size_t m_nTotalSize; + size_t m_nCurSize; + size_t m_nCurPos; + size_t m_nGrowSize; + uint32_t m_dwFlags; +}; + +CFX_MemoryStream::CFX_MemoryStream(bool bConsecutive) + : m_nTotalSize(0), + m_nCurSize(0), + m_nCurPos(0), + m_nGrowSize(FX_MEMSTREAM_BlockSize) { + m_dwFlags = + FX_MEMSTREAM_TakeOver | (bConsecutive ? FX_MEMSTREAM_Consecutive : 0); +} + +CFX_MemoryStream::CFX_MemoryStream(uint8_t* pBuffer, + size_t nSize, + bool bTakeOver) + : m_nTotalSize(nSize), + m_nCurSize(nSize), + m_nCurPos(0), + m_nGrowSize(FX_MEMSTREAM_BlockSize) { + m_Blocks.push_back(pBuffer); + m_dwFlags = + FX_MEMSTREAM_Consecutive | (bTakeOver ? FX_MEMSTREAM_TakeOver : 0); +} + +CFX_MemoryStream::~CFX_MemoryStream() { + if (m_dwFlags & FX_MEMSTREAM_TakeOver) { + for (uint8_t* pBlock : m_Blocks) + FX_Free(pBlock); + } +} + +bool CFX_MemoryStream::ReadBlock(void* buffer, + FX_FILESIZE offset, + size_t size) { + if (!buffer || !size || offset < 0) + return false; + + FX_SAFE_SIZE_T newPos = size; + newPos += offset; + if (!newPos.IsValid() || newPos.ValueOrDefault(0) == 0 || + newPos.ValueOrDie() > m_nCurSize) { + return false; + } + + m_nCurPos = newPos.ValueOrDie(); + if (m_dwFlags & FX_MEMSTREAM_Consecutive) { + memcpy(buffer, m_Blocks[0] + static_cast(offset), size); + return true; + } + + size_t nStartBlock = static_cast(offset) / m_nGrowSize; + offset -= static_cast(nStartBlock * m_nGrowSize); + while (size) { + size_t nRead = std::min(size, m_nGrowSize - static_cast(offset)); + memcpy(buffer, m_Blocks[nStartBlock] + offset, nRead); + buffer = static_cast(buffer) + nRead; + size -= nRead; + ++nStartBlock; + offset = 0; + } + return true; +} + +size_t CFX_MemoryStream::ReadBlock(void* buffer, size_t size) { + if (m_nCurPos >= m_nCurSize) + return 0; + + size_t nRead = std::min(size, m_nCurSize - m_nCurPos); + if (!ReadBlock(buffer, static_cast(m_nCurPos), nRead)) + return 0; + + return nRead; +} + +bool CFX_MemoryStream::WriteBlock(const void* buffer, + FX_FILESIZE offset, + size_t size) { + if (!buffer || !size) + return false; + + if (m_dwFlags & FX_MEMSTREAM_Consecutive) { + FX_SAFE_SIZE_T newPos = size; + newPos += offset; + if (!newPos.IsValid()) + return false; + + m_nCurPos = newPos.ValueOrDie(); + if (m_nCurPos > m_nTotalSize) { + m_nTotalSize = (m_nCurPos + m_nGrowSize - 1) / m_nGrowSize * m_nGrowSize; + if (m_Blocks.empty()) + m_Blocks.push_back(FX_Alloc(uint8_t, m_nTotalSize)); + else + m_Blocks[0] = FX_Realloc(uint8_t, m_Blocks[0], m_nTotalSize); + } + + memcpy(m_Blocks[0] + offset, buffer, size); + m_nCurSize = std::max(m_nCurSize, m_nCurPos); + + return true; + } + + FX_SAFE_SIZE_T newPos = size; + newPos += offset; + if (!newPos.IsValid()) + return false; + if (!ExpandBlocks(newPos.ValueOrDie())) + return false; + + m_nCurPos = newPos.ValueOrDie(); + size_t nStartBlock = static_cast(offset) / m_nGrowSize; + offset -= static_cast(nStartBlock * m_nGrowSize); + while (size) { + size_t nWrite = std::min(size, m_nGrowSize - static_cast(offset)); + memcpy(m_Blocks[nStartBlock] + offset, buffer, nWrite); + buffer = static_cast(buffer) + nWrite; + size -= nWrite; + ++nStartBlock; + offset = 0; + } + return true; +} + +void CFX_MemoryStream::EstimateSize(size_t nInitSize, size_t nGrowSize) { + if (m_dwFlags & FX_MEMSTREAM_Consecutive) { + if (m_Blocks.empty()) { + m_Blocks.push_back( + FX_Alloc(uint8_t, std::max(nInitSize, static_cast(4096)))); + } + m_nGrowSize = std::max(nGrowSize, static_cast(4096)); + } else if (m_Blocks.empty()) { + m_nGrowSize = std::max(nGrowSize, static_cast(4096)); + } +} + +void CFX_MemoryStream::AttachBuffer(uint8_t* pBuffer, + size_t nSize, + bool bTakeOver) { + if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) + return; + + m_Blocks.clear(); + m_Blocks.push_back(pBuffer); + m_nTotalSize = nSize; + m_nCurSize = nSize; + m_nCurPos = 0; + m_dwFlags = + FX_MEMSTREAM_Consecutive | (bTakeOver ? FX_MEMSTREAM_TakeOver : 0); +} + +void CFX_MemoryStream::DetachBuffer() { + if (!(m_dwFlags & FX_MEMSTREAM_Consecutive)) + return; + + m_Blocks.clear(); + m_nTotalSize = 0; + m_nCurSize = 0; + m_nCurPos = 0; + m_dwFlags = FX_MEMSTREAM_TakeOver; +} + +bool CFX_MemoryStream::ExpandBlocks(size_t size) { + m_nCurSize = std::max(m_nCurSize, size); + if (size <= m_nTotalSize) + return true; + + size = (size - m_nTotalSize + m_nGrowSize - 1) / m_nGrowSize; + size_t iCount = m_Blocks.size(); + m_Blocks.resize(iCount + size); + while (size--) { + m_Blocks[iCount++] = FX_Alloc(uint8_t, m_nGrowSize); + m_nTotalSize += m_nGrowSize; + } + return true; +} + +} // namespace + +// static +CFX_RetainPtr IFX_SeekableStream::CreateFromFilename( + const char* filename, + uint32_t dwModes) { + std::unique_ptr pFA(IFXCRT_FileAccess::Create()); + if (!pFA->Open(filename, dwModes)) + return nullptr; + return pdfium::MakeRetain(std::move(pFA)); +} + +// static +CFX_RetainPtr IFX_SeekableStream::CreateFromFilename( + const wchar_t* filename, + uint32_t dwModes) { + std::unique_ptr pFA(IFXCRT_FileAccess::Create()); + if (!pFA->Open(filename, dwModes)) + return nullptr; + return pdfium::MakeRetain(std::move(pFA)); +} + +// static +CFX_RetainPtr +IFX_SeekableReadStream::CreateFromFilename(const char* filename) { + return IFX_SeekableStream::CreateFromFilename(filename, FX_FILEMODE_ReadOnly); +} + +// static +CFX_RetainPtr IFX_MemoryStream::Create(uint8_t* pBuffer, + size_t dwSize, + bool bTakeOver) { + return pdfium::MakeRetain(pBuffer, dwSize, bTakeOver); +} + +// static +CFX_RetainPtr IFX_MemoryStream::Create(bool bConsecutive) { + return pdfium::MakeRetain(bConsecutive); +} diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h index c9306c9548..1aa9feae58 100644 --- a/core/fxcrt/fx_stream.h +++ b/core/fxcrt/fx_stream.h @@ -127,18 +127,6 @@ class IFX_MemoryStream : public IFX_SeekableStream { virtual void DetachBuffer() = 0; }; -#ifdef PDF_ENABLE_XFA -class IFX_FileAccess : public CFX_Retainable { - public: - static CFX_RetainPtr CreateDefault( - const CFX_WideStringC& wsPath); - - virtual void GetPath(CFX_WideString& wsPath) = 0; - virtual CFX_RetainPtr CreateFileStream( - uint32_t dwModes) = 0; -}; -#endif // PDF_ENABLE_XFA - #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ class CFindFileData { public: diff --git a/core/fxcrt/fxcrt_posix.h b/core/fxcrt/fxcrt_posix.h index 20faa5c02f..109cf34a51 100644 --- a/core/fxcrt/fxcrt_posix.h +++ b/core/fxcrt/fxcrt_posix.h @@ -7,7 +7,7 @@ #ifndef CORE_FXCRT_FXCRT_POSIX_H_ #define CORE_FXCRT_FXCRT_POSIX_H_ -#include "core/fxcrt/extension.h" +#include "core/fxcrt/ifxcrt_fileaccess.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || \ _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ diff --git a/core/fxcrt/fxcrt_windows.h b/core/fxcrt/fxcrt_windows.h index f8f948360d..8e800ce4d6 100644 --- a/core/fxcrt/fxcrt_windows.h +++ b/core/fxcrt/fxcrt_windows.h @@ -7,7 +7,7 @@ #ifndef CORE_FXCRT_FXCRT_WINDOWS_H_ #define CORE_FXCRT_FXCRT_WINDOWS_H_ -#include "core/fxcrt/extension.h" +#include "core/fxcrt/ifxcrt_fileaccess.h" #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ class CFXCRT_FileAccess_Win64 : public IFXCRT_FileAccess { diff --git a/core/fxcrt/ifxcrt_fileaccess.h b/core/fxcrt/ifxcrt_fileaccess.h new file mode 100644 index 0000000000..9528b3b377 --- /dev/null +++ b/core/fxcrt/ifxcrt_fileaccess.h @@ -0,0 +1,37 @@ +// 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 CORE_FXCRT_IFXCRT_FILEACCESS_H_ +#define CORE_FXCRT_IFXCRT_FILEACCESS_H_ + +#include +#include + +#include "core/fxcrt/fx_basic.h" +#include "core/fxcrt/fx_safe_types.h" + +class IFXCRT_FileAccess { + public: + static IFXCRT_FileAccess* Create(); + virtual ~IFXCRT_FileAccess() {} + + virtual bool Open(const CFX_ByteStringC& fileName, uint32_t dwMode) = 0; + virtual bool Open(const CFX_WideStringC& fileName, uint32_t dwMode) = 0; + virtual void Close() = 0; + virtual FX_FILESIZE GetSize() const = 0; + virtual FX_FILESIZE GetPosition() const = 0; + virtual FX_FILESIZE SetPosition(FX_FILESIZE pos) = 0; + virtual size_t Read(void* pBuffer, size_t szBuffer) = 0; + virtual size_t Write(const void* pBuffer, size_t szBuffer) = 0; + virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos) = 0; + virtual size_t WritePos(const void* pBuffer, + size_t szBuffer, + FX_FILESIZE pos) = 0; + virtual bool Flush() = 0; + virtual bool Truncate(FX_FILESIZE szFile) = 0; +}; + +#endif // CORE_FXCRT_IFXCRT_FILEACCESS_H_ diff --git a/core/fxcrt/xml/cfx_xmlattributenode.cpp b/core/fxcrt/xml/cfx_xmlattributenode.cpp index 9c81efc109..9ea6756839 100644 --- a/core/fxcrt/xml/cfx_xmlattributenode.cpp +++ b/core/fxcrt/xml/cfx_xmlattributenode.cpp @@ -6,7 +6,7 @@ #include "core/fxcrt/xml/cfx_xmlattributenode.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" CFX_XMLAttributeNode::CFX_XMLAttributeNode(const CFX_WideString& name) : CFX_XMLNode(), name_(name) { diff --git a/core/fxcrt/xml/cfx_xmlelement.cpp b/core/fxcrt/xml/cfx_xmlelement.cpp index c6b70e1cc4..8c2442e765 100644 --- a/core/fxcrt/xml/cfx_xmlelement.cpp +++ b/core/fxcrt/xml/cfx_xmlelement.cpp @@ -6,7 +6,7 @@ #include "core/fxcrt/xml/cfx_xmlelement.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/xml/cfx_xmlchardata.h" #include "core/fxcrt/xml/cfx_xmltext.h" #include "third_party/base/ptr_util.h" diff --git a/core/fxcrt/xml/cfx_xmlinstruction.cpp b/core/fxcrt/xml/cfx_xmlinstruction.cpp index d07b92e3c1..6886172ee2 100644 --- a/core/fxcrt/xml/cfx_xmlinstruction.cpp +++ b/core/fxcrt/xml/cfx_xmlinstruction.cpp @@ -6,7 +6,7 @@ #include "core/fxcrt/xml/cfx_xmlinstruction.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" diff --git a/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp index e7bef71085..aa455d5971 100644 --- a/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp +++ b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp @@ -8,7 +8,7 @@ #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_safe_types.h" namespace { diff --git a/core/fxcrt/xml/cxml_parser.cpp b/core/fxcrt/xml/cxml_parser.cpp index 09c61d1b32..691a86eaf6 100644 --- a/core/fxcrt/xml/cxml_parser.cpp +++ b/core/fxcrt/xml/cxml_parser.cpp @@ -8,7 +8,7 @@ #include #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/xml/cxml_content.h" #include "core/fxcrt/xml/cxml_element.h" #include "core/fxcrt/xml/cxml_parser.h" diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp index 46aa76e822..ec5c610150 100644 --- a/core/fxge/android/cfpf_skiafontmgr.cpp +++ b/core/fxge/android/cfpf_skiafontmgr.cpp @@ -14,7 +14,7 @@ #include #include "core/fxcrt/fx_codepage.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_memory.h" #include "core/fxcrt/fx_system.h" #include "core/fxge/android/cfpf_skiafont.h" diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp index eef0e0cd88..15d05b0c2a 100644 --- a/core/fxge/apple/fx_quartz_device.cpp +++ b/core/fxge/apple/fx_quartz_device.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #if !defined _SKIA_SUPPORT_ && !defined _SKIA_SUPPORT_PATHS_ #include "core/fxge/agg/fx_agg_driver.h" diff --git a/fpdfsdk/cpdfsdk_datetime.cpp b/fpdfsdk/cpdfsdk_datetime.cpp index e10a223408..47c764ce6e 100644 --- a/fpdfsdk/cpdfsdk_datetime.cpp +++ b/fpdfsdk/cpdfsdk_datetime.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/cpdfsdk_datetime.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" namespace { diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index 004c921a52..a8b0d05c61 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -16,7 +16,7 @@ #include "core/fpdfapi/parser/cpdf_reference.h" #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "core/fpdfapi/parser/cpdf_string.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "fpdfsdk/fsdk_define.h" #include "public/fpdf_edit.h" diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index b5d4f7ba55..b3495375e0 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -14,7 +14,7 @@ #include #include "core/fpdfdoc/cpdf_interform.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "fpdfsdk/cpdfsdk_formfillenvironment.h" #include "fpdfsdk/cpdfsdk_interform.h" #include "fpdfsdk/javascript/Field.h" diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp index 91c82e60f6..d7f17fa41c 100644 --- a/fpdfsdk/javascript/global.cpp +++ b/fpdfsdk/javascript/global.cpp @@ -9,7 +9,7 @@ #include #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "fpdfsdk/javascript/JS_Define.h" #include "fpdfsdk/javascript/JS_EventHandler.h" #include "fpdfsdk/javascript/JS_GlobalData.h" diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp index f88cdc615d..4303342064 100644 --- a/fpdfsdk/javascript/util.cpp +++ b/fpdfsdk/javascript/util.cpp @@ -12,7 +12,7 @@ #include #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "fpdfsdk/javascript/JS_Define.h" #include "fpdfsdk/javascript/JS_EventHandler.h" #include "fpdfsdk/javascript/JS_Object.h" diff --git a/xfa/fde/css/cfde_cssdeclaration.cpp b/xfa/fde/css/cfde_cssdeclaration.cpp index 8983059220..4de8cb74f0 100644 --- a/xfa/fde/css/cfde_cssdeclaration.cpp +++ b/xfa/fde/css/cfde_cssdeclaration.cpp @@ -6,7 +6,7 @@ #include "xfa/fde/css/cfde_cssdeclaration.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "third_party/base/ptr_util.h" #include "xfa/fde/css/cfde_csscolorvalue.h" #include "xfa/fde/css/cfde_csscustomproperty.h" diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp index 5fa9cf0dc9..79170bc072 100644 --- a/xfa/fde/css/fde_cssdatatable.cpp +++ b/xfa/fde/css/fde_cssdatatable.cpp @@ -9,7 +9,7 @@ #include #include "core/fxcrt/fx_codepage.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "xfa/fde/css/cfde_cssstyleselector.h" #include "xfa/fde/css/cfde_cssvaluelistparser.h" diff --git a/xfa/fgas/crt/cfgas_formatstring.cpp b/xfa/fgas/crt/cfgas_formatstring.cpp index 6cb8281993..6d940d6c94 100644 --- a/xfa/fgas/crt/cfgas_formatstring.cpp +++ b/xfa/fgas/crt/cfgas_formatstring.cpp @@ -10,7 +10,7 @@ #include #include "core/fxcrt/cfx_decimal.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/xml/cxml_element.h" #define FX_LOCALECATEGORY_DateHash 0xbde9abde diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index e0b71118d9..74c284012f 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -678,12 +678,11 @@ bool CFX_FontSourceEnum_File::HasStartPosition() { return m_wsNext.GetLength() != 0; } -CFX_RetainPtr CFX_FontSourceEnum_File::GetNext() { +CFX_RetainPtr CFX_FontSourceEnum_File::GetNext() { if (m_wsNext.GetLength() == 0) return nullptr; - CFX_RetainPtr pAccess = - IFX_FileAccess::CreateDefault(m_wsNext.AsStringC()); + auto pAccess = pdfium::MakeRetain(m_wsNext.AsStringC()); m_wsNext = GetNextFile().UTF8Decode(); return pAccess; } @@ -733,7 +732,8 @@ bool CFGAS_FontMgr::EnumFontsFromFiles() { if (!m_pFontSource->HasStartPosition()) return !m_InstalledFonts.empty(); - while (CFX_RetainPtr pFontSource = m_pFontSource->GetNext()) { + while (CFX_RetainPtr pFontSource = + m_pFontSource->GetNext()) { CFX_RetainPtr pFontStream = pFontSource->CreateFileStream(FX_FILEMODE_ReadOnly); if (pFontStream) diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index cca999a869..1ef78a79a6 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -13,9 +13,10 @@ #include #include +#include "core/fxcrt/cfx_crtfileaccess.h" #include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_seekablestreamproxy.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxge/cfx_fontmapper.h" #include "core/fxge/fx_freetype.h" #include "core/fxge/ifx_systemfontinfo.h" @@ -169,7 +170,7 @@ class CFX_FontSourceEnum_File { ~CFX_FontSourceEnum_File(); bool HasStartPosition(); - CFX_RetainPtr GetNext(); + CFX_RetainPtr GetNext(); private: CFX_ByteString GetNextFile(); diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp index 82930094ec..44f9423297 100644 --- a/xfa/fgas/font/fgas_fontutils.cpp +++ b/xfa/fgas/font/fgas_fontutils.cpp @@ -7,7 +7,7 @@ #include "xfa/fgas/font/fgas_fontutils.h" #include "core/fxcrt/fx_codepage.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "xfa/fgas/font/cfgas_fontmgr.h" namespace { diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp index 9012100c32..364ef196a9 100644 --- a/xfa/fwl/cfwl_notedriver.cpp +++ b/xfa/fwl/cfwl_notedriver.cpp @@ -9,7 +9,7 @@ #include #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fwl/cfwl_app.h" diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index 92d687781d..4e5e1f0a41 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -8,7 +8,7 @@ #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "third_party/base/ptr_util.h" #include "xfa/fwl/cfwl_app.h" #include "xfa/fwl/cfwl_barcode.h" diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index 04741f9082..5e36c08ff0 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -15,7 +15,7 @@ #include "core/fpdfapi/parser/fpdf_parser_decode.h" #include "core/fpdfdoc/cpdf_nametree.h" #include "core/fxcrt/cfx_checksumcontext.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_memory.h" #include "core/fxcrt/xml/cfx_xmlelement.h" #include "core/fxcrt/xml/cfx_xmlnode.h" diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index 488a31f299..00f759a7f5 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/cxfa_ffdocview.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/app/xfa_ffbarcode.h" diff --git a/xfa/fxfa/cxfa_fontmgr.h b/xfa/fxfa/cxfa_fontmgr.h index 8652a34422..f66ca8f314 100644 --- a/xfa/fxfa/cxfa_fontmgr.h +++ b/xfa/fxfa/cxfa_fontmgr.h @@ -12,7 +12,7 @@ #include #include "core/fxcrt/cfx_retain_ptr.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_system.h" #include "xfa/fgas/font/cfgas_fontmgr.h" #include "xfa/fxfa/cxfa_deffontmgr.h" diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 4621dfe134..bf44ffbcc4 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -11,7 +11,7 @@ #include #include "core/fxcrt/cfx_decimal.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "fxjs/cfxjse_arguments.h" #include "fxjs/cfxjse_class.h" #include "fxjs/cfxjse_value.h" diff --git a/xfa/fxfa/fm2js/xfa_lexer.cpp b/xfa/fxfa/fm2js/xfa_lexer.cpp index 7ccd4773fb..b646743d10 100644 --- a/xfa/fxfa/fm2js/xfa_lexer.cpp +++ b/xfa/fxfa/fm2js/xfa_lexer.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/fm2js/xfa_lexer.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" namespace { diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp index 7bc703b59b..872fe7e2e8 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp +++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp @@ -8,7 +8,7 @@ #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" namespace { diff --git a/xfa/fxfa/parser/cxfa_data.cpp b/xfa/fxfa/parser/cxfa_data.cpp index 9f265b41be..bdfc25c79c 100644 --- a/xfa/fxfa/parser/cxfa_data.cpp +++ b/xfa/fxfa/parser/cxfa_data.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_data.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_node.h" diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index 8e39dafa84..4b0a398ae2 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -4,7 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fxcrt/fx_ext.h" +#include "xfa/fxfa/parser/cxfa_document.h" + +#include "core/fxcrt/fx_extension.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cscript_datawindow.h" #include "xfa/fxfa/parser/cscript_eventpseudomodel.h" @@ -12,7 +14,6 @@ #include "xfa/fxfa/parser/cscript_layoutpseudomodel.h" #include "xfa/fxfa/parser/cscript_logpseudomodel.h" #include "xfa/fxfa/parser/cscript_signaturepseudomodel.h" -#include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_document_parser.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp index 67780924c2..d2e526eb95 100644 --- a/xfa/fxfa/parser/cxfa_localevalue.cpp +++ b/xfa/fxfa/parser/cxfa_localevalue.cpp @@ -8,7 +8,7 @@ #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fgas/crt/cfgas_formatstring.h" diff --git a/xfa/fxfa/parser/cxfa_measurement.cpp b/xfa/fxfa/parser/cxfa_measurement.cpp index fd00c42d34..9173223d3c 100644 --- a/xfa/fxfa/parser/cxfa_measurement.cpp +++ b/xfa/fxfa/parser/cxfa_measurement.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_measurement.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" CXFA_Measurement::CXFA_Measurement(const CFX_WideStringC& wsMeasure) { Set(wsMeasure); diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index ce45ae10db..a3c9ee42e0 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -14,7 +14,7 @@ #include "core/fxcrt/cfx_decimal.h" #include "core/fxcrt/fx_codepage.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/xml/cfx_xmlelement.h" #include "core/fxcrt/xml/cfx_xmlnode.h" #include "core/fxcrt/xml/cfx_xmltext.h" diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp index abfca84609..547831caca 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.cpp +++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_nodehelper.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_node.h" diff --git a/xfa/fxfa/parser/cxfa_nodelist.cpp b/xfa/fxfa/parser/cxfa_nodelist.cpp index 86efb29eba..f47a1b1752 100644 --- a/xfa/fxfa/parser/cxfa_nodelist.cpp +++ b/xfa/fxfa/parser/cxfa_nodelist.cpp @@ -8,7 +8,7 @@ #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp index 9bbee4ec75..30aae88307 100644 --- a/xfa/fxfa/parser/cxfa_object.cpp +++ b/xfa/fxfa/parser/cxfa_object.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cxfa_object.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "fxjs/cfxjse_value.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" diff --git a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp index 51487a1e2b..14adc7793e 100644 --- a/xfa/fxfa/parser/cxfa_resolveprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_resolveprocessor.cpp @@ -10,7 +10,7 @@ #include #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/parser/cxfa_document.h" diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp index f539c39f76..b0b52299e7 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -8,7 +8,7 @@ #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "fxjs/cfxjse_arguments.h" #include "fxjs/cfxjse_class.h" #include "fxjs/cfxjse_value.h" diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index 9fd684c0a9..db15a80a44 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -12,7 +12,7 @@ #include "core/fxcrt/cfx_checksumcontext.h" #include "core/fxcrt/cfx_seekablestreamproxy.h" #include "core/fxcrt/fx_codepage.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/xml/cfx_xmlchardata.h" #include "core/fxcrt/xml/cfx_xmldoc.h" #include "core/fxcrt/xml/cfx_xmlelement.h" diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 8784b6e9d1..2f90f59bdd 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -7,7 +7,7 @@ #include "xfa/fxfa/parser/cxfa_widgetdata.h" #include "core/fxcrt/cfx_decimal.h" -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "fxbarcode/BC_Library.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/app/xfa_ffnotify.h" diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index f338595605..46a2af4a76 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -9,7 +9,7 @@ #include #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/xml/cfx_xmlelement.h" #include "core/fxcrt/xml/cfx_xmlnode.h" #include "third_party/base/stl_util.h" diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index 1c5adc75c9..fa75f18015 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -8,7 +8,7 @@ #include -#include "core/fxcrt/fx_ext.h" +#include "core/fxcrt/fx_extension.h" #include "core/fxcrt/xml/cfx_xmlchardata.h" #include "core/fxcrt/xml/cfx_xmlelement.h" #include "core/fxcrt/xml/cfx_xmlnode.h" -- cgit v1.2.3