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 2e300505b3cc3e1be2493606bc49c84e5da99226..ef85d0e2660b843331df77cfdcff443b2161fa2c 100644 |
--- a/xfa/fxfa/parser/xfa_document_serialize.cpp |
+++ b/xfa/fxfa/parser/xfa_document_serialize.cpp |
@@ -5,8 +5,6 @@ |
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
#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" |
@@ -24,26 +22,31 @@ |
: m_pDocument(pDocument) { |
ASSERT(m_pDocument); |
} |
- |
FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) { |
- std::unique_ptr<IXFA_Parser> pDataDocumentParser( |
- IXFA_Parser::Create(m_pDocument)); |
+ IXFA_Parser* pDataDocumentParser = IXFA_Parser::Create(m_pDocument); |
+ if (!pDataDocumentParser) { |
+ return FALSE; |
+ } |
if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) != |
XFA_PARSESTATUS_Ready) { |
- return FALSE; |
- } |
- if (pDataDocumentParser->DoParse(nullptr) < XFA_PARSESTATUS_Done) |
- return FALSE; |
- |
+ pDataDocumentParser->Release(); |
+ return FALSE; |
+ } |
+ if (pDataDocumentParser->DoParse(NULL) < XFA_PARSESTATUS_Done) { |
+ pDataDocumentParser->Release(); |
+ return FALSE; |
+ } |
CXFA_Node* pImportDataRoot = pDataDocumentParser->GetRootNode(); |
- if (!pImportDataRoot) |
- return FALSE; |
- |
+ if (!pImportDataRoot) { |
+ pDataDocumentParser->Release(); |
+ return FALSE; |
+ } |
CXFA_Node* pDataModel = |
ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets)); |
- if (!pDataModel) |
- return FALSE; |
- |
+ if (!pDataModel) { |
+ pDataDocumentParser->Release(); |
+ return FALSE; |
+ } |
CXFA_Node* pDataNode = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Data)); |
if (pDataNode) { |
pDataModel->RemoveChild(pDataNode); |
@@ -63,9 +66,9 @@ |
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(); |