diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-04-18 16:35:55 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-18 20:50:08 +0000 |
commit | bf510b7c520bccbd2edf5bb3e2f91b125ebfd6d7 (patch) | |
tree | 6ffafd1e5fcc767f5a4160d290e0b5f72d2ce271 /xfa/fxfa | |
parent | fdf7d4092a5fa9c79bbb4a626a4d3d087053ae2c (diff) | |
download | pdfium-bf510b7c520bccbd2edf5bb3e2f91b125ebfd6d7.tar.xz |
Rename IFGAS_Stream to CFGAS_Stream
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 <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa')
-rw-r--r-- | xfa/fxfa/parser/cxfa_dataexporter.cpp | 18 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_dataexporter.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 9 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_simple_parser.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_simple_parser.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_utils.h | 4 |
6 files changed, 18 insertions, 33 deletions
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<IFX_MemoryStream> pMemStream = IFX_MemoryStream::Create(true); - CFX_RetainPtr<IFGAS_Stream> pTempStream = - IFGAS_Stream::CreateWriteStream(pMemStream); + auto pTempStream = pdfium::MakeRetain<CFGAS_Stream>(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<IFGAS_Stream>& pStream, - bool bSaveXML = false) { + const CFX_RetainPtr<CFGAS_Stream>& 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<IFGAS_Stream>& pStream, + const CFX_RetainPtr<CFGAS_Stream>& 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"</form\n>"); @@ -486,15 +485,12 @@ bool CXFA_DataExporter::Export(const CFX_RetainPtr<IFX_SeekableStream>& pWrite, if (!pWrite) return false; - CFX_RetainPtr<IFGAS_Stream> pStream = IFGAS_Stream::CreateWriteStream(pWrite); - if (!pStream) - return false; - + auto pStream = pdfium::MakeRetain<CFGAS_Stream>(pWrite, true); pStream->SetCodePage(FX_CODEPAGE_UTF8); return Export(pStream, pNode, dwFlag, pChecksum); } -bool CXFA_DataExporter::Export(const CFX_RetainPtr<IFGAS_Stream>& pStream, +bool CXFA_DataExporter::Export(const CFX_RetainPtr<CFGAS_Stream>& 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<IFGAS_Stream>& pStream, + bool Export(const CFX_RetainPtr<CFGAS_Stream>& 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<IFX_MemoryStream> pMemoryStream = IFX_MemoryStream::Create(true); - CFX_RetainPtr<IFGAS_Stream> pStream = - IFGAS_Stream::CreateWriteStream(pMemoryStream); - - if (!pStream) { - pArguments->GetReturnValue()->SetString( - bsXMLHeader.UTF8Encode().AsStringC()); - return; - } + auto pStream = pdfium::MakeRetain<CFGAS_Stream>(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<CFGAS_Stream>(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<CFDE_XMLDoc>(); - CFX_RetainPtr<IFGAS_Stream> pStream = - IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create( - const_cast<uint8_t*>(wsXML.raw_str()), wsXML.GetLength())); + auto pStream = pdfium::MakeRetain<CFGAS_Stream>( + const_cast<uint8_t*>(wsXML.raw_str()), wsXML.GetLength()); auto pParser = pdfium::MakeUnique<CFDE_XMLParser>(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<CFDE_XMLDoc> m_pXMLDoc; - CFX_RetainPtr<IFGAS_Stream> m_pStream; + CFX_RetainPtr<CFGAS_Stream> 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 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<IFGAS_Stream>& pStream, + const CFX_RetainPtr<CFGAS_Stream>& pStream, const char* pChecksum = nullptr, bool bSaveXML = false); |