diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-07-03 08:51:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-07-03 12:49:38 +0100 |
commit | 4228f08d6084d8563b70a26a6398fb0caf017f99 (patch) | |
tree | 2f91cb13231f0de1e514dd545e0910b830589fb4 /sw | |
parent | 6fe1e3af0e812d99e63677d9ead056357b37ecf7 (diff) |
use assert when followed by deref
Change-Id: I8405e4d8f9fa1de3ef6ee474321b4ac2b4ce1624
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/layout/calcmove.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/findfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/ftnfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/objectpositioning/anchoredobjectposition.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/text/txtfly.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/index/idxmrk.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewdlg2.cxx | 8 |
9 files changed, 20 insertions, 19 deletions
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 7910135c2951..db3ae50b0cfd 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1735,7 +1735,7 @@ void MakeNxt( SwFrm *pFrm, SwFrm *pNxt ) /// between the pFrm's FtnBoss and the pNxt's FtnBoss. static bool lcl_IsNextFtnBoss( const SwFrm *pFrm, const SwFrm* pNxt ) { - OSL_ENSURE( pFrm && pNxt, "lcl_IsNextFtnBoss: No Frames?" ); + assert(pFrm && pNxt && "lcl_IsNextFtnBoss: No Frames?"); pFrm = pFrm->FindFtnBossFrm(); pNxt = pNxt->FindFtnBossFrm(); // If pFrm is a last column, we use the page instead. diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index d8ff9576af8d..f712fd0c6c60 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -1584,7 +1584,7 @@ const SwCellFrm& SwCellFrm::FindStartEndOfRowSpanCell( bool bStart, bool bCurren } } - OSL_ENSURE( pRet, "SwCellFrm::FindStartRowSpanCell: No result" ); + assert(pRet && "SwCellFrm::FindStartRowSpanCell: No result"); return *pRet; } diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 70d79fc7ce9c..88157ccba55b 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -2823,7 +2823,7 @@ const SwCntntFrm* SwFtnFrm::GetRefFromAttr() const SwCntntFrm* SwFtnFrm::GetRefFromAttr() { - OSL_ENSURE( pAttr, "invalid Attribute" ); + assert(pAttr && "invalid Attribute"); SwTxtNode& rTNd = (SwTxtNode&)pAttr->GetTxtNode(); SwPosition aPos( rTNd, SwIndex( &rTNd, pAttr->GetStart() )); SwCntntFrm* pCFrm = rTNd.getLayoutFrm( getRootFrm(), 0, &aPos, false ); diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index a1c29b5e5b2d..79db5385608d 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -78,16 +78,16 @@ void SwAnchoredObjectPosition::_GetInfoAboutObj() // determine contact object { mpContact = static_cast<SwContact*>(GetUserCall( &mrDrawObj )); - OSL_ENSURE( mpContact, - "SwAnchoredObjectPosition::_GetInfoAboutObj() - missing SwContact-object." ); + assert(mpContact && + "SwAnchoredObjectPosition::_GetInfoAboutObj() - missing SwContact-object."); } // determine anchored object, the object belongs to { // #i26791# mpAnchoredObj = mpContact->GetAnchoredObj( &mrDrawObj ); - OSL_ENSURE( mpAnchoredObj, - "SwAnchoredObjectPosition::_GetInfoAboutObj() - missing anchored object." ); + assert(mpAnchoredObj && + "SwAnchoredObjectPosition::_GetInfoAboutObj() - missing anchored object."); } // determine frame, the object is anchored at @@ -102,8 +102,8 @@ void SwAnchoredObjectPosition::_GetInfoAboutObj() { // #i28701# mpFrmFmt = &mpAnchoredObj->GetFrmFmt(); - OSL_ENSURE( mpFrmFmt, - "<SwAnchoredObjectPosition::_GetInfoAboutObj() - missing frame format." ); + assert(mpFrmFmt && + "<SwAnchoredObjectPosition::_GetInfoAboutObj() - missing frame format."); } // #i62875# - determine attribute value of <Follow-Text-Flow> diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 856729fead92..fd40d7886327 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -136,7 +136,7 @@ SwContourCache::~SwContourCache() void SwContourCache::ClrObject( MSHORT nPos ) { - OSL_ENSURE( pTextRanger[ nPos ], "ClrObject: Already cleared. Good Bye!" ); + assert(pTextRanger[nPos] && "ClrObject: Already cleared. Good Bye!"); nPntCnt -= pTextRanger[ nPos ]->GetPointCount(); delete pTextRanger[ nPos ]; --nObjCnt; diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index b1c1f82f720b..1f7d39d3e382 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1047,7 +1047,8 @@ sal_uInt8 *WW8_WrFkp::CopyLastSprms(sal_uInt8 &rLen, bool bVer8) bool WW8_WrFkp::Append( WW8_FC nEndFc, sal_uInt16 nVarLen, const sal_uInt8* pSprms ) { - OSL_ENSURE( !nVarLen || pSprms, "Item pointer missing" ); + assert((!nVarLen || pSprms) && "Item pointer missing"); + OSL_ENSURE( nVarLen < ( ( ePlc == PAP ) ? 497U : 502U ), "Sprms too long !" ); if( bCombined ) diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index af3ce1488189..2fc0e6bf0bc2 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -722,10 +722,10 @@ void SwXMLImport::endDocument( void ) { Reference<XUnoTunnel> xCrsrTunnel( GetTextImport()->GetCursor(), UNO_QUERY); - OSL_ENSURE( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" ); + assert(xCrsrTunnel.is() && "missing XUnoTunnel for Cursor"); OTextCursorHelper *pTxtCrsr = reinterpret_cast< OTextCursorHelper *>( sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); - OSL_ENSURE( pTxtCrsr, "SwXTextCursor missing" ); + assert(pTxtCrsr && "SwXTextCursor missing"); SwPaM *pPaM = pTxtCrsr->GetPaM(); if( IsInsertMode() && pSttNdIdx->GetIndex() ) { diff --git a/sw/source/uibase/index/idxmrk.cxx b/sw/source/uibase/index/idxmrk.cxx index f81f63b7ee3d..306f55448e69 100644 --- a/sw/source/uibase/index/idxmrk.cxx +++ b/sw/source/uibase/index/idxmrk.cxx @@ -61,9 +61,9 @@ SwInsertIdxMarkWrapper::SwInsertIdxMarkWrapper( Window *pParentWindow, SfxChildWindow(pParentWindow, nId) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); + assert(pFact && "SwAbstractDialogFactory fail!"); pAbstDlg = pFact->CreateIndexMarkFloatDlg(pBindings, this, pParentWindow, pInfo); - OSL_ENSURE(pAbstDlg, "Dialogdiet fail!"); + assert(pAbstDlg && "Dialogdiet fail!"); pWindow = pAbstDlg->GetWindow(); pWindow->Show(); // at this point,because before pSh has to be initialized in ReInitDlg() // -> Show() will invoke StateChanged() and save pos diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx index 416f9447ae33..3852fc191a58 100644 --- a/sw/source/uibase/uiview/viewdlg2.cxx +++ b/sw/source/uibase/uiview/viewdlg2.cxx @@ -54,10 +54,10 @@ void SwView::ExecDlgExt(SfxRequest &rReq) case FN_INSERT_CAPTION: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); + assert(pFact && "SwAbstractDialogFactory fail!"); boost::scoped_ptr<VclAbstractDialog> pDialog(pFact->CreateSwCaptionDialog( pMDI, *this, DLG_CAPTION )); - OSL_ENSURE(pDialog, "Dialogdiet fail!"); + assert(pDialog && "Dialogdiet fail!"); if ( pDialog ) { pDialog->Execute(); @@ -67,10 +67,10 @@ void SwView::ExecDlgExt(SfxRequest &rReq) case FN_EDIT_FOOTNOTE: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "Dialogdiet fail!"); + assert(pFact && "Dialogdiet fail!"); boost::scoped_ptr<AbstractInsFootNoteDlg> pDlg(pFact->CreateInsFootNoteDlg( pMDI, *m_pWrtShell, true)); - OSL_ENSURE(pDlg, "Dialogdiet fail!"); + assert(pDlg && "Dialogdiet fail!"); pDlg->SetHelpId(GetStaticInterface()->GetSlot(FN_EDIT_FOOTNOTE)->GetCommand()); pDlg->SetText( SW_RESSTR(STR_EDIT_FOOTNOTE) ); |