diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-04-19 08:58:54 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-19 13:16:57 +0000 |
commit | 3b71d26f092ebc86ca9177fbbe89d83caa67ae1b (patch) | |
tree | a81ab092972ab8a2ce474d8d53984bfe9b6887a8 | |
parent | 5af27b63bf94e7f60212f6759c8342ce02da5ad2 (diff) | |
download | pdfium-3b71d26f092ebc86ca9177fbbe89d83caa67ae1b.tar.xz |
Move CFGAS_Stream to CFX_SeekableStreamProxy
This CL moves the FGAS stream code into core/fxcrt and renames to
CFX_SeekableStreamProxy.
Change-Id: I6641fe0cca45a128ef3ec281b0b40f8d60296387
Reviewed-on: https://pdfium-review.googlesource.com/4311
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
36 files changed, 163 insertions, 135 deletions
@@ -824,10 +824,13 @@ static_library("fxcrt") { "core/fxcrt/cfx_datetime.h", "core/fxcrt/cfx_decimal.cpp", "core/fxcrt/cfx_decimal.h", + "core/fxcrt/cfx_seekablestreamproxy.cpp", + "core/fxcrt/cfx_seekablestreamproxy.h", "core/fxcrt/cfx_wordbreak.cpp", "core/fxcrt/cfx_wordbreak.h", "core/fxcrt/fx_arabic.cpp", "core/fxcrt/fx_arabic.h", + "core/fxcrt/fx_codepage.h", "core/fxcrt/ifx_chariter.h", "core/fxcrt/ifx_locale.h", "core/fxcrt/xml/cfx_saxcontext.h", @@ -1427,9 +1430,6 @@ if (pdf_enable_xfa) { "xfa/fde/xml/cfde_xmltext.h", "xfa/fgas/crt/cfgas_formatstring.cpp", "xfa/fgas/crt/cfgas_formatstring.h", - "xfa/fgas/crt/cfgas_stream.cpp", - "xfa/fgas/crt/cfgas_stream.h", - "xfa/fgas/crt/fgas_codepage.h", "xfa/fgas/crt/fgas_language.h", "xfa/fgas/font/cfgas_fontmgr.cpp", "xfa/fgas/font/cfgas_fontmgr.h", diff --git a/xfa/fgas/crt/cfgas_stream.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp index 809c19bdae..fe6b8dd375 100644 --- a/xfa/fgas/crt/cfgas_stream.cpp +++ b/core/fxcrt/cfx_seekablestreamproxy.cpp @@ -1,10 +1,10 @@ -// Copyright 2014 PDFium Authors. All rights reserved. +// 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 "xfa/fgas/crt/cfgas_stream.h" +#include "core/fxcrt/cfx_seekablestreamproxy.h" #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \ _FX_OS_ == _FX_WIN64_ @@ -17,10 +17,10 @@ #include <utility> #include <vector> +#include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_ext.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" -#include "xfa/fgas/crt/fgas_codepage.h" namespace { @@ -145,11 +145,12 @@ void SwapByteOrder(wchar_t* pStr, FX_STRSIZE iLength) { #define BOM_UTF16_LE 0xFFFE0000 #endif // _FX_ENDIAN_ == _FX_LITTLE_ENDIAN_ -CFGAS_Stream::CFGAS_Stream(const CFX_RetainPtr<IFX_SeekableStream>& stream, - bool isWriteStream) - : m_wCodePage(FX_CODEPAGE_DefANSI), +CFX_SeekableStreamProxy::CFX_SeekableStreamProxy( + const CFX_RetainPtr<IFX_SeekableStream>& stream, + bool isWriteStream) + : m_IsWriteStream(isWriteStream), + m_wCodePage(FX_CODEPAGE_DefANSI), m_wBOMLength(0), - m_IsWriteStream(isWriteStream), m_iPosition(0), m_pStream(stream) { ASSERT(m_pStream); @@ -160,7 +161,7 @@ CFGAS_Stream::CFGAS_Stream(const CFX_RetainPtr<IFX_SeekableStream>& stream, } FX_FILESIZE iPosition = GetPosition(); - Seek(CFGAS_Stream::Pos::Begin, 0); + Seek(CFX_SeekableStreamProxy::Pos::Begin, 0); uint32_t bom; ReadData(reinterpret_cast<uint8_t*>(&bom), 3); @@ -183,21 +184,22 @@ CFGAS_Stream::CFGAS_Stream(const CFX_RetainPtr<IFX_SeekableStream>& stream, } } - Seek(CFGAS_Stream::Pos::Begin, + Seek(CFX_SeekableStreamProxy::Pos::Begin, std::max(static_cast<FX_FILESIZE>(m_wBOMLength), iPosition)); } -CFGAS_Stream::CFGAS_Stream(uint8_t* data, FX_STRSIZE size) - : CFGAS_Stream(IFX_MemoryStream::Create(data, size), false) {} +CFX_SeekableStreamProxy::CFX_SeekableStreamProxy(uint8_t* data, FX_STRSIZE size) + : CFX_SeekableStreamProxy(IFX_MemoryStream::Create(data, size), false) {} -CFGAS_Stream::~CFGAS_Stream() {} +CFX_SeekableStreamProxy::~CFX_SeekableStreamProxy() {} -void CFGAS_Stream::Seek(CFGAS_Stream::Pos eSeek, FX_FILESIZE iOffset) { +void CFX_SeekableStreamProxy::Seek(CFX_SeekableStreamProxy::Pos eSeek, + FX_FILESIZE iOffset) { switch (eSeek) { - case CFGAS_Stream::Pos::Begin: + case CFX_SeekableStreamProxy::Pos::Begin: m_iPosition = iOffset; break; - case CFGAS_Stream::Pos::Current: + case CFX_SeekableStreamProxy::Pos::Current: m_iPosition += iOffset; break; } @@ -205,13 +207,14 @@ void CFGAS_Stream::Seek(CFGAS_Stream::Pos eSeek, FX_FILESIZE iOffset) { pdfium::clamp(m_iPosition, static_cast<FX_FILESIZE>(0), GetLength()); } -void CFGAS_Stream::SetCodePage(uint16_t wCodePage) { +void CFX_SeekableStreamProxy::SetCodePage(uint16_t wCodePage) { if (m_wBOMLength > 0) return; m_wCodePage = wCodePage; } -FX_STRSIZE CFGAS_Stream::ReadData(uint8_t* pBuffer, FX_STRSIZE iBufferSize) { +FX_STRSIZE CFX_SeekableStreamProxy::ReadData(uint8_t* pBuffer, + FX_STRSIZE iBufferSize) { ASSERT(pBuffer && iBufferSize > 0); if (m_IsWriteStream) @@ -234,9 +237,9 @@ FX_STRSIZE CFGAS_Stream::ReadData(uint8_t* pBuffer, FX_STRSIZE iBufferSize) { return 0; } -FX_STRSIZE CFGAS_Stream::ReadString(wchar_t* pStr, - FX_STRSIZE iMaxLength, - bool* bEOS) { +FX_STRSIZE CFX_SeekableStreamProxy::ReadString(wchar_t* pStr, + FX_STRSIZE iMaxLength, + bool* bEOS) { ASSERT(pStr && iMaxLength > 0); if (m_IsWriteStream) @@ -273,7 +276,7 @@ FX_STRSIZE CFGAS_Stream::ReadString(wchar_t* pStr, FX_STRSIZE iSrc = 0; std::tie(iSrc, iMaxLength) = UTF8Decode( reinterpret_cast<const char*>(buf.data()), iLen, pStr, iMaxLength); - Seek(CFGAS_Stream::Pos::Current, iSrc - iLen); + Seek(CFX_SeekableStreamProxy::Pos::Current, iSrc - iLen); } else { iMaxLength = 0; } @@ -283,7 +286,7 @@ FX_STRSIZE CFGAS_Stream::ReadString(wchar_t* pStr, return iMaxLength; } -void CFGAS_Stream::WriteString(const CFX_WideStringC& str) { +void CFX_SeekableStreamProxy::WriteString(const CFX_WideStringC& str) { if (!m_IsWriteStream || str.GetLength() == 0 || m_wCodePage != FX_CODEPAGE_UTF8) { return; diff --git a/xfa/fgas/crt/cfgas_stream.h b/core/fxcrt/cfx_seekablestreamproxy.h index 5d2e5e6242..d059fb8956 100644 --- a/xfa/fgas/crt/cfgas_stream.h +++ b/core/fxcrt/cfx_seekablestreamproxy.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FGAS_CRT_CFGAS_STREAM_H_ -#define XFA_FGAS_CRT_CFGAS_STREAM_H_ +#ifndef CORE_FXCRT_CFX_SEEKABLESTREAMPROXY_H_ +#define CORE_FXCRT_CFX_SEEKABLESTREAMPROXY_H_ #include <algorithm> @@ -13,7 +13,7 @@ #include "core/fxcrt/fx_stream.h" #include "core/fxcrt/fx_system.h" -class CFGAS_Stream : public CFX_Retainable { +class CFX_SeekableStreamProxy : public CFX_Retainable { public: enum class Pos { Begin = 0, @@ -28,7 +28,7 @@ class CFGAS_Stream : public CFX_Retainable { FX_STRSIZE GetBOMLength() const { return std::max(0, m_wBOMLength); } bool IsEOF() const { return m_iPosition >= GetLength(); } - void Seek(CFGAS_Stream::Pos eSeek, FX_FILESIZE iOffset); + void Seek(CFX_SeekableStreamProxy::Pos eSeek, FX_FILESIZE iOffset); FX_STRSIZE ReadString(wchar_t* pStr, FX_STRSIZE iMaxLength, bool* bEOS); void WriteString(const CFX_WideStringC& str); @@ -37,18 +37,18 @@ class CFGAS_Stream : public CFX_Retainable { void SetCodePage(uint16_t wCodePage); private: - CFGAS_Stream(const CFX_RetainPtr<IFX_SeekableStream>& stream, - bool isWriteSteam); - CFGAS_Stream(uint8_t* data, FX_STRSIZE size); - ~CFGAS_Stream() override; + CFX_SeekableStreamProxy(const CFX_RetainPtr<IFX_SeekableStream>& stream, + bool isWriteSteam); + CFX_SeekableStreamProxy(uint8_t* data, FX_STRSIZE size); + ~CFX_SeekableStreamProxy() override; FX_STRSIZE ReadData(uint8_t* pBuffer, FX_STRSIZE iBufferSize); + bool m_IsWriteStream; uint16_t m_wCodePage; FX_STRSIZE m_wBOMLength; - bool m_IsWriteStream; FX_FILESIZE m_iPosition; CFX_RetainPtr<IFX_SeekableStream> m_pStream; }; -#endif // XFA_FGAS_CRT_CFGAS_STREAM_H_ +#endif // CORE_FXCRT_CFX_SEEKABLESTREAMPROXY_H_ diff --git a/xfa/fgas/crt/fgas_codepage.h b/core/fxcrt/fx_codepage.h index 17813595e6..db8655dbf6 100644 --- a/xfa/fgas/crt/fgas_codepage.h +++ b/core/fxcrt/fx_codepage.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FGAS_CRT_FGAS_CODEPAGE_H_ -#define XFA_FGAS_CRT_FGAS_CODEPAGE_H_ +#ifndef CORE_FXCRT_FX_CODEPAGE_H_ +#define CORE_FXCRT_FX_CODEPAGE_H_ #include "core/fxcrt/fx_basic.h" @@ -134,4 +134,4 @@ #define FX_CHARSET_US 254 #define FX_CHARSET_OEM 255 -#endif // XFA_FGAS_CRT_FGAS_CODEPAGE_H_ +#endif // CORE_FXCRT_FX_CODEPAGE_H_ diff --git a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc index c27273f29b..7d54cff6da 100644 --- a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc +++ b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc @@ -5,8 +5,8 @@ #include <memory> #include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/cfx_seekablestreamproxy.h" #include "core/fxcrt/xml/cfx_saxreader.h" -#include "xfa/fgas/crt/cfgas_stream.h" extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { CFX_SAXReader reader; diff --git a/testing/libfuzzer/pdf_css_fuzzer.cc b/testing/libfuzzer/pdf_css_fuzzer.cc index fef3de74b7..43ce686c22 100644 --- a/testing/libfuzzer/pdf_css_fuzzer.cc +++ b/testing/libfuzzer/pdf_css_fuzzer.cc @@ -5,10 +5,10 @@ #include <memory> #include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/cfx_seekablestreamproxy.h" #include "core/fxcrt/fx_string.h" #include "xfa/fde/css/cfde_csssyntaxparser.h" #include "xfa/fde/css/fde_css.h" -#include "xfa/fgas/crt/cfgas_stream.h" extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { CFX_WideString input = CFX_WideString::FromUTF8( diff --git a/testing/libfuzzer/pdf_xml_fuzzer.cc b/testing/libfuzzer/pdf_xml_fuzzer.cc index 3806f59781..92b61bcd65 100644 --- a/testing/libfuzzer/pdf_xml_fuzzer.cc +++ b/testing/libfuzzer/pdf_xml_fuzzer.cc @@ -6,6 +6,7 @@ #include <cstdint> #include <memory> +#include "core/fxcrt/cfx_seekablestreamproxy.h" #include "core/fxcrt/fx_basic.h" #include "core/fxcrt/fx_safe_types.h" #include "core/fxcrt/fx_system.h" @@ -13,7 +14,6 @@ #include "xfa/fde/xml/cfde_xmldoc.h" #include "xfa/fde/xml/cfde_xmlnode.h" #include "xfa/fde/xml/cfde_xmlparser.h" -#include "xfa/fgas/crt/cfgas_stream.h" namespace { @@ -51,8 +51,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (!safe_size.IsValid()) return 0; - CFX_RetainPtr<CFGAS_Stream> stream = - pdfium::MakeRetain<CFGAS_Stream>(const_cast<uint8_t*>(data), size); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>(const_cast<uint8_t*>(data), + size); auto doc = pdfium::MakeUnique<CFDE_XMLDoc>(); if (!doc->LoadXML(pdfium::MakeUnique<CFDE_XMLParser>(doc->GetRoot(), stream))) return 0; diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index 136735c16e..762c16f4c9 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -106,7 +106,7 @@ CFDE_TxtEdtPage* CFDE_TxtEdtEngine::GetPage(int32_t nIndex) { } void CFDE_TxtEdtEngine::SetTextByStream( - const CFX_RetainPtr<CFGAS_Stream>& pStream) { + const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream) { ResetEngine(); int32_t nIndex = 0; if (pStream && pStream->GetLength()) { @@ -118,7 +118,7 @@ void CFDE_TxtEdtEngine::SetTextByStream( bool bPreIsCR = false; if (bValid) { int32_t nPos = pStream->GetBOMLength(); - pStream->Seek(CFGAS_Stream::Pos::Begin, nPos); + pStream->Seek(CFX_SeekableStreamProxy::Pos::Begin, nPos); int32_t nPlateSize = std::min(nStreamLength, m_pTxtBuf->GetChunkSize()); wchar_t* lpwstr = FX_Alloc(wchar_t, nPlateSize); bool bEos = false; diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h index bbdef8fd7a..4a54c6df98 100644 --- a/xfa/fde/cfde_txtedtengine.h +++ b/xfa/fde/cfde_txtedtengine.h @@ -31,7 +31,7 @@ class CFDE_TxtEdtEngine { int32_t CountPages() const; CFDE_TxtEdtPage* GetPage(int32_t nIndex); - void SetTextByStream(const CFX_RetainPtr<CFGAS_Stream>& pStream); + void SetTextByStream(const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream); void SetText(const CFX_WideString& wsText); int32_t GetTextLength() const; CFX_WideString GetText(int32_t nStart, int32_t nCount) const; diff --git a/xfa/fde/css/cfde_cssstylesheet.cpp b/xfa/fde/css/cfde_cssstylesheet.cpp index 175289be11..c16e25156c 100644 --- a/xfa/fde/css/cfde_cssstylesheet.cpp +++ b/xfa/fde/css/cfde_cssstylesheet.cpp @@ -8,12 +8,12 @@ #include <utility> +#include "core/fxcrt/fx_codepage.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fde/css/cfde_cssdeclaration.h" #include "xfa/fde/css/cfde_cssstylerule.h" #include "xfa/fde/css/fde_cssdatatable.h" -#include "xfa/fgas/crt/fgas_codepage.h" CFDE_CSSStyleSheet::CFDE_CSSStyleSheet() {} diff --git a/xfa/fde/css/cfde_csssyntaxparser.cpp b/xfa/fde/css/cfde_csssyntaxparser.cpp index 9c45422ebb..ac1abcc665 100644 --- a/xfa/fde/css/cfde_csssyntaxparser.cpp +++ b/xfa/fde/css/cfde_csssyntaxparser.cpp @@ -8,9 +8,9 @@ #include <algorithm> +#include "core/fxcrt/fx_codepage.h" #include "xfa/fde/css/cfde_cssdeclaration.h" #include "xfa/fde/css/fde_cssdatatable.h" -#include "xfa/fgas/crt/fgas_codepage.h" namespace { diff --git a/xfa/fde/css/cfde_csstextbuf.h b/xfa/fde/css/cfde_csstextbuf.h index 43ff03aa07..71c76f3361 100644 --- a/xfa/fde/css/cfde_csstextbuf.h +++ b/xfa/fde/css/cfde_csstextbuf.h @@ -8,9 +8,9 @@ #define XFA_FDE_CSS_CFDE_CSSTEXTBUF_H_ #include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/cfx_seekablestreamproxy.h" #include "core/fxcrt/fx_memory.h" #include "core/fxcrt/fx_system.h" -#include "xfa/fgas/crt/cfgas_stream.h" class CFDE_CSSTextBuf { public: diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h index 9e56fce59a..ac44e30175 100644 --- a/xfa/fde/css/fde_css.h +++ b/xfa/fde/css/fde_css.h @@ -7,8 +7,8 @@ #ifndef XFA_FDE_CSS_FDE_CSS_H_ #define XFA_FDE_CSS_FDE_CSS_H_ +#include "core/fxcrt/cfx_seekablestreamproxy.h" #include "core/fxge/fx_dib.h" -#include "xfa/fgas/crt/cfgas_stream.h" #include "xfa/fgas/font/cfgas_fontmgr.h" enum FDE_CSSVALUETYPE { diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp index d61c610fe9..5fa9cf0dc9 100644 --- a/xfa/fde/css/fde_cssdatatable.cpp +++ b/xfa/fde/css/fde_cssdatatable.cpp @@ -8,10 +8,10 @@ #include <utility> +#include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_ext.h" #include "xfa/fde/css/cfde_cssstyleselector.h" #include "xfa/fde/css/cfde_cssvaluelistparser.h" -#include "xfa/fgas/crt/fgas_codepage.h" static const FDE_CSSPropertyTable g_FDE_CSSProperties[] = { {FDE_CSSProperty::BorderLeft, L"border-left", 0x04080036, diff --git a/xfa/fde/xml/cfde_xmldoc.cpp b/xfa/fde/xml/cfde_xmldoc.cpp index 256164c5f8..fa44472098 100644 --- a/xfa/fde/xml/cfde_xmldoc.cpp +++ b/xfa/fde/xml/cfde_xmldoc.cpp @@ -9,6 +9,7 @@ #include <utility> #include <vector> +#include "core/fxcrt/fx_codepage.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fde/xml/cfde_xmlchardata.h" @@ -16,7 +17,6 @@ #include "xfa/fde/xml/cfde_xmlinstruction.h" #include "xfa/fde/xml/cfde_xmlnode.h" #include "xfa/fde/xml/cfde_xmltext.h" -#include "xfa/fgas/crt/fgas_codepage.h" CFDE_XMLDoc::CFDE_XMLDoc() : m_iStatus(0), m_pRoot(pdfium::MakeUnique<CFDE_XMLNode>()) { @@ -47,8 +47,9 @@ void CFDE_XMLDoc::CloseXML() { m_pXMLParser.reset(); } -void CFDE_XMLDoc::SaveXMLNode(const CFX_RetainPtr<CFGAS_Stream>& pXMLStream, - CFDE_XMLNode* pINode) { +void CFDE_XMLDoc::SaveXMLNode( + const CFX_RetainPtr<CFX_SeekableStreamProxy>& pXMLStream, + CFDE_XMLNode* pINode) { CFDE_XMLNode* pNode = (CFDE_XMLNode*)pINode; switch (pNode->GetType()) { case FDE_XMLNODE_Instruction: { diff --git a/xfa/fde/xml/cfde_xmldoc.h b/xfa/fde/xml/cfde_xmldoc.h index b84c9c00a0..c9c7db41b7 100644 --- a/xfa/fde/xml/cfde_xmldoc.h +++ b/xfa/fde/xml/cfde_xmldoc.h @@ -10,9 +10,9 @@ #include <memory> #include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/cfx_seekablestreamproxy.h" #include "xfa/fde/xml/cfde_xmlnode.h" #include "xfa/fde/xml/cfde_xmlparser.h" -#include "xfa/fgas/crt/cfgas_stream.h" class CFDE_XMLDoc { public: @@ -24,14 +24,14 @@ class CFDE_XMLDoc { void CloseXML(); CFDE_XMLNode* GetRoot() const { return m_pRoot.get(); } - void SaveXMLNode(const CFX_RetainPtr<CFGAS_Stream>& pXMLStream, + void SaveXMLNode(const CFX_RetainPtr<CFX_SeekableStreamProxy>& pXMLStream, CFDE_XMLNode* pNode); private: int32_t m_iStatus; std::unique_ptr<CFDE_XMLNode> m_pRoot; std::unique_ptr<CFDE_XMLParser> m_pXMLParser; - CFX_RetainPtr<CFGAS_Stream> m_pStream; + CFX_RetainPtr<CFX_SeekableStreamProxy> m_pStream; }; #endif // XFA_FDE_XML_CFDE_XMLDOC_H_ diff --git a/xfa/fde/xml/cfde_xmlnode.cpp b/xfa/fde/xml/cfde_xmlnode.cpp index 149d18c3d6..c81de7623a 100644 --- a/xfa/fde/xml/cfde_xmlnode.cpp +++ b/xfa/fde/xml/cfde_xmlnode.cpp @@ -8,12 +8,12 @@ #include <vector> +#include "core/fxcrt/fx_codepage.h" #include "third_party/base/stl_util.h" #include "xfa/fde/xml/cfde_xmlchardata.h" #include "xfa/fde/xml/cfde_xmlelement.h" #include "xfa/fde/xml/cfde_xmlinstruction.h" #include "xfa/fde/xml/cfde_xmltext.h" -#include "xfa/fgas/crt/fgas_codepage.h" CFDE_XMLNode::CFDE_XMLNode() : m_pParent(nullptr), @@ -329,7 +329,8 @@ std::unique_ptr<CFDE_XMLNode> CFDE_XMLNode::Clone() { return nullptr; } -void CFDE_XMLNode::SaveXMLNode(const CFX_RetainPtr<CFGAS_Stream>& pXMLStream) { +void CFDE_XMLNode::SaveXMLNode( + const CFX_RetainPtr<CFX_SeekableStreamProxy>& pXMLStream) { CFDE_XMLNode* pNode = (CFDE_XMLNode*)this; switch (pNode->GetType()) { case FDE_XMLNODE_Instruction: { diff --git a/xfa/fde/xml/cfde_xmlnode.h b/xfa/fde/xml/cfde_xmlnode.h index a04bd8c812..71e1a712e0 100644 --- a/xfa/fde/xml/cfde_xmlnode.h +++ b/xfa/fde/xml/cfde_xmlnode.h @@ -10,7 +10,7 @@ #include <memory> #include "core/fxcrt/cfx_retain_ptr.h" -#include "xfa/fgas/crt/cfgas_stream.h" +#include "core/fxcrt/cfx_seekablestreamproxy.h" enum FDE_XMLNODETYPE { FDE_XMLNODE_Unknown = 0, @@ -64,7 +64,7 @@ class CFDE_XMLNode { bool InsertNodeItem(CFDE_XMLNode::NodeItem eItem, CFDE_XMLNode* pNode); CFDE_XMLNode* RemoveNodeItem(CFDE_XMLNode::NodeItem eItem); - void SaveXMLNode(const CFX_RetainPtr<CFGAS_Stream>& pXMLStream); + void SaveXMLNode(const CFX_RetainPtr<CFX_SeekableStreamProxy>& pXMLStream); CFDE_XMLNode* m_pParent; CFDE_XMLNode* m_pChild; diff --git a/xfa/fde/xml/cfde_xmlparser.cpp b/xfa/fde/xml/cfde_xmlparser.cpp index c29dfc38ab..c8b300f81d 100644 --- a/xfa/fde/xml/cfde_xmlparser.cpp +++ b/xfa/fde/xml/cfde_xmlparser.cpp @@ -14,8 +14,9 @@ #include "xfa/fde/xml/cfde_xmlnode.h" #include "xfa/fde/xml/cfde_xmltext.h" -CFDE_XMLParser::CFDE_XMLParser(CFDE_XMLNode* pParent, - const CFX_RetainPtr<CFGAS_Stream>& pStream) +CFDE_XMLParser::CFDE_XMLParser( + CFDE_XMLNode* pParent, + const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream) : m_nElementStart(0), m_dwCheckStatus(0), m_dwCurrentCheckStatus(0), diff --git a/xfa/fde/xml/cfde_xmlparser.h b/xfa/fde/xml/cfde_xmlparser.h index f1a7888fa7..14b2127068 100644 --- a/xfa/fde/xml/cfde_xmlparser.h +++ b/xfa/fde/xml/cfde_xmlparser.h @@ -16,13 +16,13 @@ class CFDE_XMLElement; class CFDE_XMLNode; -class CFGAS_Stream; +class CFX_SeekableStreamProxy; class IFX_Pause; class CFDE_XMLParser { public: CFDE_XMLParser(CFDE_XMLNode* pParent, - const CFX_RetainPtr<CFGAS_Stream>& pStream); + const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream); ~CFDE_XMLParser(); int32_t DoParser(IFX_Pause* pPause); @@ -34,7 +34,7 @@ class CFDE_XMLParser { uint16_t m_dwCurrentCheckStatus; private: - CFX_RetainPtr<CFGAS_Stream> m_pStream; + CFX_RetainPtr<CFX_SeekableStreamProxy> m_pStream; std::unique_ptr<CFDE_XMLSyntaxParser> m_pParser; CFDE_XMLNode* m_pParent; CFDE_XMLNode* m_pChild; diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser.cpp b/xfa/fde/xml/cfde_xmlsyntaxparser.cpp index 10eefdc012..5d671bb39a 100644 --- a/xfa/fde/xml/cfde_xmlsyntaxparser.cpp +++ b/xfa/fde/xml/cfde_xmlsyntaxparser.cpp @@ -80,7 +80,7 @@ int32_t GetUTF8EncodeLength(const std::vector<wchar_t>& src, } // namespace CFDE_XMLSyntaxParser::CFDE_XMLSyntaxParser( - const CFX_RetainPtr<CFGAS_Stream>& pStream) + const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream) : m_pStream(pStream), m_iXMLPlaneSize(32 * 1024), m_iCurrentPos(0), @@ -145,7 +145,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() { m_ParsedChars += m_End; m_iParsedBytes = m_iCurrentPos; if (m_pStream->GetPosition() != m_iCurrentPos) - m_pStream->Seek(CFGAS_Stream::Pos::Begin, m_iCurrentPos); + m_pStream->Seek(CFX_SeekableStreamProxy::Pos::Begin, m_iCurrentPos); m_iBufferChars = m_pStream->ReadString(m_Buffer.data(), m_iXMLPlaneSize, &m_bEOS); diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser.h b/xfa/fde/xml/cfde_xmlsyntaxparser.h index aa4e91827e..8b6c9ac8b5 100644 --- a/xfa/fde/xml/cfde_xmlsyntaxparser.h +++ b/xfa/fde/xml/cfde_xmlsyntaxparser.h @@ -12,9 +12,9 @@ #include "core/fxcrt/cfx_blockbuffer.h" #include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/cfx_seekablestreamproxy.h" #include "core/fxcrt/fx_string.h" #include "xfa/fde/xml/cfde_xmlnode.h" -#include "xfa/fgas/crt/cfgas_stream.h" enum class FDE_XmlSyntaxResult { None, @@ -36,7 +36,8 @@ enum class FDE_XmlSyntaxResult { class CFDE_XMLSyntaxParser { public: - explicit CFDE_XMLSyntaxParser(const CFX_RetainPtr<CFGAS_Stream>& pStream); + explicit CFDE_XMLSyntaxParser( + const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream); ~CFDE_XMLSyntaxParser(); FDE_XmlSyntaxResult DoSyntaxParse(); @@ -97,7 +98,7 @@ class CFDE_XMLSyntaxParser { void ParseTextChar(wchar_t ch); - CFX_RetainPtr<CFGAS_Stream> m_pStream; + CFX_RetainPtr<CFX_SeekableStreamProxy> m_pStream; FX_STRSIZE m_iXMLPlaneSize; int32_t m_iCurrentPos; int32_t m_iCurrentNodeNum; diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp index aecb3ee39e..45ad3bb2f0 100644 --- a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp +++ b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp @@ -6,10 +6,10 @@ #include <memory> +#include "core/fxcrt/cfx_seekablestreamproxy.h" +#include "core/fxcrt/fx_codepage.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/test_support.h" -#include "xfa/fgas/crt/cfgas_stream.h" -#include "xfa/fgas/crt/fgas_codepage.h" class CFDE_XMLSyntaxParserTest : public pdfium::FPDF_Test {}; @@ -28,8 +28,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, CData) { L" app.alert(\"Tclams\");\n" L" "; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -75,8 +76,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, CDataWithInnerScript) { L" </script>\n" L" "; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -111,8 +113,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangArrow) { " <!>\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -145,8 +148,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangBracketArrow) { " <![>\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -174,8 +178,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, IncompleteCData) { " <![CDATA>\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -203,8 +208,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, UnClosedCData) { " <![CDATA[\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -232,8 +238,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, EmptyCData) { " <![CDATA[]]>\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -268,8 +275,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, Comment) { " <!-- A Comment -->\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -301,8 +309,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, IncorrectCommentStart) { " <!- A Comment -->\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -334,8 +343,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentEmpty) { " <!---->\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -367,8 +377,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentThreeDash) { " <!--->\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -394,8 +405,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentTwoDash) { " <!-->\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -425,8 +437,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, Entities) { "�" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -456,8 +469,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowHex) { "�" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -487,8 +501,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowDecimal) { "�" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index 8cd799e37a..d1c4b3d580 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -10,6 +10,7 @@ #include <memory> #include <utility> +#include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_stream.h" #include "core/fxge/cfx_fontmapper.h" #include "core/fxge/cfx_fontmgr.h" @@ -17,7 +18,6 @@ #include "core/fxge/ifx_systemfontinfo.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" -#include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fgas/font/cfgas_gefont.h" #include "xfa/fgas/font/fgas_fontutils.h" diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index 8a3705335e..cca999a869 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -14,11 +14,11 @@ #include <vector> #include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/cfx_seekablestreamproxy.h" #include "core/fxcrt/fx_ext.h" #include "core/fxge/cfx_fontmapper.h" #include "core/fxge/fx_freetype.h" #include "core/fxge/ifx_systemfontinfo.h" -#include "xfa/fgas/crt/cfgas_stream.h" #define FX_FONTSTYLE_Normal 0x00 #define FX_FONTSTYLE_FixedPitch 0x01 diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp index fdeb2ce533..ab773698e7 100644 --- a/xfa/fgas/font/cfgas_gefont.cpp +++ b/xfa/fgas/font/cfgas_gefont.cpp @@ -9,11 +9,11 @@ #include <memory> #include <utility> +#include "core/fxcrt/fx_codepage.h" #include "core/fxge/cfx_substfont.h" #include "core/fxge/cfx_unicodeencoding.h" #include "core/fxge/cfx_unicodeencodingex.h" #include "third_party/base/ptr_util.h" -#include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fgas/font/fgas_fontutils.h" #include "xfa/fxfa/cxfa_fontmgr.h" diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h index 6c9f2a168d..ba2e6e69a5 100644 --- a/xfa/fgas/font/cfgas_gefont.h +++ b/xfa/fgas/font/cfgas_gefont.h @@ -67,8 +67,9 @@ class CFGAS_GEFont : public CFX_Retainable { uint32_t dwFontStyles, uint16_t wCodePage); bool LoadFontInternal(const uint8_t* pBuffer, int32_t length); - bool LoadFontInternal(const CFX_RetainPtr<CFGAS_Stream>& pFontStream, - bool bSaveStream); + bool LoadFontInternal( + const CFX_RetainPtr<CFX_SeekableStreamProxy>& pFontStream, + bool bSaveStream); #endif bool LoadFontInternal(CFX_Font* pExternalFont); bool LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont); @@ -95,7 +96,7 @@ class CFGAS_GEFont : public CFX_Retainable { CFX_RetainPtr<CFGAS_GEFont> m_pSrcFont; // Only set by ctor, so no cycles. CFGAS_FontMgr* const m_pFontMgr; bool m_bExternalFont; - CFX_RetainPtr<CFGAS_Stream> m_pStream; + CFX_RetainPtr<CFX_SeekableStreamProxy> m_pStream; CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead; std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding; std::map<wchar_t, int32_t> m_CharWidthMap; diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp index 4dc599cd4b..f5673de56b 100644 --- a/xfa/fgas/font/fgas_fontutils.cpp +++ b/xfa/fgas/font/fgas_fontutils.cpp @@ -6,8 +6,8 @@ #include "xfa/fgas/font/fgas_fontutils.h" +#include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_ext.h" -#include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fgas/font/cfgas_fontmgr.h" namespace { diff --git a/xfa/fxfa/app/cxfa_textparser.cpp b/xfa/fxfa/app/cxfa_textparser.cpp index 6f394dd5e2..1243f5b7ea 100644 --- a/xfa/fxfa/app/cxfa_textparser.cpp +++ b/xfa/fxfa/app/cxfa_textparser.cpp @@ -10,6 +10,7 @@ #include <utility> #include <vector> +#include "core/fxcrt/fx_codepage.h" #include "third_party/base/ptr_util.h" #include "xfa/fde/css/cfde_csscomputedstyle.h" #include "xfa/fde/css/cfde_cssstyleselector.h" @@ -17,7 +18,6 @@ #include "xfa/fde/css/fde_css.h" #include "xfa/fde/xml/cfde_xmlelement.h" #include "xfa/fde/xml/cfde_xmlnode.h" -#include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fgas/font/cfgas_fontmgr.h" #include "xfa/fxfa/app/cxfa_csstagprovider.h" #include "xfa/fxfa/app/cxfa_textparsecontext.h" diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 629cd509e8..9af45e62df 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -6,8 +6,8 @@ #include "xfa/fxfa/app/xfa_fwltheme.h" +#include "core/fxcrt/fx_codepage.h" #include "xfa/fde/cfde_textout.h" -#include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fgas/font/cfgas_gefont.h" #include "xfa/fwl/cfwl_barcode.h" #include "xfa/fwl/cfwl_caret.h" diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index 442195b1dd..c1eda8d9e6 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -9,11 +9,11 @@ #include <vector> #include "core/fxcrt/fx_basic.h" +#include "core/fxcrt/fx_codepage.h" #include "third_party/base/stl_util.h" #include "xfa/fde/xml/cfde_xmldoc.h" #include "xfa/fde/xml/cfde_xmlelement.h" #include "xfa/fde/xml/cfde_xmlnode.h" -#include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_widgetdata.h" @@ -226,7 +226,8 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, CFX_RetainPtr<IFX_MemoryStream> pMemStream = IFX_MemoryStream::Create(true); - auto pTempStream = pdfium::MakeRetain<CFGAS_Stream>(pMemStream, true); + auto pTempStream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>(pMemStream, true); pTempStream->SetCodePage(FX_CODEPAGE_UTF8); pRichTextXML->SaveXMLNode(pTempStream); @@ -341,9 +342,10 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, } } -void RegenerateFormFile_Container(CXFA_Node* pNode, - const CFX_RetainPtr<CFGAS_Stream>& pStream, - bool bSaveXML) { +void RegenerateFormFile_Container( + CXFA_Node* pNode, + const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream, + bool bSaveXML) { XFA_Element eType = pNode->GetElementType(); if (eType == XFA_Element::Field || eType == XFA_Element::Draw || !pNode->IsContainerNode()) { @@ -399,7 +401,7 @@ void RegenerateFormFile_Container(CXFA_Node* pNode, void XFA_DataExporter_RegenerateFormFile( CXFA_Node* pNode, - const CFX_RetainPtr<CFGAS_Stream>& pStream, + const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream, const char* pChecksum, bool bSaveXML) { if (pNode->IsModelNode()) { @@ -485,15 +487,16 @@ bool CXFA_DataExporter::Export(const CFX_RetainPtr<IFX_SeekableStream>& pWrite, if (!pWrite) return false; - auto pStream = pdfium::MakeRetain<CFGAS_Stream>(pWrite, true); + auto pStream = pdfium::MakeRetain<CFX_SeekableStreamProxy>(pWrite, true); pStream->SetCodePage(FX_CODEPAGE_UTF8); return Export(pStream, pNode, dwFlag, pChecksum); } -bool CXFA_DataExporter::Export(const CFX_RetainPtr<CFGAS_Stream>& pStream, - CXFA_Node* pNode, - uint32_t dwFlag, - const char* pChecksum) { +bool CXFA_DataExporter::Export( + const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream, + CXFA_Node* pNode, + uint32_t dwFlag, + const char* pChecksum) { CFDE_XMLDoc* pXMLDoc = m_pDocument->GetXMLDoc(); if (pNode->IsModelNode()) { switch (pNode->GetPacketID()) { diff --git a/xfa/fxfa/parser/cxfa_dataexporter.h b/xfa/fxfa/parser/cxfa_dataexporter.h index c7e5c7b70b..cd949be964 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.h +++ b/xfa/fxfa/parser/cxfa_dataexporter.h @@ -13,7 +13,7 @@ class CXFA_Document; class CXFA_Node; class IFX_SeekableStream; -class CFGAS_Stream; +class CFX_SeekableStreamProxy; class CXFA_DataExporter { public: @@ -26,7 +26,7 @@ class CXFA_DataExporter { const char* pChecksum); private: - bool Export(const CFX_RetainPtr<CFGAS_Stream>& pStream, + bool Export(const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream, CXFA_Node* pNode, uint32_t dwFlag, const char* pChecksum); diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 26dc6bd831..83c05d1269 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -13,6 +13,7 @@ #include <vector> #include "core/fxcrt/cfx_decimal.h" +#include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_ext.h" #include "fxjs/cfxjse_value.h" #include "third_party/base/ptr_util.h" @@ -20,7 +21,6 @@ #include "xfa/fde/xml/cfde_xmlelement.h" #include "xfa/fde/xml/cfde_xmlnode.h" #include "xfa/fde/xml/cfde_xmltext.h" -#include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/cxfa_eventparam.h" #include "xfa/fxfa/cxfa_ffwidget.h" @@ -1408,7 +1408,8 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { } CFX_RetainPtr<IFX_MemoryStream> pMemoryStream = IFX_MemoryStream::Create(true); - auto pStream = pdfium::MakeRetain<CFGAS_Stream>(pMemoryStream, true); + auto pStream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>(pMemoryStream, true); pStream->SetCodePage(FX_CODEPAGE_UTF8); pStream->WriteString(bsXMLHeader.AsStringC()); diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index 92196ec957..642b7641bd 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -10,6 +10,8 @@ #include <vector> #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 "third_party/base/ptr_util.h" #include "xfa/fde/xml/cfde_xmlchardata.h" @@ -19,8 +21,6 @@ #include "xfa/fde/xml/cfde_xmlnode.h" #include "xfa/fde/xml/cfde_xmlparser.h" #include "xfa/fde/xml/cfde_xmltext.h" -#include "xfa/fgas/crt/cfgas_stream.h" -#include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fxfa/fxfa.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_node.h" @@ -277,7 +277,7 @@ int32_t CXFA_SimpleParser::StartParse( XFA_XDPPACKET ePacketID) { CloseParser(); m_pFileRead = pStream; - m_pStream = pdfium::MakeRetain<CFGAS_Stream>(pStream, false); + m_pStream = pdfium::MakeRetain<CFX_SeekableStreamProxy>(pStream, false); uint16_t wCodePage = m_pStream->GetCodePage(); if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE && wCodePage != FX_CODEPAGE_UTF8) { @@ -319,7 +319,7 @@ CFDE_XMLNode* CXFA_SimpleParser::ParseXMLData(const CFX_ByteString& wsXML, CloseParser(); m_pXMLDoc = pdfium::MakeUnique<CFDE_XMLDoc>(); - auto pStream = pdfium::MakeRetain<CFGAS_Stream>( + auto pStream = pdfium::MakeRetain<CFX_SeekableStreamProxy>( const_cast<uint8_t*>(wsXML.raw_str()), wsXML.GetLength()); auto pParser = pdfium::MakeUnique<CFDE_XMLParser>(m_pXMLDoc->GetRoot(), pStream); diff --git a/xfa/fxfa/parser/cxfa_simple_parser.h b/xfa/fxfa/parser/cxfa_simple_parser.h index 32b5518fab..88a7679e74 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.h +++ b/xfa/fxfa/parser/cxfa_simple_parser.h @@ -19,7 +19,7 @@ class CFDE_XMLNode; class CFDE_XMLParser; class IFX_SeekableStream; class IFX_Pause; -class CFGAS_Stream; +class CFX_SeekableStreamProxy; class CXFA_SimpleParser { public: @@ -78,7 +78,7 @@ class CXFA_SimpleParser { CFDE_XMLParser* m_pXMLParser; std::unique_ptr<CFDE_XMLDoc> m_pXMLDoc; - CFX_RetainPtr<CFGAS_Stream> m_pStream; + CFX_RetainPtr<CFX_SeekableStreamProxy> m_pStream; CFX_RetainPtr<IFX_SeekableStream> m_pFileRead; CXFA_Document* m_pFactory; CXFA_Node* m_pRootNode; diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h index ae51c8fdc6..80f6d096ed 100644 --- a/xfa/fxfa/parser/xfa_utils.h +++ b/xfa/fxfa/parser/xfa_utils.h @@ -7,7 +7,7 @@ #ifndef XFA_FXFA_PARSER_XFA_UTILS_H_ #define XFA_FXFA_PARSER_XFA_UTILS_H_ -#include "xfa/fgas/crt/cfgas_stream.h" +#include "core/fxcrt/cfx_seekablestreamproxy.h" #include "xfa/fxfa/fxfa_basic.h" class CFDE_XMLElement; @@ -155,7 +155,7 @@ bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode); void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode); void XFA_DataExporter_RegenerateFormFile( CXFA_Node* pNode, - const CFX_RetainPtr<CFGAS_Stream>& pStream, + const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream, const char* pChecksum = nullptr, bool bSaveXML = false); |