From b0de7a890e28f3a918ddb3583db0af8347e5d9ae Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Mon, 21 Oct 2019 11:11:00 +0300 Subject: Don't cast to check lower 16 bits; apply mask explicitly This partly reverts f7a2795c881c2eba95aa09f21881f842281ae819 and removes useless casts that don't serve any purpose, to improve readability. Change-Id: Ia3559cb765a645ed81ba286e59d37005cee93bb1 Reviewed-on: https://gerrit.libreoffice.org/81275 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- basic/source/sbx/sbxvalue.cxx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'basic/source') diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 1d29fa3ca5ab..c32d51f31b42 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -157,8 +157,7 @@ void SbxValue::Clear() { SAL_INFO("basic.sbx", "Not at Parent-Prop - otherwise CyclicRef"); SbxVariable *pThisVar = dynamic_cast( this ); - bool bParentProp = pThisVar && static_cast(pThisVar->GetUserData()) == - 5345; + bool bParentProp = pThisVar && (pThisVar->GetUserData() & 0xFFFF) == 5345; if ( !bParentProp ) aData.pObj->ReleaseRef(); } @@ -479,8 +478,7 @@ bool SbxValue::Put( const SbxValues& rVal ) } SAL_INFO("basic.sbx", "Not at Parent-Prop - otherwise CyclicRef"); SbxVariable *pThisVar = dynamic_cast( this ); - bool bParentProp = pThisVar && static_cast(pThisVar->GetUserData()) == - 5345; + bool bParentProp = pThisVar && (pThisVar->GetUserData() & 0xFFFF) == 5345; if ( !bParentProp ) p->aData.pObj->AddFirstRef(); } @@ -735,8 +733,8 @@ bool SbxValue::SetType( SbxDataType t ) { SAL_WARN("basic.sbx", "Not at Parent-Prop - otherwise CyclicRef"); SbxVariable *pThisVar = dynamic_cast( this ); - sal_uInt16 nSlotId = pThisVar - ? static_cast(pThisVar->GetUserData()) + sal_uInt32 nSlotId = pThisVar + ? pThisVar->GetUserData() & 0xFFFF : 0; DBG_ASSERT( nSlotId != 5345 || pThisVar->GetName() == "Parent", "SID_PARENTOBJECT is not named 'Parent'" ); -- cgit