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

Unified Diff: xfa/fxfa/app/xfa_ffapp.cpp

Issue 2095653002: Remove NULL in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 6 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/app/xfa_checksum.cpp ('k') | xfa/fxfa/app/xfa_ffbarcode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxfa/app/xfa_ffapp.cpp
diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp
index 5f2f1b982851df40d587b3036826159b4bb0ce1a..22989b8b3e039dcda3d9baa8f42e759634dbb4f6 100644
--- a/xfa/fxfa/app/xfa_ffapp.cpp
+++ b/xfa/fxfa/app/xfa_ffapp.cpp
@@ -109,34 +109,26 @@ CXFA_FFApp::~CXFA_FFApp() {
}
CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() {
- if (!m_pDocHandler) {
+ if (!m_pDocHandler)
m_pDocHandler = new CXFA_FFDocHandler;
- }
return m_pDocHandler;
}
CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider,
IFX_FileRead* pStream,
FX_BOOL bTakeOverFile) {
- CXFA_FFDoc* pDoc = new CXFA_FFDoc(this, pProvider);
+ std::unique_ptr<CXFA_FFDoc> pDoc(new CXFA_FFDoc(this, pProvider));
FX_BOOL bSuccess = pDoc->OpenDoc(pStream, bTakeOverFile);
- if (!bSuccess) {
- delete pDoc;
- pDoc = NULL;
- }
- return pDoc;
+ return bSuccess ? pDoc.release() : nullptr;
}
+
CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider,
CPDF_Document* pPDFDoc) {
- if (pPDFDoc == NULL) {
- return NULL;
- }
- CXFA_FFDoc* pDoc = new CXFA_FFDoc(this, pProvider);
+ if (!pPDFDoc)
+ return nullptr;
+
+ std::unique_ptr<CXFA_FFDoc> pDoc(new CXFA_FFDoc(this, pProvider));
FX_BOOL bSuccess = pDoc->OpenDoc(pPDFDoc);
- if (!bSuccess) {
- delete pDoc;
- pDoc = NULL;
- }
- return pDoc;
+ return bSuccess ? pDoc.release() : nullptr;
}
void CXFA_FFApp::SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
« no previous file with comments | « xfa/fxfa/app/xfa_checksum.cpp ('k') | xfa/fxfa/app/xfa_ffbarcode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698