summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_parser_imp.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-16 15:42:58 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-16 15:42:58 -0700
commitfa34e805fd03ba81bcfe1148cf96b24fe63b39a0 (patch)
treeeb9ca58d4b4e327da346491f107d9b54925c18e3 /xfa/fxfa/parser/xfa_parser_imp.cpp
parent44d83f3f0b90f4c53ca42115d4f1ed614b25c3a7 (diff)
downloadpdfium-fa34e805fd03ba81bcfe1148cf96b24fe63b39a0.tar.xz
Replace Release() { delete this; } in fde_xml_imp.h
Review-Url: https://codereview.chromium.org/1981003002
Diffstat (limited to 'xfa/fxfa/parser/xfa_parser_imp.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_parser_imp.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp
index 01ea1d6fae..bb4ba864d5 100644
--- a/xfa/fxfa/parser/xfa_parser_imp.cpp
+++ b/xfa/fxfa/parser/xfa_parser_imp.cpp
@@ -680,10 +680,9 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data(
CXFA_Node* pNode =
m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_ELEMENT_DataGroup);
if (!pNode) {
- if (pDataXMLNode != pXMLDocumentNode) {
- pDataXMLNode->Release();
- }
- return NULL;
+ if (pDataXMLNode != pXMLDocumentNode)
+ delete pDataXMLNode;
+ return nullptr;
}
CFX_WideString wsLocalName;
static_cast<CFDE_XMLElement*>(pDataXMLNode)->GetLocalTagName(wsLocalName);
@@ -1335,13 +1334,11 @@ void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode,
}
}
void CXFA_SimpleParser::CloseParser() {
- if (m_pXMLDoc) {
- m_pXMLDoc->Release();
- m_pXMLDoc = NULL;
- }
+ delete m_pXMLDoc;
+ m_pXMLDoc = nullptr;
if (m_pStream) {
m_pStream->Release();
- m_pStream = NULL;
+ m_pStream = nullptr;
}
}
@@ -1410,17 +1407,16 @@ CXFA_XMLParser::CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream)
m_syntaxParserResult(FDE_XmlSyntaxResult::None) {
ASSERT(m_pParent && m_pStream);
m_NodeStack.Push(m_pParent);
- m_pParser = new CFDE_XMLSyntaxParser;
+ m_pParser.reset(new CFDE_XMLSyntaxParser);
m_pParser->Init(m_pStream, 32 * 1024, 1024 * 1024);
}
+
CXFA_XMLParser::~CXFA_XMLParser() {
- if (m_pParser) {
- m_pParser->Release();
- }
m_NodeStack.RemoveAll();
m_ws1.clear();
m_ws2.clear();
}
+
int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) {
if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error)
return -1;