summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app/xfa_ffdoc.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-05-16 17:05:38 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-16 17:05:38 -0700
commit3857904e520ecb06bad545e4e4bfcf4e60dd1f52 (patch)
tree20f4108f4f09cdfdce50ff2b788c8c8d481cd7ea /xfa/fxfa/app/xfa_ffdoc.cpp
parent3301ab30aeec548833eb2d693bd3eebf9d1c28ce (diff)
downloadpdfium-3857904e520ecb06bad545e4e4bfcf4e60dd1f52.tar.xz
Remove Release() { delete this; } in CFXA_Data{Importer,Exporter}
Review-Url: https://codereview.chromium.org/1988453002
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);
}