From fdf7d4092a5fa9c79bbb4a626a4d3d087053ae2c Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 18 Apr 2017 15:25:58 -0400 Subject: Remove IFGAS_Stream::CreateWideStringReadStream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl removes the wide string read stream and passes through a memory stream as needed. The callers were updated to pass the correct types. Change-Id: I8e2660859a85e38ed1c3f4c596ef7c8242762084 Reviewed-on: https://pdfium-review.googlesource.com/4172 Commit-Queue: dsinclair Reviewed-by: Tom Sepez Reviewed-by: Nicolás Peña --- xfa/fxfa/parser/cxfa_simple_parser.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_simple_parser.cpp') diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index 806e5445a0..1ebed10b4d 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -317,30 +317,24 @@ int32_t CXFA_SimpleParser::DoParse(IFX_Pause* pPause) { return XFA_PARSESTATUS_Done; } -int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML, - CFDE_XMLNode*& pXMLNode, - IFX_Pause* pPause) { +CFDE_XMLNode* CXFA_SimpleParser::ParseXMLData(const CFX_ByteString& wsXML, + IFX_Pause* pPause) { CloseParser(); - pXMLNode = nullptr; m_pXMLDoc = pdfium::MakeUnique(); + CFX_RetainPtr pStream = - IFGAS_Stream::CreateWideStringReadStream(wsXML); + IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create( + const_cast(wsXML.raw_str()), wsXML.GetLength())); auto pParser = pdfium::MakeUnique(m_pXMLDoc->GetRoot(), pStream); pParser->m_dwCheckStatus = 0x03; if (!m_pXMLDoc->LoadXML(std::move(pParser))) - return XFA_PARSESTATUS_StatusErr; + return nullptr; int32_t iRet = m_pXMLDoc->DoLoad(pPause); if (iRet < 0 || iRet >= 100) m_pXMLDoc->CloseXML(); - if (iRet < 0) - return XFA_PARSESTATUS_SyntaxErr; - if (iRet < 100) - return iRet / 2; - - pXMLNode = GetDocumentNode(m_pXMLDoc.get()); - return XFA_PARSESTATUS_Done; + return iRet < 100 ? nullptr : GetDocumentNode(m_pXMLDoc.get()); } void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, -- cgit v1.2.3