summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app/xfa_ffdoc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/app/xfa_ffdoc.cpp')
-rw-r--r--xfa/fxfa/app/xfa_ffdoc.cpp41
1 files changed, 18 insertions, 23 deletions
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp
index f33e4e0585..8297dce9ec 100644
--- a/xfa/fxfa/app/xfa_ffdoc.cpp
+++ b/xfa/fxfa/app/xfa_ffdoc.cpp
@@ -362,34 +362,29 @@ CFDE_XMLElement* CXFA_FFDoc::GetPackageData(const CFX_WideStringC& wsPackage) {
? static_cast<CFDE_XMLElement*>(pXMLNode)
: NULL;
}
+
FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage,
IFX_FileWrite* pFile,
CXFA_ChecksumContext* pCSContext) {
- CXFA_DataExporter* pExport = new CXFA_DataExporter(m_pDocument);
+ std::unique_ptr<CXFA_DataExporter> pExport(
+ new CXFA_DataExporter(m_pDocument));
uint32_t packetHash = FX_HashCode_GetW(wsPackage, false);
- CXFA_Node* pNode = NULL;
- if (packetHash == XFA_HASHCODE_Xfa) {
- pNode = m_pDocument->GetRoot();
- } else {
- pNode = ToNode(m_pDocument->GetXFAObject(packetHash));
- }
- FX_BOOL bFlags = FALSE;
- if (pNode) {
- CFX_ByteString bsChecksum;
- if (pCSContext) {
- pCSContext->GetChecksum(bsChecksum);
- }
- bFlags = pExport->Export(
- pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : NULL);
- } else {
- bFlags = pExport->Export(pFile);
- }
- pExport->Release();
- return bFlags;
+ CXFA_Node* pNode = packetHash == XFA_HASHCODE_Xfa
+ ? m_pDocument->GetRoot()
+ : ToNode(m_pDocument->GetXFAObject(packetHash));
+ if (!pNode)
+ return pExport->Export(pFile);
+
+ CFX_ByteString bsChecksum;
+ if (pCSContext)
+ pCSContext->GetChecksum(bsChecksum);
+
+ return pExport->Export(pFile, pNode, 0,
+ bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr);
}
-FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) {
- std::unique_ptr<CXFA_DataImporter, ReleaseDeleter<CXFA_DataImporter>>
- importer(new CXFA_DataImporter(m_pDocument));
+FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) {
+ std::unique_ptr<CXFA_DataImporter> importer(
+ new CXFA_DataImporter(m_pDocument));
return importer->ImportData(pStream);
}