[Libreoffice-commits] core.git: basic/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 22 06:56:22 UTC 2019


 basic/source/sbx/sbxvalue.cxx |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit b0de7a890e28f3a918ddb3583db0af8347e5d9ae
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Oct 21 11:11:00 2019 +0300
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Oct 22 08:55:42 2019 +0200

    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 at redhat.com>

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'" );


More information about the Libreoffice-commits mailing list