diff options
author | Ivan Timofeev <timofeev.i.s@gmail.com> | 2011-11-17 22:13:42 +0400 |
---|---|---|
committer | Ivan Timofeev <timofeev.i.s@gmail.com> | 2011-11-17 22:45:10 +0400 |
commit | 3616dfb094089589b5c9082fc96702ad1155045f (patch) | |
tree | 60f96e277c910ccc0eb76e22f76d6a51c7a82cdc | |
parent | 538c8cfc3f1df95cde6789f52a120c8de0a75511 (diff) |
redundant if not-null checks on delete
43 files changed, 76 insertions, 142 deletions
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index ecee9a209980..78ee52c39d8b 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -1626,8 +1626,7 @@ SwHash::SwHash( const String& rStr ) : SwHash::~SwHash() { - if( pNext ) - delete pNext; + delete pNext; } void DeleteHashTable( SwHash **ppHashTable, sal_uInt16 nCount ) diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index f402e028fcaa..7f859ed0f34e 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -120,11 +120,8 @@ void CheckRange( SwCursor* pCurCrsr ) * Bereich gehoert ! */ pTmp = (SwPaM*)pTmp->GetNext(); - if( pTmpDel ) - { - delete pTmpDel; // hebe alten Bereich auf - pTmpDel = 0; - } + delete pTmpDel; // hebe alten Bereich auf + pTmpDel = 0; } } diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 3f15e8c3d6e6..b4c8e072b54b 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -691,11 +691,8 @@ _SaveRedlEndPosForRestore::_SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx _SaveRedlEndPosForRestore::~_SaveRedlEndPosForRestore() { - if( pSavArr ) - { - delete pSavArr; - delete pSavIdx; - } + delete pSavArr; + delete pSavIdx; } void _SaveRedlEndPosForRestore::_Restore() @@ -1236,8 +1233,7 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos, GetIDocumentUndoRedo().AppendUndo(pUndo); } - if( pSaveInsPos ) - delete pSaveInsPos; + delete pSaveInsPos; if( bUpdateFtn ) { @@ -2500,7 +2496,7 @@ SetRedlineMode( eOld ); // in die Autokorrektur void SwDoc::SetAutoCorrExceptWord( SwAutoCorrExceptWord* pNew ) { - if( pACEWord && pNew != pACEWord ) + if( pNew != pACEWord ) delete pACEWord; pACEWord = pNew; } diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 3a81493629f9..e5cd57e88699 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -673,8 +673,7 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) } } - if( pCalc ) - delete pCalc; + delete pCalc; } void SwDoc::UpdatePageFlds( SfxPoolItem* pMsgHnt ) @@ -2210,8 +2209,7 @@ void SwDocUpdtFld::MakeFldList( SwDoc& rDoc, int bAll, int eGetMode ) void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) { // new version: walk all fields of the attribute pool - if( pFldSortLst ) - delete pFldSortLst; + delete pFldSortLst; pFldSortLst = new _SetGetExpFlds( 64, 16 ); /// consider and unhide sections diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 16a0780ffc67..22a97733edaa 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1138,7 +1138,7 @@ void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId, SetModified(); } - else if ( pUndo ) + else delete pUndo; } diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index d44172314d42..8163a4ec128f 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -498,12 +498,8 @@ SwDoc::~SwDoc() delete pRedlineTbl; delete pUnoCrsrTbl; delete pAutoFmtRedlnComment; - - if( pUpdtFlds ) - delete pUpdtFlds; - - if( pACEWord ) - delete pACEWord; + delete pUpdtFlds; + delete pACEWord; // die BaseLinks freigeben. { @@ -769,8 +765,7 @@ void SwDoc::ClearDoc() pRedlineTbl->DeleteAndDestroy( 0, pRedlineTbl->Count() ); - if( pACEWord ) - delete pACEWord; + delete pACEWord; // in den BookMarks sind Indizies auf den Content. Diese muessen vorm // loesche der Nodes geloescht werden. diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index c3fc328bfc1d..967bfc1a2080 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -2585,7 +2585,7 @@ void SwDoc::SetAutoFmtRedlineComment( const String* pTxt, sal_uInt16 nSeqNo ) else *pAutoFmtRedlnComment = *pTxt; } - else if( pAutoFmtRedlnComment ) + else delete pAutoFmtRedlnComment, pAutoFmtRedlnComment = 0; nAutoFmtRedlnCommentNo = nSeqNo; diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 40549196d325..cda90ba7a1e7 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -2294,7 +2294,7 @@ sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam ) GetIDocumentUndoRedo().AppendUndo( pUndo ); } } - else if( pUndo ) + else delete pUndo; rPam.GetPoint()->nNode = *pMergeBox->GetSttNd(); diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index ad3c4a371135..8164bcfb6831 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1001,8 +1001,7 @@ SwCntntNode::~SwCntntNode() if( GetDepends() ) DelFrms(); - if( pCondColl ) - delete pCondColl; + delete pCondColl; if ( mpAttrSet.get() && mbSetModifyAtAttr ) ((SwAttrSet*)mpAttrSet.get())->SetModifyAtAttr( 0 ); diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 0ebb362bc28e..6662c479e4df 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -1263,8 +1263,7 @@ void SwFEShell::SetFrmFmt( SwFrmFmt *pNewFmt, sal_Bool bKeepOrient, Point* pDocP else GetLayout()->SetAssertFlyPages(); } - if( pSet ) - delete pSet; + delete pSet; EndAllActionAndCall(); } diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index c89ef90ea6e4..1e2d9ee764da 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -1507,8 +1507,7 @@ SwFmtAnchor::SwFmtAnchor( const SwFmtAnchor &rCpy ) void SwFmtAnchor::SetAnchor( const SwPosition *pPos ) { - if ( pCntntAnchor ) - delete pCntntAnchor; + delete pCntntAnchor; pCntntAnchor = pPos ? new SwPosition( *pPos ) : 0; //AM Absatz gebundene Flys sollten nie in den Absatz hineinzeigen. if (pCntntAnchor && @@ -1630,7 +1629,7 @@ bool SwFmtAnchor::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) break; case text::TextContentAnchorType_AT_PAGE: eAnchor = FLY_AT_PAGE; - if( GetPageNum() > 0 && pCntntAnchor ) + if( GetPageNum() > 0 ) { // If the anchor type is page and a valid page number // has been set, the content position isn't required @@ -1659,7 +1658,7 @@ bool SwFmtAnchor::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if((rVal >>= nVal) && nVal > 0) { SetPageNum( nVal ); - if ((FLY_AT_PAGE == GetAnchorId()) && pCntntAnchor) + if (FLY_AT_PAGE == GetAnchorId()) { // If the anchor type is page and a valid page number // is set, the content paoition has to be deleted to not @@ -1705,8 +1704,7 @@ SwFmtURL::SwFmtURL( const SwFmtURL &rURL) : SwFmtURL::~SwFmtURL() { - if ( pMap ) - delete pMap; + delete pMap; } int SwFmtURL::operator==( const SfxPoolItem &rAttr ) const @@ -1740,8 +1738,7 @@ void SwFmtURL::SetURL( const XubString &rURL, sal_Bool bServerMap ) void SwFmtURL::SetMap( const ImageMap *pM ) { - if ( pMap ) - delete pMap; + delete pMap; pMap = pM ? new ImageMap( *pM ) : 0; } extern const SvEventDescription* lcl_GetSupportedMacroItems(); diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index bb9047c00a96..33e382342765 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -932,8 +932,7 @@ void SwLayoutFrm::MakeAll() Format( pAttrs ); } } //while ( !bValidPos || !bValidSize || !bValidPrtArea ) - if ( pAccess ) - delete pAccess; + delete pAccess; } /************************************************************************* @@ -1769,8 +1768,7 @@ void SwCntntFrm::MakeAll() static_cast<SwTxtFrm&>(*this) ); - if ( pSaveFtn ) - delete pSaveFtn; + delete pSaveFtn; UnlockJoin(); if ( bMovedFwd || bMovedBwd ) diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index a2fc5bf9c532..45da740f338c 100755 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -538,8 +538,7 @@ void SwFlyFrm::FinitDrawObj() } GetVirtDrawObj()->SetUserCall( 0 ); //Ruft sonst Delete des ContactObj delete GetVirtDrawObj(); //Meldet sich selbst beim Master ab. - if ( pMyContact ) - delete pMyContact; //zerstoert den Master selbst. + delete pMyContact; //zerstoert den Master selbst. } /************************************************************************* diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index e578bfdc9070..cfd77c9e2439 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -402,8 +402,7 @@ SwFrm::~SwFrm() } } } - if ( pDrawObjs ) - delete pDrawObjs; + delete pDrawObjs; } #if OSL_DEBUG_LEVEL > 1 diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx index a50246072bbb..19fb4d1ee278 100644 --- a/sw/source/core/text/itradj.cxx +++ b/sw/source/core/text/itradj.cxx @@ -597,8 +597,7 @@ SwMarginPortion *SwTxtAdjuster::CalcRightMargin( SwLineLayout *pCurrent, aCurrRect.Left( nLeftMar + nPrtWidth ); pFly = CalcFlyPortion( nRealWidth, aCurrRect ); } - if( pFly ) - delete pFly; + delete pFly; } SwMarginPortion *pRight = new SwMarginPortion( 0 ); diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 53a092c6fce9..ee83603875e3 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -86,11 +86,8 @@ namespace { inline void ClearFly( SwTxtFormatInfo &rInf ) { - if( rInf.GetFly() ) - { - delete rInf.GetFly(); - rInf.SetFly(0); - } + delete rInf.GetFly(); + rInf.SetFly(0); } /************************************************************************* diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index d3604143742e..f9d69365b2dc 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -155,13 +155,11 @@ sal_Bool lcl_ConnectToPrev( xub_Unicode cCh, xub_Unicode cPrevCh ) SwLineLayout::~SwLineLayout() { Truncate(); - if( GetNext() ) - delete GetNext(); + delete pNext; if( pBlink ) pBlink->Delete( this ); delete pLLSpaceAdd; - if ( pKanaComp ) - delete pKanaComp; + delete pKanaComp; } /************************************************************************* diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 298a3e91e3bd..961931b79c52 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -116,8 +116,7 @@ SwDropSave::~SwDropSave() SwDropPortionPart::~SwDropPortionPart() { - if ( pFollow ) - delete pFollow; + delete pFollow; delete pFnt; } diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index 0abbdf6dcbc4..999742ae1ee1 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -290,7 +290,7 @@ void SwFmtINetFmt::SetMacroTbl( const SvxMacroTableDtor* pNewTbl ) else pMacroTbl = new SvxMacroTableDtor( *pNewTbl ); } - else if( pMacroTbl ) + else delete pMacroTbl, pMacroTbl = 0; } diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index a38c2d15834f..547891a07a1f 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2498,8 +2498,7 @@ SwTxtNode* SwTxtNode::_MakeNewTxtNode( const SwNodeIndex& rPos, sal_Bool bNext, SwTxtNode *pNode = new SwTxtNode( rPos, pColl, pNewAttrSet ); - if( pNewAttrSet ) - delete pNewAttrSet; + delete pNewAttrSet; const SwNumRule* pRule = GetNumRule(); if( pRule && pRule == pNode->GetNumRule() && rNds.IsDocNodes() ) // #115901# diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 5ba469f2c31e..e91984570447 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -882,8 +882,7 @@ uno::Reference< beans::XPropertySetInfo > SwXFrame::getPropertySetInfo(void) th void SwXFrame::SetSelection(SwPaM& rCopySource) { - if(m_pCopySource) - delete m_pCopySource; + delete m_pCopySource; m_pCopySource = new SwPaM( *rCopySource.Start() ); m_pCopySource->SetMark(); *m_pCopySource->GetMark() = *rCopySource.End(); diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 289810e2fa78..4f2b45698048 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1238,7 +1238,7 @@ SwXNumberingRules::~SwXNumberingRules() SolarMutexGuard aGuard; if(pDoc && sCreatedNumRuleName.Len()) pDoc->DelNumRule( sCreatedNumRuleName ); - if( pNumRule && bOwnNumRuleCreated ) + if( bOwnNumRuleCreated ) delete pNumRule; } diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index df6f302a2c5a..834954e0caf7 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1547,8 +1547,7 @@ SwXTextTableCursor::~SwXTextTableCursor() { SolarMutexGuard aGuard; SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(pUnoCrsr) - delete pUnoCrsr; + delete pUnoCrsr; } OUString SwXTextTableCursor::getRangeName(void) throw( uno::RuntimeException ) diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index fd4ab7226e1a..6f80a958fa4b 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -253,8 +253,7 @@ sal_uLong SwASCIIParser::CallParser() delete pItemSet, pItemSet = 0; } - if( pInsPam ) - delete pInsPam; + delete pInsPam; ::EndProgress( pDoc->GetDocShell() ); return nError; diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 8890c0bfd8f6..accb529e4b83 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -505,8 +505,7 @@ void SwHTMLParser::NewObject() sal_Bool bPrcWidth = sal_False, bPrcHeight = sal_False, bDeclare = sal_False; // Eine neue Command-List anlegen - if( pAppletImpl ) - delete pAppletImpl; + delete pAppletImpl; pAppletImpl = new SwApplet_Impl( pDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); @@ -675,8 +674,7 @@ void SwHTMLParser::InsertApplet() sal_Int16 eHoriOri = text::HoriOrientation::NONE; // Eine neue Command-List anlegen - if( pAppletImpl ) - delete pAppletImpl; + delete pAppletImpl; pAppletImpl = new SwApplet_Impl( pDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); const HTMLOptions& rHTMLOptions = GetOptions(); diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index aa4c3fc8e11f..afb26ca8569f 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -104,8 +104,7 @@ SwFltStackEntry::SwFltStackEntry(const SwPosition& rStartPos, SfxPoolItem* pHt) SwFltStackEntry::~SwFltStackEntry() { // Attribut kam zwar als Pointer, wird aber hier geloescht - if (pAttr) - delete pAttr; + delete pAttr; } void SwFltStackEntry::SetEndPos(const SwPosition& rEndPos) @@ -1047,8 +1046,7 @@ SwFltShell::~SwFltShell() delete pPaM; for (i=0; i<sizeof(pColls)/sizeof(*pColls); i++) - if( pColls[i] ) - delete pColls[i]; + delete pColls[i]; delete pOutDoc; } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 50530c1d1442..7d9337b9bca3 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -482,15 +482,13 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, { case 0x038F: pImpRec->nXAlign = nUDData; break; case 0x0390: - if (pImpRec->pXRelTo) - delete pImpRec->pXRelTo; + delete pImpRec->pXRelTo; pImpRec->pXRelTo = new sal_uInt32; *(pImpRec->pXRelTo) = nUDData; break; case 0x0391: pImpRec->nYAlign = nUDData; break; case 0x0392: - if (pImpRec->pYRelTo) - delete pImpRec->pYRelTo; + delete pImpRec->pYRelTo; pImpRec->pYRelTo = new sal_uInt32; *(pImpRec->pYRelTo) = nUDData; break; diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 5ec7a2e8d69e..174428498183 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -914,13 +914,12 @@ void SwWW8ImplReader::SetNumOlst(SwNumRule* pNumR, WW8_OLST* pO, sal_uInt8 nSwLe // von Gliederungsabsaetzen zugreifbar ist. void SwWW8ImplReader::Read_OLST( sal_uInt16, const sal_uInt8* pData, short nLen ) { + delete pNumOlst; if (nLen <= 0) { - delete pNumOlst, pNumOlst = 0; + pNumOlst = 0; return; } - if (pNumOlst) - delete pNumOlst; // nur sicherheitshalber pNumOlst = new WW8_OLST; if( nLen < sal::static_int_cast< sal_Int32 >(sizeof( WW8_OLST )) ) // auffuellen, falls zu kurz memset( pNumOlst, 0, sizeof( *pNumOlst ) ); diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx index 69623ddf05d2..3bf837f71ea5 100644 --- a/sw/source/ui/app/applab.cxx +++ b/sw/source/ui/app/applab.cxx @@ -436,9 +436,7 @@ void SwModule::InsertLab(SfxRequest& rReq, sal_Bool bLabel) rReq.SetReturnValue(SfxVoidItem(bLabel ? FN_LABEL : FN_BUSINESS_CARD)); } delete pDlg; - - if( pNewDBMgr ) - delete pNewDBMgr; + delete pNewDBMgr; } diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 4dc1204d6119..f829db963e21 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1831,8 +1831,7 @@ void SwInsertDBColAutoPilot::Load() else aLbDbParaColl.SelectEntryPos( 0 ); - if( pTAutoFmt ) - delete pTAutoFmt, pTAutoFmt = 0; + delete pTAutoFmt, pTAutoFmt = 0; sTmp = pNewData->sTAutoFmtNm; if( sTmp.Len() ) { diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 8199981d1d19..5fb92c2835c7 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -1115,8 +1115,7 @@ IMPL_LINK( SwEditRegionDlg, FileSearchHdl, PushButton *, EMPTYARG ) m_pOldDefDlgParent = Application::GetDefDialogParent(); Application::SetDefDialogParent( this ); - if ( m_pDocInserter ) - delete m_pDocInserter; + delete m_pDocInserter; m_pDocInserter = new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") ); m_pDocInserter->StartExecuteModal( LINK( this, SwEditRegionDlg, DlgClosedHdl ) ); return 0; @@ -1866,8 +1865,7 @@ IMPL_LINK( SwInsertSectionTabPage, FileSearchHdl, PushButton *, EMPTYARG ) { m_pOldDefDlgParent = Application::GetDefDialogParent(); Application::SetDefDialogParent( this ); - if ( m_pDocInserter ) - delete m_pDocInserter; + delete m_pDocInserter; m_pDocInserter = new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") ); m_pDocInserter->StartExecuteModal( LINK( this, SwInsertSectionTabPage, DlgClosedHdl ) ); return 0; diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 9071837531c6..42229494864d 100755 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -1482,8 +1482,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, rSh.GetView().StopShellTimer(); } - if( pAction ) - delete pAction; + delete pAction; if( bCallAutoCaption ) rSh.GetView().AutoCaption( GRAPHIC_CAP ); diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index f18433c4b929..0bb9dac241d6 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -342,11 +342,9 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier ) PointerStyle eStyle = POINTER_FILL; if( rSh.IsOverReadOnlyPos( rLPt )) { - if( pUserMarker ) - { - delete pUserMarker; - pUserMarker = 0L; - } + delete pUserMarker; + pUserMarker = 0L; + eStyle = POINTER_NOTALLOWED; } else @@ -373,7 +371,7 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier ) pUserMarker = new SdrDropMarkerOverlay( *rSh.GetDrawView(), aTmp ); } } - else if(pUserMarker) + else { delete pUserMarker; pUserMarker = 0L; @@ -661,8 +659,7 @@ void SwEditWin::LeaveArea(const Point &rPos) JustifyAreaTimer(); if( !aTimer.IsActive() ) aTimer.Start(); - if( pShadCrsr ) - delete pShadCrsr, pShadCrsr = 0; + delete pShadCrsr, pShadCrsr = 0; } inline void SwEditWin::EnterArea() @@ -1325,8 +1322,7 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) // running on a document, no order is being taken return; - if( pShadCrsr ) - delete pShadCrsr, pShadCrsr = 0; + delete pShadCrsr, pShadCrsr = 0; aKeyInputFlushTimer.Stop(); sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() && @@ -2680,8 +2676,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) } bWasShdwCrsr = 0 != pShadCrsr; - if( bWasShdwCrsr ) - delete pShadCrsr, pShadCrsr = 0; + delete pShadCrsr, pShadCrsr = 0; const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) ); diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx index afabaf3cf234..b4b7348d60f6 100644 --- a/sw/source/ui/envelp/labprt.cxx +++ b/sw/source/ui/envelp/labprt.cxx @@ -87,8 +87,7 @@ SwLabPrtPage::SwLabPrtPage(Window* pParent, const SfxItemSet& rSet) : SwLabPrtPage::~SwLabPrtPage() { - if (pPrinter) - delete pPrinter; + delete pPrinter; } IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton ) diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx index adda1dbc0ce3..f28dab0e7f5b 100644 --- a/sw/source/ui/ribbar/inputwin.cxx +++ b/sw/source/ui/ribbar/inputwin.cxx @@ -143,8 +143,7 @@ SwInputWindow::~SwInputWindow() pView->GetHLineal().SetActive( sal_True ); pView->GetVLineal().SetActive( sal_True ); } - if ( pMgr ) - delete pMgr; + delete pMgr; if(pWrtShell) pWrtShell->EndSelTblCells(); diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx index 7f197a5a8b13..6f702d76e9fd 100644 --- a/sw/source/ui/table/tautofmt.cxx +++ b/sw/source/ui/table/tautofmt.cxx @@ -303,7 +303,7 @@ void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const else rToFill = new SwTableAutoFmt( *(*pTableTbl)[ nIndex ] ); } - else if( rToFill ) + else delete rToFill, rToFill = 0; } diff --git a/sw/source/ui/uiview/formatclipboard.cxx b/sw/source/ui/uiview/formatclipboard.cxx index a9bfa3f97c39..d40ce9fefbd9 100644 --- a/sw/source/ui/uiview/formatclipboard.cxx +++ b/sw/source/ui/uiview/formatclipboard.cxx @@ -279,10 +279,8 @@ SwFormatClipboard::SwFormatClipboard() } SwFormatClipboard::~SwFormatClipboard() { - if(m_pItemSet) - delete m_pItemSet; - if(m_pTableItemSet) - delete m_pTableItemSet; + delete m_pItemSet; + delete m_pTableItemSet; } bool SwFormatClipboard::HasContent() const @@ -569,16 +567,13 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, SfxStyleSheetBasePool* pPo void SwFormatClipboard::Erase() { m_nSelectionType = 0; - if(m_pItemSet) - { - delete m_pItemSet; - m_pItemSet = 0; - } - if(m_pTableItemSet) - { - delete m_pTableItemSet; - m_pTableItemSet = 0; - } + + delete m_pItemSet; + m_pItemSet = 0; + + delete m_pTableItemSet; + m_pTableItemSet = 0; + if( m_aCharStyle.Len() ) m_aCharStyle.Erase(); if( m_aParaStyle.Len() ) diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index 790cfb62c123..269e57c12b59 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -210,8 +210,7 @@ SwPagePreViewWin::SwPagePreViewWin( Window *pParent, SwPagePreView& rPView ) SwPagePreViewWin::~SwPagePreViewWin() { - if( mpViewShell ) - delete mpViewShell; + delete mpViewShell; } void SwPagePreViewWin::Paint( const Rectangle& rRect ) diff --git a/sw/source/ui/uiview/viewdraw.cxx b/sw/source/ui/uiview/viewdraw.cxx index 87309088ffcf..55d3b5c6291d 100644 --- a/sw/source/ui/uiview/viewdraw.cxx +++ b/sw/source/ui/uiview/viewdraw.cxx @@ -640,8 +640,7 @@ sal_Bool SwView::IsFormMode() const void SwView::SetDrawFuncPtr(SwDrawBase* pFuncPtr) { - if (pDrawActual) - delete pDrawActual; + delete pDrawActual; pDrawActual = pFuncPtr; } diff --git a/sw/source/ui/uno/SwXFilterOptions.cxx b/sw/source/ui/uno/SwXFilterOptions.cxx index 3af6e74bb922..a2f54e734e15 100644 --- a/sw/source/ui/uno/SwXFilterOptions.cxx +++ b/sw/source/ui/uno/SwXFilterOptions.cxx @@ -144,8 +144,7 @@ sal_Int16 SwXFilterOptions::execute() throw (uno::RuntimeException) delete pAsciiDlg; } - if( pInStream ) - delete pInStream; + delete pInStream; return nRet; } diff --git a/sw/source/ui/utlui/glbltree.cxx b/sw/source/ui/utlui/glbltree.cxx index 1855d9f23277..4fa15076a6ac 100644 --- a/sw/source/ui/utlui/glbltree.cxx +++ b/sw/source/ui/utlui/glbltree.cxx @@ -730,8 +730,7 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* pCont, const String* pF { pDefParentWin = Application::GetDefDialogParent(); Application::SetDefDialogParent( this ); - if ( pDocInserter ) - delete pDocInserter; + delete pDocInserter; pDocInserter = new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter"), true ); pDocInserter->StartExecuteModal( LINK( this, SwGlobalTree, DialogClosedHdl ) ); } diff --git a/sw/source/ui/utlui/initui.cxx b/sw/source/ui/utlui/initui.cxx index ae6709d4d84d..1dba7a914f7d 100644 --- a/sw/source/ui/utlui/initui.cxx +++ b/sw/source/ui/utlui/initui.cxx @@ -193,8 +193,7 @@ ShellResource::ShellResource() ShellResource::~ShellResource() { - if( pAutoFmtNameLst ) - delete pAutoFmtNameLst, pAutoFmtNameLst = 0; + delete pAutoFmtNameLst; } String ShellResource::GetPageDescName( sal_uInt16 nNo, PageNameMode eMode ) diff --git a/sw/source/ui/utlui/numfmtlb.cxx b/sw/source/ui/utlui/numfmtlb.cxx index bcaa7e032894..e0c9abcbaa37 100644 --- a/sw/source/ui/utlui/numfmtlb.cxx +++ b/sw/source/ui/utlui/numfmtlb.cxx @@ -126,8 +126,7 @@ void NumFormatListBox::Init(short nFormatType, sal_Bool bUsrFmts) NumFormatListBox::~NumFormatListBox() { - if (pOwnFormatter) - delete pOwnFormatter; + delete pOwnFormatter; } SwView* NumFormatListBox::GetView() |