summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_object_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_object_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_object_imp.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_object_imp.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index 0fbde1f160..f9887825f5 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -120,10 +120,10 @@ CXFA_Node::~CXFA_Node() {
delete pNode;
pNode = pNext;
}
- if (m_pXMLNode && HasFlag(XFA_NODEFLAG_OwnXMLNode)) {
- m_pXMLNode->Release();
- }
+ if (m_pXMLNode && HasFlag(XFA_NODEFLAG_OwnXMLNode))
+ delete m_pXMLNode;
}
+
CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) {
CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_eNodeClass);
@@ -962,17 +962,12 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
if (iLength >= 3) {
bOverwrite = pArguments->GetInt32(2) == 0 ? FALSE : TRUE;
}
- IXFA_Parser* pParser = IXFA_Parser::Create(m_pDocument);
- if (!pParser) {
- return;
- }
+ std::unique_ptr<IXFA_Parser> pParser(IXFA_Parser::Create(m_pDocument));
CFDE_XMLNode* pXMLNode = NULL;
int32_t iParserStatus = pParser->ParseXMLData(wsExpression, pXMLNode, NULL);
- if (iParserStatus != XFA_PARSESTATUS_Done || !pXMLNode) {
- pParser->Release();
- pParser = NULL;
+ if (iParserStatus != XFA_PARSESTATUS_Done || !pXMLNode)
return;
- }
+
if (bIgnoreRoot &&
(pXMLNode->GetType() != FDE_XMLNODE_Element ||
XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLNode)))) {
@@ -1059,14 +1054,11 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
}
pFakeRoot->SetFlag(XFA_NODEFLAG_HasRemoved, false);
} else {
- if (pFakeXMLRoot) {
- pFakeXMLRoot->Release();
- pFakeXMLRoot = NULL;
- }
+ delete pFakeXMLRoot;
+ pFakeXMLRoot = nullptr;
}
- pParser->Release();
- pParser = NULL;
}
+
void CXFA_Node::Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments) {
}