summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_simple_parser.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-07 12:10:20 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-07 12:10:20 -0800
commit7cda31ac2f2884166f044937619478a6103198cf (patch)
tree640f14ab5c81696cfffdedf0644eac4b1f2bc47f /xfa/fxfa/parser/cxfa_simple_parser.cpp
parentab5a20d9de8c801b8376bfe2d6f7cf9ac7d26028 (diff)
downloadpdfium-7cda31ac2f2884166f044937619478a6103198cf.tar.xz
Refcount IFGAS_ streams all the time, too
IFGAS_Streams are not part of the IFX_Stream hierarchy, but can be made from such. Review-Url: https://codereview.chromium.org/2559763002
Diffstat (limited to 'xfa/fxfa/parser/cxfa_simple_parser.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp
index 2329e86874..9eca652db7 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -7,6 +7,7 @@
#include "xfa/fxfa/parser/cxfa_simple_parser.h"
#include "core/fxcrt/fx_ext.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/cxfa_document.h"
@@ -282,8 +283,8 @@ int32_t CXFA_SimpleParser::StartParse(
XFA_XDPPACKET ePacketID) {
CloseParser();
m_pFileRead = pStream;
- m_pStream.reset(IFGAS_Stream::CreateStream(
- pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text));
+ m_pStream = IFGAS_Stream::CreateStream(
+ pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text);
if (!m_pStream)
return XFA_PARSESTATUS_StreamErr;
@@ -293,7 +294,7 @@ int32_t CXFA_SimpleParser::StartParse(
m_pStream->SetCodePage(FX_CODEPAGE_UTF8);
}
m_pXMLDoc.reset(new CFDE_XMLDoc);
- m_pXMLParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), m_pStream.get());
+ m_pXMLParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), m_pStream);
if (!m_pXMLDoc->LoadXML(m_pXMLParser))
return XFA_PARSESTATUS_StatusErr;
@@ -313,10 +314,10 @@ int32_t CXFA_SimpleParser::DoParse(IFX_Pause* pPause) {
m_pRootNode = ParseAsXDPPacket(GetDocumentNode(m_pXMLDoc.get()), m_ePacketID);
m_pXMLDoc->CloseXML();
- m_pStream.reset();
-
+ m_pStream.Reset();
if (!m_pRootNode)
return XFA_PARSESTATUS_StatusErr;
+
return XFA_PARSESTATUS_Done;
}
@@ -326,10 +327,9 @@ int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML,
CloseParser();
pXMLNode = nullptr;
- std::unique_ptr<IFGAS_Stream> pStream(new CXFA_WideTextRead(wsXML));
- m_pXMLDoc.reset(new CFDE_XMLDoc);
- CXFA_XMLParser* pParser =
- new CXFA_XMLParser(m_pXMLDoc->GetRoot(), pStream.get());
+ auto pStream = pdfium::MakeRetain<CXFA_WideTextRead>(wsXML);
+ m_pXMLDoc = pdfium::MakeUnique<CFDE_XMLDoc>();
+ CXFA_XMLParser* pParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), pStream);
pParser->m_dwCheckStatus = 0x03;
if (!m_pXMLDoc->LoadXML(pParser))
return XFA_PARSESTATUS_StatusErr;
@@ -1306,5 +1306,5 @@ void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode,
void CXFA_SimpleParser::CloseParser() {
m_pXMLDoc.reset();
- m_pStream.reset();
+ m_pStream.Reset();
}