diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-08 15:01:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-08 22:17:05 +0200 |
commit | e11386053d3c404fbeab8b66402d68f813f7dd58 (patch) | |
tree | 1309275bb4cc8a1bb74372d94a4439fb99762094 /sc | |
parent | 41a55bde344f924edd36dbbeead45c426ee07e4d (diff) |
convert some OSL_ENSURE -> assert
where we are just provide checking for a following static_cast.
I'd rather have an explicit assert failure than a random crash
Change-Id: Iab6c6b056341018deaa74b78b075e564f72c58d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121814
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/table5.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/auditsh.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh3.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshe.cxx | 4 |
5 files changed, 6 insertions, 6 deletions
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index 7af84bcd58dc..244ba04d53aa 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -126,7 +126,7 @@ void ScTable::UpdatePageBreaks(const ScRange* pUserArea) { if (pStyleSet->GetItemState(ATTR_PAGE_SCALETOPAGES, false, &pItem) == SfxItemState::SET) { - OSL_ENSURE(dynamic_cast<const SfxUInt16Item*>(pItem) != nullptr, "invalid Item"); + assert(dynamic_cast<const SfxUInt16Item*>(pItem) && "invalid Item"); bSkipColBreaks = bSkipRowBreaks = static_cast<const SfxUInt16Item*>(pItem)->GetValue() > 0; } diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index fe7bf3b2bce9..b6917c58e9a9 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -420,7 +420,7 @@ void ScModule::Execute( SfxRequest& rReq ) if (pReqArgs) { auto const & p = pReqArgs->Get(SID_PSZ_FUNCTION); - OSL_ENSURE(dynamic_cast<const SfxUInt32Item*>(&p) != nullptr,"wrong Parameter"); + assert(dynamic_cast<const SfxUInt32Item*>(&p) && "wrong Parameter"); const SfxUInt32Item& rItem = static_cast<const SfxUInt32Item&>(p); ScAppOptions aNewOpts( GetAppOptions() ); diff --git a/sc/source/ui/view/auditsh.cxx b/sc/source/ui/view/auditsh.cxx index 42f01761bd25..a76267071bd5 100644 --- a/sc/source/ui/view/auditsh.cxx +++ b/sc/source/ui/view/auditsh.cxx @@ -91,7 +91,7 @@ void ScAuditingShell::Execute( const SfxRequest& rReq ) if ( pReqArgs->GetItemState( SID_RANGE_COL, true, &pXItem ) == SfxItemState::SET && pReqArgs->GetItemState( SID_RANGE_ROW, true, &pYItem ) == SfxItemState::SET ) { - OSL_ENSURE( dynamic_cast<const SfxInt16Item*>( pXItem) != nullptr && dynamic_cast<const SfxInt32Item*>( pYItem) != nullptr, + assert( dynamic_cast<const SfxInt16Item*>( pXItem) && dynamic_cast<const SfxInt32Item*>( pYItem) && "wrong items" ); SCCOL nCol = static_cast<SCCOL>(static_cast<const SfxInt16Item*>(pXItem)->GetValue()); SCROW nRow = static_cast<SCROW>(static_cast<const SfxInt32Item*>(pYItem)->GetValue()); diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 088c403168d6..960f8aa03381 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -908,7 +908,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET ) { - OSL_ENSURE(dynamic_cast<const SfxBoolItem*>( pItem), "wrong item"); + assert(dynamic_cast<const SfxBoolItem*>( pItem) && "wrong item"); bMoveContents = static_cast<const SfxBoolItem*>(pItem)->GetValue(); } diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index 418aa6e5da0d..ab3f0c2f18eb 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -261,7 +261,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) if ( pReqArgs && SfxItemState::SET == pReqArgs->GetItemState(SID_SEARCH_ITEM, false, &pItem) ) { - OSL_ENSURE( dynamic_cast<const SvxSearchItem*>( pItem) != nullptr, "wrong Item" ); + assert( dynamic_cast<const SvxSearchItem*>( pItem) && "wrong Item" ); const SvxSearchItem* pSearchItem = static_cast<const SvxSearchItem*>(pItem); ScGlobal::SetSearchItem( *pSearchItem ); @@ -276,7 +276,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) pReqArgs->GetItemState(SID_SEARCH_ITEM, false, &pItem)) { // remember search item - OSL_ENSURE( dynamic_cast<const SvxSearchItem*>( pItem) != nullptr, "wrong Item" ); + assert( dynamic_cast<const SvxSearchItem*>( pItem) && "wrong Item" ); ScGlobal::SetSearchItem( *static_cast<const SvxSearchItem*>(pItem )); } else |