From 3b71d26f092ebc86ca9177fbbe89d83caa67ae1b Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 19 Apr 2017 08:58:54 -0400 Subject: Move CFGAS_Stream to CFX_SeekableStreamProxy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Tom Sepez Reviewed-by: Nicolás Peña --- xfa/fxfa/app/cxfa_textparser.cpp | 2 +- xfa/fxfa/app/xfa_fwltheme.cpp | 2 +- xfa/fxfa/parser/cxfa_dataexporter.cpp | 25 ++++++++++++++----------- xfa/fxfa/parser/cxfa_dataexporter.h | 4 ++-- xfa/fxfa/parser/cxfa_node.cpp | 5 +++-- xfa/fxfa/parser/cxfa_simple_parser.cpp | 8 ++++---- xfa/fxfa/parser/cxfa_simple_parser.h | 4 ++-- xfa/fxfa/parser/xfa_utils.h | 4 ++-- 8 files changed, 29 insertions(+), 25 deletions(-) (limited to 'xfa/fxfa') 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 #include +#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 #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 pMemStream = IFX_MemoryStream::Create(true); - auto pTempStream = pdfium::MakeRetain(pMemStream, true); + auto pTempStream = + pdfium::MakeRetain(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& pStream, - bool bSaveXML) { +void RegenerateFormFile_Container( + CXFA_Node* pNode, + const CFX_RetainPtr& 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& pStream, + const CFX_RetainPtr& pStream, const char* pChecksum, bool bSaveXML) { if (pNode->IsModelNode()) { @@ -485,15 +487,16 @@ bool CXFA_DataExporter::Export(const CFX_RetainPtr& pWrite, if (!pWrite) return false; - auto pStream = pdfium::MakeRetain(pWrite, true); + auto pStream = pdfium::MakeRetain(pWrite, true); pStream->SetCodePage(FX_CODEPAGE_UTF8); return Export(pStream, pNode, dwFlag, pChecksum); } -bool CXFA_DataExporter::Export(const CFX_RetainPtr& pStream, - CXFA_Node* pNode, - uint32_t dwFlag, - const char* pChecksum) { +bool CXFA_DataExporter::Export( + const CFX_RetainPtr& 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& pStream, + bool Export(const CFX_RetainPtr& 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 #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 pMemoryStream = IFX_MemoryStream::Create(true); - auto pStream = pdfium::MakeRetain(pMemoryStream, true); + auto pStream = + pdfium::MakeRetain(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 #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(pStream, false); + m_pStream = pdfium::MakeRetain(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(); - auto pStream = pdfium::MakeRetain( + auto pStream = pdfium::MakeRetain( const_cast(wsXML.raw_str()), wsXML.GetLength()); auto pParser = pdfium::MakeUnique(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 m_pXMLDoc; - CFX_RetainPtr m_pStream; + CFX_RetainPtr m_pStream; CFX_RetainPtr 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& pStream, + const CFX_RetainPtr& pStream, const char* pChecksum = nullptr, bool bSaveXML = false); -- cgit v1.2.3