Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: xfa/fde/xml/fde_xml_imp.cpp

Issue 1981003002: Replace Release() { delete this; } in fde_xml_imp.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: One more unique_ptr Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: xfa/fde/xml/fde_xml_imp.cpp
diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp
index 446db86950c3edc88a46aa2d93736158f031fa5b..5a1e15f0421b8aa83b6ff5f54370d2e80f843a26 100644
--- a/xfa/fde/xml/fde_xml_imp.cpp
+++ b/xfa/fde/xml/fde_xml_imp.cpp
@@ -77,15 +77,17 @@ CFDE_XMLNode::CFDE_XMLNode()
CFDE_XMLNode::~CFDE_XMLNode() {
DeleteChildren();
}
+
void CFDE_XMLNode::DeleteChildren() {
- CFDE_XMLNode *pChild = m_pChild, *pTemp;
- while (pChild != NULL) {
- pTemp = pChild->m_pNext;
- pChild->Release();
- pChild = pTemp;
+ CFDE_XMLNode* pChild = m_pChild;
+ while (pChild) {
+ CFDE_XMLNode* pNext = pChild->m_pNext;
+ delete pChild;
+ pChild = pNext;
}
- m_pChild = NULL;
+ m_pChild = nullptr;
}
+
int32_t CFDE_XMLNode::CountChildNodes() const {
int32_t iCount = 0;
CFDE_XMLNode* pChild = m_pChild;
@@ -860,23 +862,19 @@ void CFDE_XMLDoc::Reset(FX_BOOL bInitRoot) {
m_pRoot->DeleteChildren();
}
} else {
- if (m_pRoot != NULL) {
- m_pRoot->Release();
- m_pRoot = NULL;
- }
+ delete m_pRoot;
+ m_pRoot = nullptr;
}
ReleaseParser();
}
+
void CFDE_XMLDoc::ReleaseParser() {
- if (m_pXMLParser != NULL) {
- m_pXMLParser->Release();
- m_pXMLParser = NULL;
- }
- if (m_pSyntaxParser != NULL) {
- m_pSyntaxParser->Release();
- m_pSyntaxParser = NULL;
- }
+ delete m_pXMLParser;
+ m_pXMLParser = nullptr;
+ delete m_pSyntaxParser;
+ m_pSyntaxParser = nullptr;
}
+
FX_BOOL CFDE_XMLDoc::LoadXML(IFX_Stream* pXMLStream,
int32_t iXMLPlaneSize,
int32_t iTextDataSize,

Powered by Google App Engine
This is Rietveld 408576698