OSL_ENSURE->assert

Change-Id: Ib8ba49e89d03eaf3b3aae94dbbf121898ba9e8de
This commit is contained in:
Caolán McNamara 2014-06-26 10:11:50 +01:00
parent 42bcbee2e6
commit a8b32cc97a
13 changed files with 37 additions and 46 deletions

View file

@ -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 );

View file

@ -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());

View file

@ -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; }

View file

@ -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 );
}

View file

@ -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; }

View file

@ -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;
}

View file

@ -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() );

View file

@ -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);

View file

@ -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 );

View file

@ -2238,8 +2238,8 @@ const SwPageFrm& SwPageFrm::GetFormatPage() const
pRet = static_cast<const SwPageFrm*>( GetNext() );
}
}
OSL_ENSURE( pRet,
"<SwPageFrm::GetFormatPage()> - inconsistent layout: empty page without previous and next page frame --> crash." );
assert(pRet &&
"<SwPageFrm::GetFormatPage()> - inconsistent layout: empty page without previous and next page frame --> crash.");
}
return *pRet;
}

View file

@ -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 )
{

View file

@ -75,9 +75,9 @@ typedef boost::ptr_vector<TextBlockInfo_Impl> TextBlockInfoArr;
void SwGlossaryHdl::GlossaryDlg()
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialogdiet fail!");
assert(pFact && "Dialogdiet fail!");
boost::scoped_ptr<AbstractGlossaryDlg> 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<AbstractSwSelGlossaryDlg> 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];

View file

@ -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<SfxAbstractDialog> 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<AbstractSvxPostItDialog> 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<AbstractJavaEditDialog> pDlg(pFact->CreateJavaEditDialog(pMDI, &rSh));
OSL_ENSURE(pDlg, "Dialogdiet fail!");
assert(pDlg && "Dialogdiet fail!");
if ( pDlg->Execute() )
{
aType = pDlg->GetScriptType();