From 01b49802c7cda7fd4d5ba71263cef7bc95234b89 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 10 Nov 2015 10:25:48 +0100 Subject: loplugin:nullptr (automatic rewrite) Change-Id: I01e11fa956a249974e77dce9deebe79311f098d0 --- sw/source/uibase/fldui/fldmgr.cxx | 30 +++++++++++++++--------------- sw/source/uibase/fldui/fldwrap.cxx | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'sw/source/uibase/fldui') diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index fa6ecca7d6d8..cd0c9a0a9d18 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -207,18 +207,18 @@ static const SwFieldPack aSwFields[] = static SwWrtShell* lcl_GetShell() { SwView* pView; - if ( 0 != (pView = ::GetActiveView()) ) + if ( nullptr != (pView = ::GetActiveView()) ) return pView->GetWrtShellPtr(); OSL_FAIL("no current shell found!"); - return 0; + return nullptr; } inline sal_uInt16 GetPackCount() { return sizeof(aSwFields) / sizeof(SwFieldPack); } // FieldManager controls inserting and updating of fields SwFieldMgr::SwFieldMgr(SwWrtShell* pSh ) : - pModule(0), - pMacroItem(0), + pModule(nullptr), + pMacroItem(nullptr), pWrtShell(pSh), bEvalExp(true) { @@ -244,7 +244,7 @@ bool SwFieldMgr::CanInsertRefMark( const OUString& rStr ) if( 1 < nCnt && !pSh->SwCrsrShell::HasSelection() ) --nCnt; - bRet = 2 > nCnt && 0 == pSh->GetRefMark( rStr ); + bRet = 2 > nCnt && nullptr == pSh->GetRefMark( rStr ); } return bRet; } @@ -269,14 +269,14 @@ SwFieldType* SwFieldMgr::GetFieldType(sal_uInt16 nResId, size_t nField) const { SwWrtShell * pSh = pWrtShell ? pWrtShell : lcl_GetShell(); OSL_ENSURE(pSh, "no SwWrtShell found"); - return pSh ? pSh->GetFieldType(nField, nResId) : 0; + return pSh ? pSh->GetFieldType(nField, nResId) : nullptr; } SwFieldType* SwFieldMgr::GetFieldType(sal_uInt16 nResId, const OUString& rName) const { SwWrtShell * pSh = pWrtShell ? pWrtShell : lcl_GetShell(); OSL_ENSURE(pSh, "no SwWrtShell found"); - return pSh ? pSh->GetFieldType(nResId, rName) : 0; + return pSh ? pSh->GetFieldType(nResId, rName) : nullptr; } // determine current field @@ -286,7 +286,7 @@ SwField* SwFieldMgr::GetCurField() if ( pSh ) pCurField = pSh->GetCurField( true ); else - pCurField = NULL; + pCurField = nullptr; // initialise strings and format aCurPar1.clear(); @@ -295,7 +295,7 @@ SwField* SwFieldMgr::GetCurField() nCurFormat = 0; if(!pCurField) - return 0; + return nullptr; // preprocess current values; determine parameter 1 and parameter 2 // as well as the format @@ -731,7 +731,7 @@ bool SwFieldMgr::GoNextPrev( bool bNext, SwFieldType* pTyp ) if (pTyp && pTyp->Which() == RES_DBFLD) { // for fieldcommand-edit (hop to all DB fields) - return pSh->MoveFieldType( 0, bNext, RES_DBFLD ); + return pSh->MoveFieldType( nullptr, bNext, RES_DBFLD ); } return pTyp && pSh && pSh->MoveFieldType( pTyp, bNext ); @@ -756,7 +756,7 @@ sal_uInt16 SwFieldMgr::GetCurTypeId() const bool SwFieldMgr::InsertField( const SwInsertField_Data& rData) { - SwField* pField = 0; + SwField* pField = nullptr; bool bExp = false; bool bTable = false; bool bPageVar = false; @@ -1255,7 +1255,7 @@ bool SwFieldMgr::InsertField( case TYP_FORMELFLD: { - if(pCurShell->GetFrmType(0,false) & FrmTypeFlags::TABLE) + if(pCurShell->GetFrmType(nullptr,false) & FrmTypeFlags::TABLE) { pCurShell->StartAllAction(); @@ -1349,7 +1349,7 @@ bool SwFieldMgr::InsertField( else if( bPageVar ) static_cast(pCurShell->GetFieldType( 0, RES_REFPAGEGETFLD ))->UpdateFields(); else if( TYP_GETREFFLD == rData.m_nTypeId ) - pField->GetTyp()->ModifyNotification( 0, 0 ); + pField->GetTyp()->ModifyNotification( nullptr, nullptr ); // delete temporary field delete pField; @@ -1369,7 +1369,7 @@ void SwFieldMgr::UpdateCurField(sal_uLong nFormat, bool bDelete = false; SwField *pTmpField; // mb: fixed memory leak - if (NULL != _pTmpField) + if (nullptr != _pTmpField) { pTmpField = _pTmpField; } @@ -1538,7 +1538,7 @@ void SwFieldMgr::UpdateCurField(sal_uLong nFormat, // explicitly evaluate ExpressionFields void SwFieldMgr::EvalExpFields(SwWrtShell* pSh) { - if (pSh == NULL) + if (pSh == nullptr) pSh = pWrtShell ? pWrtShell : ::lcl_GetShell(); if(pSh) diff --git a/sw/source/uibase/fldui/fldwrap.cxx b/sw/source/uibase/fldui/fldwrap.cxx index bf189929abdb..0501e0e602f3 100644 --- a/sw/source/uibase/fldui/fldwrap.cxx +++ b/sw/source/uibase/fldui/fldwrap.cxx @@ -39,7 +39,7 @@ SFX_IMPL_CHILDWINDOW_WITHID(SwFieldDlgWrapper, FN_INSERT_FIELD) SwChildWinWrapper::SwChildWinWrapper(vcl::Window *pParentWindow, sal_uInt16 nId) : SfxChildWindow(pParentWindow, nId), - m_pDocSh(0) + m_pDocSh(nullptr) { // avoid flickering of buttons: m_aUpdateTimer.SetTimeout(200); -- cgit