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

Unified Diff: xfa/fxfa/parser/xfa_document_serialize.cpp

Issue 1981003002: Replace Release() { delete this; } in fde_xml_imp.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Revert accident with editor. 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
« no previous file with comments | « xfa/fxfa/parser/xfa_document_imp.cpp ('k') | xfa/fxfa/parser/xfa_object_imp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/parser/xfa_document_serialize.cpp
diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp
index ef85d0e2660b843331df77cfdcff443b2161fa2c..2e300505b3cc3e1be2493606bc49c84e5da99226 100644
--- a/xfa/fxfa/parser/xfa_document_serialize.cpp
+++ b/xfa/fxfa/parser/xfa_document_serialize.cpp
@@ -6,6 +6,8 @@
#include "xfa/fxfa/parser/xfa_document_serialize.h"
+#include <memory>
+
#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
@@ -22,31 +24,26 @@ CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument)
: m_pDocument(pDocument) {
ASSERT(m_pDocument);
}
+
FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) {
- IXFA_Parser* pDataDocumentParser = IXFA_Parser::Create(m_pDocument);
- if (!pDataDocumentParser) {
- return FALSE;
- }
+ std::unique_ptr<IXFA_Parser> pDataDocumentParser(
+ IXFA_Parser::Create(m_pDocument));
if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) !=
XFA_PARSESTATUS_Ready) {
- pDataDocumentParser->Release();
return FALSE;
}
- if (pDataDocumentParser->DoParse(NULL) < XFA_PARSESTATUS_Done) {
- pDataDocumentParser->Release();
+ if (pDataDocumentParser->DoParse(nullptr) < XFA_PARSESTATUS_Done)
return FALSE;
- }
+
CXFA_Node* pImportDataRoot = pDataDocumentParser->GetRootNode();
- if (!pImportDataRoot) {
- pDataDocumentParser->Release();
+ if (!pImportDataRoot)
return FALSE;
- }
+
CXFA_Node* pDataModel =
ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets));
- if (!pDataModel) {
- pDataDocumentParser->Release();
+ if (!pDataModel)
return FALSE;
- }
+
CXFA_Node* pDataNode = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Data));
if (pDataNode) {
pDataModel->RemoveChild(pDataNode);
@@ -66,9 +63,9 @@ FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) {
pDataModel->InsertChild(pImportDataRoot);
}
m_pDocument->DoDataRemerge(FALSE);
- pDataDocumentParser->Release();
return TRUE;
}
+
CFX_WideString XFA_ExportEncodeAttribute(const CFX_WideString& str) {
CFX_WideTextBuf textBuf;
int32_t iLen = str.GetLength();
« no previous file with comments | « xfa/fxfa/parser/xfa_document_imp.cpp ('k') | xfa/fxfa/parser/xfa_object_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698