From bf510b7c520bccbd2edf5bb3e2f91b125ebfd6d7 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 18 Apr 2017 16:35:55 -0400 Subject: Rename IFGAS_Stream to CFGAS_Stream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL replaces IFGAS_Stream with the only implementation CFGAS_Stream. The CreateReadStream and CreateWriteStream methods are removed in favour of calling MakeRetain directly. Change-Id: I882a89258f642e24fc3d631587db05652bd53ded Reviewed-on: https://pdfium-review.googlesource.com/4210 Commit-Queue: dsinclair Reviewed-by: Nicolás Peña Reviewed-by: Tom Sepez --- xfa/fxfa/parser/cxfa_dataexporter.cpp | 18 +++++++----------- xfa/fxfa/parser/cxfa_dataexporter.h | 4 ++-- xfa/fxfa/parser/cxfa_node.cpp | 9 +-------- xfa/fxfa/parser/cxfa_simple_parser.cpp | 12 ++++-------- xfa/fxfa/parser/cxfa_simple_parser.h | 4 ++-- xfa/fxfa/parser/xfa_utils.h | 4 ++-- 6 files changed, 18 insertions(+), 33 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index 4e3b0b3ffa..442195b1dd 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -226,8 +226,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, CFX_RetainPtr pMemStream = IFX_MemoryStream::Create(true); - CFX_RetainPtr pTempStream = - IFGAS_Stream::CreateWriteStream(pMemStream); + auto pTempStream = pdfium::MakeRetain(pMemStream, true); pTempStream->SetCodePage(FX_CODEPAGE_UTF8); pRichTextXML->SaveXMLNode(pTempStream); @@ -343,8 +342,8 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, } void RegenerateFormFile_Container(CXFA_Node* pNode, - const CFX_RetainPtr& pStream, - bool bSaveXML = false) { + const CFX_RetainPtr& pStream, + bool bSaveXML) { XFA_Element eType = pNode->GetElementType(); if (eType == XFA_Element::Field || eType == XFA_Element::Draw || !pNode->IsContainerNode()) { @@ -400,7 +399,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()) { @@ -428,7 +427,7 @@ void XFA_DataExporter_RegenerateFormFile( CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pChildNode) { - RegenerateFormFile_Container(pChildNode, pStream); + RegenerateFormFile_Container(pChildNode, pStream, false); pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling); } pStream->WriteString(L""); @@ -486,15 +485,12 @@ bool CXFA_DataExporter::Export(const CFX_RetainPtr& pWrite, if (!pWrite) return false; - CFX_RetainPtr pStream = IFGAS_Stream::CreateWriteStream(pWrite); - if (!pStream) - return false; - + 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, +bool CXFA_DataExporter::Export(const CFX_RetainPtr& pStream, CXFA_Node* pNode, uint32_t dwFlag, const char* pChecksum) { diff --git a/xfa/fxfa/parser/cxfa_dataexporter.h b/xfa/fxfa/parser/cxfa_dataexporter.h index 8f405b188d..c7e5c7b70b 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 IFGAS_Stream; +class CFGAS_Stream; 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 90e93fbda5..26dc6bd831 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -1408,14 +1408,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { } CFX_RetainPtr pMemoryStream = IFX_MemoryStream::Create(true); - CFX_RetainPtr pStream = - IFGAS_Stream::CreateWriteStream(pMemoryStream); - - if (!pStream) { - pArguments->GetReturnValue()->SetString( - bsXMLHeader.UTF8Encode().AsStringC()); - return; - } + 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 1ebed10b4d..92196ec957 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -19,8 +19,8 @@ #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/fgas/crt/ifgas_stream.h" #include "xfa/fxfa/fxfa.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_node.h" @@ -277,10 +277,7 @@ int32_t CXFA_SimpleParser::StartParse( XFA_XDPPACKET ePacketID) { CloseParser(); m_pFileRead = pStream; - m_pStream = IFGAS_Stream::CreateReadStream(pStream); - if (!m_pStream) - return XFA_PARSESTATUS_StreamErr; - + 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) { @@ -322,9 +319,8 @@ CFDE_XMLNode* CXFA_SimpleParser::ParseXMLData(const CFX_ByteString& wsXML, CloseParser(); m_pXMLDoc = pdfium::MakeUnique(); - CFX_RetainPtr pStream = - IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create( - const_cast(wsXML.raw_str()), wsXML.GetLength())); + auto pStream = pdfium::MakeRetain( + const_cast(wsXML.raw_str()), wsXML.GetLength()); auto pParser = pdfium::MakeUnique(m_pXMLDoc->GetRoot(), pStream); pParser->m_dwCheckStatus = 0x03; diff --git a/xfa/fxfa/parser/cxfa_simple_parser.h b/xfa/fxfa/parser/cxfa_simple_parser.h index 7671e8d740..32b5518fab 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 IFGAS_Stream; +class CFGAS_Stream; 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 36d62c7602..ae51c8fdc6 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/ifgas_stream.h" +#include "xfa/fgas/crt/cfgas_stream.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