From a8b32cc97aac79729b6561e542ede298d4f96c5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 26 Jun 2014 10:11:50 +0100 Subject: [PATCH] OSL_ENSURE->assert Change-Id: Ib8ba49e89d03eaf3b3aae94dbbf121898ba9e8de --- cppu/source/uno/lbenv.cxx | 2 +- .../source/processor2d/vclhelperbufferdevice.cxx | 6 +++--- sfx2/source/doc/Metadatable.cxx | 6 +++--- sot/source/base/factory.cxx | 2 +- svx/source/sdr/attribute/sdrtextattribute.cxx | 6 ++++-- svx/source/sdr/properties/defaultproperties.cxx | 2 +- svx/source/stbctrls/pszctrl.cxx | 2 +- svx/source/table/svdotable.cxx | 15 +-------------- svx/source/tbxctrls/grafctrl.cxx | 4 ++-- sw/source/core/layout/pagechg.cxx | 4 ++-- sw/source/filter/writer/writer.cxx | 6 ++++-- sw/source/uibase/dochdl/gloshdl.cxx | 12 ++++++------ sw/source/uibase/shells/textfld.cxx | 16 ++++++++-------- 13 files changed, 37 insertions(+), 46 deletions(-) diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index f166914b46ad..f382c0dc80a0 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -512,7 +512,7 @@ static void SAL_CALL defenv_getRegisteredInterfaces( uno_ExtEnvironment * pEnv, void *** pppInterfaces, sal_Int32 * pnLen, uno_memAlloc memAlloc ) { - OSL_ENSURE( pEnv && pppInterfaces && pnLen && memAlloc, "### null ptr!" ); + assert(pEnv && pppInterfaces && pnLen && memAlloc && "### null ptr!"); uno_DefaultEnvironment * that = static_cast< uno_DefaultEnvironment * >( pEnv ); ::osl::MutexGuard guard( that->mutex ); diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index e94f5818d077..a99909925293 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -347,14 +347,14 @@ namespace drawinglayer VirtualDevice& impBufferDevice::getContent() { - OSL_ENSURE(mpContent, "impBufferDevice: No content, check isVisible() before accessing (!)"); + assert(mpContent && "impBufferDevice: No content, check isVisible() before accessing (!)"); return *mpContent; } VirtualDevice& impBufferDevice::getMask() { - OSL_ENSURE(mpContent, "impBufferDevice: No content, check isVisible() before accessing (!)"); - if(!mpMask) + assert(mpContent && "impBufferDevice: No content, check isVisible() before accessing (!)"); + if (!mpMask) { mpMask = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, 1); mpMask->SetMapMode(mpContent->GetMapMode()); diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index baacd975f2bc..c54e3e82586e 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -291,9 +291,9 @@ public: : m_isInContent(i_isInContent) { } virtual ::sfx2::XmlIdRegistry& GetRegistry() SAL_OVERRIDE { - // N.B. for Clipboard, m_pReg is initialized by registering this as copy in - // RegisterAsCopyOf; it is only cleared by OriginNoLongerInBusinessAnymore - OSL_ENSURE(m_pReg, "no m_pReg in MetadatableClipboard ?"); + // N.B. for Clipboard, m_pReg is initialized by registering this as copy in + // RegisterAsCopyOf; it is only cleared by OriginNoLongerInBusinessAnymore + assert(m_pReg && "no m_pReg in MetadatableClipboard ?"); return *m_pReg; } virtual bool IsInClipboard() const SAL_OVERRIDE { return true; } diff --git a/sot/source/base/factory.cxx b/sot/source/base/factory.cxx index ec2aa26b677d..349c2f07c9ae 100644 --- a/sot/source/base/factory.cxx +++ b/sot/source/base/factory.cxx @@ -192,7 +192,7 @@ void SotFactory::DecSvObjectCount( SotObject * pObj ) *************************************************************************/ void * SotFactory::CreateInstance( SotObject ** ppObj ) const { - DBG_ASSERT( pCreateFunc, "SotFactory::CreateInstance: pCreateFunc == 0" ); + assert(pCreateFunc && "SotFactory::CreateInstance: pCreateFunc == 0"); return pCreateFunc( ppObj ); } diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index 6b3fd30b735f..57d2dfd065d7 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -162,14 +162,16 @@ namespace drawinglayer // data read access const SdrText& getSdrText() const { - OSL_ENSURE(mpSdrText, "Access to text of default version of ImpSdrTextAttribute (!)"); + assert(mpSdrText && "Access to text of default version of ImpSdrTextAttribute (!)"); return *mpSdrText; } + const OutlinerParaObject& getOutlinerParaObject() const { - OSL_ENSURE(mpOutlinerParaObject, "Access to OutlinerParaObject of default version of ImpSdrTextAttribute (!)"); + assert(mpOutlinerParaObject && "Access to OutlinerParaObject of default version of ImpSdrTextAttribute (!)"); return *mpOutlinerParaObject; } + bool isContour() const { return mbContour; } bool isFitToSize() const { return mbFitToSize; } bool isAutoFit() const { return mbAutoFit; } diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index ac067fe7478c..47b32c6b518e 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -85,7 +85,7 @@ namespace sdr ((DefaultProperties*)this)->ForceDefaultAttributes(); } - DBG_ASSERT(mpItemSet, "Could not create an SfxItemSet(!)"); + assert(mpItemSet && "Could not create an SfxItemSet(!)"); return *mpItemSet; } diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx index 102de3bda084..e48498ca1678 100644 --- a/svx/source/stbctrls/pszctrl.cxx +++ b/svx/source/stbctrls/pszctrl.cxx @@ -359,7 +359,7 @@ void SvxPosSizeStatusBarControl::Command( const CommandEvent& rCEvt ) void SvxPosSizeStatusBarControl::Paint( const UserDrawEvent& rUsrEvt ) { OutputDevice* pDev = rUsrEvt.GetDevice(); - DBG_ASSERT( pDev, "no OutputDevice on UserDrawEvent" ); + assert(pDev && "no OutputDevice on UserDrawEvent"); const Rectangle& rRect = rUsrEvt.GetRect(); StatusBar& rBar = GetStatusBar(); Point aItemPos = rBar.GetItemTextPos( GetId() ); diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index d49cfb3a96f2..0eba6e7b0c29 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -1297,8 +1297,6 @@ sal_Int32 SdrTableObj::CheckTextHit(const Point& rPnt) const return 0; } - - SdrOutliner* SdrTableObj::GetCellTextEditOutliner( const Cell& rCell ) const { if( mpImpl && (mpImpl->getCell( mpImpl->maEditPos ).get() == &rCell) ) @@ -1307,38 +1305,27 @@ SdrOutliner* SdrTableObj::GetCellTextEditOutliner( const Cell& rCell ) const return 0; } - - - const TableLayouter& SdrTableObj::getTableLayouter() const { - OSL_ENSURE(mpImpl && mpImpl->mpLayouter, "getTableLayouter() error: no mpImpl or mpLayouter (!)"); + assert(mpImpl && mpImpl->mpLayouter && "getTableLayouter() error: no mpImpl or mpLayouter (!)"); return *(mpImpl->mpLayouter); } - - bool SdrTableObj::IsAutoGrowHeight() const { return true; } - - bool SdrTableObj::IsAutoGrowWidth() const { return true; } - - bool SdrTableObj::HasText() const { return true; } - - bool SdrTableObj::IsTextEditActive( const CellPos& rPos ) { return pEdtOutl && mpImpl && (rPos == mpImpl->maEditPos); diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx index 8d9240ab79e7..ffa10bef5acb 100644 --- a/svx/source/tbxctrls/grafctrl.cxx +++ b/svx/source/tbxctrls/grafctrl.cxx @@ -740,9 +740,9 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView ) const OUString aCropStr(SVX_RESSTR(RID_SVXSTR_GRAFCROP)); SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet error!"); + assert(pFact && "Dialogdiet error!"); ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_GRFCROP ); - DBG_ASSERT(fnCreatePage, "Dialogdiet error!"); + assert(fnCreatePage && "Dialogdiet error!"); SfxTabPage* pTabPage = (*fnCreatePage)( aCropDialog.get_content_area(), &aCropDlgAttr ); pTabPage->SetText( aCropStr ); diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 78e8c850cea1..5846f3f56ab4 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -2238,8 +2238,8 @@ const SwPageFrm& SwPageFrm::GetFormatPage() const pRet = static_cast( GetNext() ); } } - OSL_ENSURE( pRet, - " - inconsistent layout: empty page without previous and next page frame --> crash." ); + assert(pRet && + " - inconsistent layout: empty page without previous and next page frame --> crash."); } return *pRet; } diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index cb7215ce0fb2..ac34b11acf8e 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -220,12 +220,14 @@ Writer::NewSwPaM(SwDoc & rDoc, sal_uLong const nStartIdx, sal_uLong const nEndId // Stream-specific SvStream& Writer::Strm() { - OSL_ENSURE( m_pImpl->m_pStream, "Oh-oh. Writer with no Stream!" ); + assert(m_pImpl->m_pStream && "Oh-oh. Writer with no Stream!"); return *m_pImpl->m_pStream; } void Writer::SetStream(SvStream *const pStream) -{ m_pImpl->m_pStream = pStream; } +{ + m_pImpl->m_pStream = pStream; +} SvStream& Writer::OutLong( SvStream& rStrm, long nVal ) { diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index 31192a3f02fd..555699af6e45 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -75,9 +75,9 @@ typedef boost::ptr_vector TextBlockInfoArr; void SwGlossaryHdl::GlossaryDlg() { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "Dialogdiet fail!"); + assert(pFact && "Dialogdiet fail!"); boost::scoped_ptr pDlg(pFact->CreateGlossaryDlg(pViewFrame, this, pWrtShell)); - OSL_ENSURE(pDlg, "Dialogdiet fail!"); + assert(pDlg && "Dialogdiet fail!"); OUString sName; OUString sShortName; @@ -361,9 +361,9 @@ bool SwGlossaryHdl::ExpandGlossary() OSL_ENSURE(pWrtShell->CanInsert(), "illegal"); SwTextBlocks *pGlossary; SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "Dialogdiet fail!"); + assert(pFact && "Dialogdiet fail!"); ::GlossaryGetCurrGroup fnGetCurrGroup = pFact->GetGlossaryCurrGroupFunc(); - OSL_ENSURE(fnGetCurrGroup, "Dialogdiet fail!"); + assert(fnGetCurrGroup && "Dialogdiet fail!"); OUString sGroupName( (*fnGetCurrGroup)() ); if (sGroupName.indexOf(GLOS_DELIM)<0) FindGroupName(sGroupName); @@ -447,10 +447,10 @@ bool SwGlossaryHdl::Expand( const OUString& rShortName, else { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); + assert(pFact && "SwAbstractDialogFactory fail!"); boost::scoped_ptr pDlg(pFact->CreateSwSelGlossaryDlg(0, aShortName)); - OSL_ENSURE(pDlg, "Dialogdiet fail!"); + assert(pDlg && "Dialogdiet fail!"); for(sal_uInt16 i = 0; i < aFoundArr.size(); ++i) { TextBlockInfo_Impl* pData = &aFoundArr[i]; diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 8278f700d81b..6e64edceb9b5 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -135,10 +135,10 @@ void SwTextShell::ExecField(SfxRequest &rReq) default: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); + assert(pFact && "SwAbstractDialogFactory fail!"); boost::scoped_ptr pDlg(pFact->CreateSwFldEditDlg( GetView(),RC_DLG_SWFLDEDITDLG )); - OSL_ENSURE(pDlg, "Dialogdiet fail!"); + assert(pDlg && "Dialogdiet fail!"); pDlg->Execute(); } } @@ -427,9 +427,9 @@ void SwTextShell::ExecField(SfxRequest &rReq) bool bTravel = false; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "Dialogdiet fail!"); + assert(pFact && "Dialogdiet fail!"); ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc(); - OSL_ENSURE(fnGetRange, "Dialogdiet fail! GetRanges()"); + assert(fnGetRange && "Dialogdiet fail! GetRanges()"); SfxItemSet aSet(GetPool(), fnGetRange()); aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT)); aSet.Put(SvxPostItAuthorItem(pRedline->GetAuthorString(), SID_ATTR_POSTIT_AUTHOR)); @@ -472,9 +472,9 @@ void SwTextShell::ExecField(SfxRequest &rReq) bTravel |= bNext || bPrev; SvxAbstractDialogFactory* pFact2 = SvxAbstractDialogFactory::Create(); - OSL_ENSURE(pFact2, "Dialogdiet fail!"); + assert(pFact2 && "Dialogdiet fail!"); boost::scoped_ptr pDlg(pFact2->CreateSvxPostItDialog( pMDI, aSet, bTravel )); - OSL_ENSURE(pDlg, "Dialogdiet fail!"); + assert(pDlg && "Dialogdiet fail!"); pDlg->HideAuthor(); OUString sTitle(SW_RES(STR_REDLINE_COMMENT)); @@ -534,9 +534,9 @@ void SwTextShell::ExecField(SfxRequest &rReq) else { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - OSL_ENSURE(pFact, "Dialogdiet fail!"); + assert(pFact && "Dialogdiet fail!"); boost::scoped_ptr pDlg(pFact->CreateJavaEditDialog(pMDI, &rSh)); - OSL_ENSURE(pDlg, "Dialogdiet fail!"); + assert(pDlg && "Dialogdiet fail!"); if ( pDlg->Execute() ) { aType = pDlg->GetScriptType();