diff options
author | dsinclair <dsinclair@chromium.org> | 2016-06-23 12:40:16 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-23 12:40:16 -0700 |
commit | 85d1f2c2f9f1e746bedb1b6f03576613f54fbc27 (patch) | |
tree | ff5b393fb9b89f006327bee7bc8c955522defb67 /xfa/fxfa/app/xfa_ffapp.cpp | |
parent | 6e12478cb298c3a8277493ee79ae0b73d6df8554 (diff) | |
download | pdfium-85d1f2c2f9f1e746bedb1b6f03576613f54fbc27.tar.xz |
Remove NULL in xfa/
This CL converts all NULL's to nullptr. All instances of comparison to nullptr
have been removed.
Review-Url: https://codereview.chromium.org/2095653002
Diffstat (limited to 'xfa/fxfa/app/xfa_ffapp.cpp')
-rw-r--r-- | xfa/fxfa/app/xfa_ffapp.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp index 5f2f1b9828..22989b8b3e 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) { |