diff options
author | Noel <noelgrandin@gmail.com> | 2020-10-12 16:09:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-13 09:30:12 +0200 |
commit | f9ac067da9e61f479e2433d500b9b940e5a45470 (patch) | |
tree | 1b057d3b97cc7dcf6d3de377da34cbf23af9c3ee /basic | |
parent | 3ee3ae85de3a29ebfb89e75960b65417bfd6ca55 (diff) |
static_cast after dynamic_cast
Change-Id: I487b5dc148f5a3d0d45f198c00179002841242ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104213
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/runtime/methods1.cxx | 16 | ||||
-rw-r--r-- | basic/source/sbx/sbxvalue.cxx | 4 |
2 files changed, 8 insertions, 12 deletions
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index fdf4e9560b1b..807806e4cea8 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -115,11 +115,9 @@ void SbRtl_CallByName(StarBASIC *, SbxArray & rPar, bool) SbxObject* pObj = nullptr; if( pObjVar ) pObj = dynamic_cast<SbxObject*>( pObjVar ); - if( !pObj && dynamic_cast<const SbxVariable*>( pObjVar) ) - { - SbxBase* pObjVarObj = static_cast<SbxVariable*>(pObjVar)->GetObject(); - pObj = dynamic_cast<SbxObject*>( pObjVarObj ); - } + if( !pObj ) + if (auto pSbxVar = dynamic_cast<const SbxVariable*>( pObjVar)) + pObj = dynamic_cast<SbxObject*>( pSbxVar->GetObject() ); if( !pObj ) { StarBASIC::Error( ERRCODE_BASIC_BAD_PARAMETER ); @@ -854,11 +852,9 @@ void SbRtl_FindPropertyObject(StarBASIC *, SbxArray & rPar, bool) { pObj = dynamic_cast<SbxObject*>( pObjVar ); } - if( !pObj && dynamic_cast<const SbxVariable*>( pObjVar) ) - { - SbxBase* pObjVarObj = static_cast<SbxVariable*>(pObjVar)->GetObject(); - pObj = dynamic_cast<SbxObject*>( pObjVarObj ); - } + if( !pObj ) + if (auto pSbxVar = dynamic_cast<const SbxVariable*>( pObjVar)) + pObj = dynamic_cast<SbxObject*>( pSbxVar->GetObject() ); OUString aNameStr = rPar.Get32(2)->GetOUString(); diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 43a8e5243c83..74b2fcd23d98 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -668,8 +668,8 @@ bool SbxValue::ImpIsNumeric( bool bOnlyIntntl ) const return false; } // Test downcast!!! - if( dynamic_cast<const SbxVariable*>( this) != nullptr ) - const_cast<SbxVariable*>(static_cast<const SbxVariable*>(this))->Broadcast( SfxHintId::BasicDataWanted ); + if( auto pSbxVar = dynamic_cast<const SbxVariable*>( this) ) + const_cast<SbxVariable*>(pSbxVar)->Broadcast( SfxHintId::BasicDataWanted ); SbxDataType t = GetType(); if( t == SbxSTRING ) { |