summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-10-21 11:11:00 +0300
committerStephan Bergmann <sbergman@redhat.com>2019-10-22 08:55:42 +0200
commitb0de7a890e28f3a918ddb3583db0af8347e5d9ae (patch)
tree2bdd0b4cf81581467a2866780f0f8034722f9895
parent9a29a4df545d7f88cd14bb99ce54f149032eb7f0 (diff)
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 <sbergman@redhat.com>
-rw-r--r--basic/source/sbx/sbxvalue.cxx10
1 files changed, 4 insertions, 6 deletions
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<SbxVariable*>( this );
- bool bParentProp = pThisVar && static_cast<sal_uInt16>(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<SbxVariable*>( this );
- bool bParentProp = pThisVar && static_cast<sal_uInt16>(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<SbxVariable*>( this );
- sal_uInt16 nSlotId = pThisVar
- ? static_cast<sal_uInt16>(pThisVar->GetUserData())
+ sal_uInt32 nSlotId = pThisVar
+ ? pThisVar->GetUserData() & 0xFFFF
: 0;
DBG_ASSERT( nSlotId != 5345 || pThisVar->GetName() == "Parent",
"SID_PARENTOBJECT is not named 'Parent'" );