diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-12-09 13:06:03 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-12-09 14:18:25 +0100 |
commit | 62f3f3d92aa204eaaa063b30d7ade44df501b997 (patch) | |
tree | b241ad744abad62cf898947757e88617811b309c /basic/source/sbx | |
parent | 6303f8ac291233b1f6888a8d71e769debe0f9fb0 (diff) |
SbxArray: drop 16-bit indices
Change-Id: I43b478187636b9bb53fdf7ab938436ae364bd7a7
Reviewed-on: https://gerrit.libreoffice.org/84733
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic/source/sbx')
-rw-r--r-- | basic/source/sbx/sbxarray.cxx | 157 | ||||
-rw-r--r-- | basic/source/sbx/sbxcoll.cxx | 24 | ||||
-rw-r--r-- | basic/source/sbx/sbxexec.cxx | 4 | ||||
-rw-r--r-- | basic/source/sbx/sbxobj.cxx | 48 | ||||
-rw-r--r-- | basic/source/sbx/sbxstr.cxx | 10 | ||||
-rw-r--r-- | basic/source/sbx/sbxvalue.cxx | 2 | ||||
-rw-r--r-- | basic/source/sbx/sbxvar.cxx | 6 |
7 files changed, 63 insertions, 188 deletions
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx index 6a3cc720c91d..152ab5a671f4 100644 --- a/basic/source/sbx/sbxarray.cxx +++ b/basic/source/sbx/sbxarray.cxx @@ -89,13 +89,6 @@ sal_uInt32 SbxArray::Count32() const return mVarEntries.size(); } -sal_uInt16 SbxArray::Count() const -{ - sal_uInt32 nCount = mVarEntries.size(); - DBG_ASSERT( nCount <= SBX_MAXINDEX, "SBX: Array-Index > SBX_MAXINDEX" ); - return static_cast<sal_uInt16>(nCount); -} - SbxVariableRef& SbxArray::GetRef32( sal_uInt32 nIdx ) { // If necessary extend the array @@ -112,22 +105,6 @@ SbxVariableRef& SbxArray::GetRef32( sal_uInt32 nIdx ) return mVarEntries[nIdx].mpVar; } -SbxVariableRef& SbxArray::GetRef( sal_uInt16 nIdx ) -{ - // If necessary extend the array - DBG_ASSERT( nIdx <= SBX_MAXINDEX, "SBX: Array-Index > SBX_MAXINDEX" ); - // Very Hot Fix - if( nIdx > SBX_MAXINDEX ) - { - SetError( ERRCODE_BASIC_OUT_OF_RANGE ); - nIdx = 0; - } - if ( mVarEntries.size() <= nIdx ) - mVarEntries.resize(nIdx+1); - - return mVarEntries[nIdx].mpVar; -} - SbxVariable* SbxArray::Get32( sal_uInt32 nIdx ) { if( !CanRead() ) @@ -143,21 +120,6 @@ SbxVariable* SbxArray::Get32( sal_uInt32 nIdx ) return rRef.get(); } -SbxVariable* SbxArray::Get( sal_uInt16 nIdx ) -{ - if( !CanRead() ) - { - SetError( ERRCODE_BASIC_PROP_WRITEONLY ); - return nullptr; - } - SbxVariableRef& rRef = GetRef( nIdx ); - - if ( !rRef.is() ) - rRef = new SbxVariable( eType ); - - return rRef.get(); -} - void SbxArray::Put32( SbxVariable* pVar, sal_uInt32 nIdx ) { if( !CanWrite() ) @@ -170,30 +132,10 @@ void SbxArray::Put32( SbxVariable* pVar, sal_uInt32 nIdx ) if( eType != SbxOBJECT || pVar->GetClass() != SbxClassType::Object ) pVar->Convert( eType ); SbxVariableRef& rRef = GetRef32( nIdx ); - if( rRef.get() != pVar ) - { - rRef = pVar; - SetFlag( SbxFlagBits::Modified ); - } - } -} - -void SbxArray::Put( SbxVariable* pVar, sal_uInt16 nIdx ) -{ - if( !CanWrite() ) - SetError( ERRCODE_BASIC_PROP_READONLY ); - else - { - if( pVar ) - if( eType != SbxVARIANT ) - // Convert no objects - if( eType != SbxOBJECT || pVar->GetClass() != SbxClassType::Object ) - pVar->Convert( eType ); - SbxVariableRef& rRef = GetRef( nIdx ); // tdf#122250. It is possible that I hold the last reference to myself, so check, otherwise I might // call SetFlag on myself after I have died. bool removingMyself = rRef.get() && rRef->GetParameters() == this && GetRefCount() == 1; - if(rRef.get() != pVar ) + if( rRef.get() != pVar ) { rRef = pVar; if (!removingMyself) @@ -202,14 +144,14 @@ void SbxArray::Put( SbxVariable* pVar, sal_uInt16 nIdx ) } } -OUString SbxArray::GetAlias( sal_uInt16 nIdx ) +OUString SbxArray::GetAlias32( sal_uInt32 nIdx ) { if( !CanRead() ) { SetError( ERRCODE_BASIC_PROP_WRITEONLY ); return OUString(); } - SbxVarEntry& rRef = reinterpret_cast<SbxVarEntry&>(GetRef( nIdx )); + SbxVarEntry& rRef = reinterpret_cast<SbxVarEntry&>(GetRef32( nIdx )); if (!rRef.maAlias) return OUString(); @@ -217,7 +159,7 @@ OUString SbxArray::GetAlias( sal_uInt16 nIdx ) return *rRef.maAlias; } -void SbxArray::PutAlias( const OUString& rAlias, sal_uInt16 nIdx ) +void SbxArray::PutAlias32( const OUString& rAlias, sal_uInt32 nIdx ) { if( !CanWrite() ) { @@ -225,7 +167,7 @@ void SbxArray::PutAlias( const OUString& rAlias, sal_uInt16 nIdx ) } else { - SbxVarEntry& rRef = reinterpret_cast<SbxVarEntry&>( GetRef( nIdx ) ); + SbxVarEntry& rRef = reinterpret_cast<SbxVarEntry&>( GetRef32( nIdx ) ); rRef.maAlias = rAlias; } } @@ -259,16 +201,6 @@ void SbxArray::Insert32( SbxVariable* pVar, sal_uInt32 nIdx ) SetFlag( SbxFlagBits::Modified ); } -void SbxArray::Insert( SbxVariable* pVar, sal_uInt16 nIdx ) -{ - DBG_ASSERT( mVarEntries.size() <= 0x3FF0, "SBX: Array gets too big" ); - if( mVarEntries.size() > 0x3FF0 ) - { - return; - } - Insert32( pVar, nIdx ); -} - void SbxArray::Remove( sal_uInt32 nIdx ) { if( nIdx < mVarEntries.size() ) @@ -411,7 +343,7 @@ bool SbxArray::LoadData( SvStream& rStrm, sal_uInt16 /*nVer*/ ) SbxVariable* pVar = static_cast<SbxVariable*>(Load( rStrm )); if( pVar ) { - SbxVariableRef& rRef = GetRef( nIdx ); + SbxVariableRef& rRef = GetRef32( nIdx ); rRef = pVar; } else @@ -501,17 +433,6 @@ void SbxDimArray::AddDimImpl32( sal_Int32 lb, sal_Int32 ub, bool bAllowSize0 ) SetError( eRes ); } - -void SbxDimArray::AddDim( short lb, short ub ) -{ - AddDimImpl32( lb, ub, false ); -} - -void SbxDimArray::unoAddDim( short lb, short ub ) -{ - AddDimImpl32( lb, ub, true ); -} - void SbxDimArray::AddDim32( sal_Int32 lb, sal_Int32 ub ) { AddDimImpl32( lb, ub, false ); @@ -539,23 +460,6 @@ bool SbxDimArray::GetDim32( sal_Int32 n, sal_Int32& rlb, sal_Int32& rub ) const return true; } -bool SbxDimArray::GetDim( short n, short& rlb, short& rub ) const -{ - sal_Int32 rlb32, rub32; - bool bRet = GetDim32( n, rlb32, rub32 ); - rub = static_cast<short>(rub32); - rlb = static_cast<short>(rlb32); - if( bRet ) - { - if( rlb32 < -SBX_MAXINDEX || rub32 > SBX_MAXINDEX ) - { - SetError( ERRCODE_BASIC_OUT_OF_RANGE ); - return false; - } - } - return bRet; -} - // Element-Ptr with the help of an index list sal_uInt32 SbxDimArray::Offset32( const sal_Int32* pIdx ) @@ -578,37 +482,6 @@ sal_uInt32 SbxDimArray::Offset32( const sal_Int32* pIdx ) return nPos; } -sal_uInt16 SbxDimArray::Offset( const short* pIdx ) -{ - long nPos = 0; - for (auto const& vDimension : m_vDimensions) - { - short nIdx = *pIdx++; - if( nIdx < vDimension.nLbound || nIdx > vDimension.nUbound ) - { - nPos = SBX_MAXINDEX + 1; - break; - } - nPos = nPos * vDimension.nSize + nIdx - vDimension.nLbound; - } - if( m_vDimensions.empty() || nPos > SBX_MAXINDEX ) - { - SetError( ERRCODE_BASIC_OUT_OF_RANGE ); - nPos = 0; - } - return static_cast<sal_uInt16>(nPos); -} - -SbxVariable* SbxDimArray::Get( const short* pIdx ) -{ - return SbxArray::Get( Offset( pIdx ) ); -} - -void SbxDimArray::Put( SbxVariable* p, const short* pIdx ) -{ - SbxArray::Put( p, Offset( pIdx ) ); -} - SbxVariable* SbxDimArray::Get32( const sal_Int32* pIdx ) { return SbxArray::Get32( Offset32( pIdx ) ); @@ -624,7 +497,7 @@ sal_uInt32 SbxDimArray::Offset32( SbxArray* pPar ) { #if HAVE_FEATURE_SCRIPTING if (m_vDimensions.empty() || !pPar || - ((m_vDimensions.size() != sal::static_int_cast<size_t>(pPar->Count() - 1)) + ((m_vDimensions.size() != sal::static_int_cast<size_t>(pPar->Count32() - 1)) && SbiRuntime::isVBAEnabled())) { SetError( ERRCODE_BASIC_OUT_OF_RANGE ); @@ -632,10 +505,10 @@ sal_uInt32 SbxDimArray::Offset32( SbxArray* pPar ) } #endif sal_uInt32 nPos = 0; - sal_uInt16 nOff = 1; // Non element 0! + sal_uInt32 nOff = 1; // Non element 0! for (auto const& vDimension : m_vDimensions) { - sal_Int32 nIdx = pPar->Get( nOff++ )->GetLong(); + sal_Int32 nIdx = pPar->Get32( nOff++ )->GetLong(); if( nIdx < vDimension.nLbound || nIdx > vDimension.nUbound ) { nPos = sal_uInt32(SBX_MAXINDEX32)+1; @@ -666,19 +539,21 @@ bool SbxDimArray::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { sal_Int16 lb(0), ub(0); rStrm.ReadInt16( lb ).ReadInt16( ub ); - AddDim( lb, ub ); + AddDim32( lb, ub ); } return SbxArray::LoadData( rStrm, nVer ); } bool SbxDimArray::StoreData( SvStream& rStrm ) const { + assert(m_vDimensions.size() <= sal::static_int_cast<size_t>(std::numeric_limits<sal_Int16>::max())); rStrm.WriteInt16( m_vDimensions.size() ); - for( short i = 0; i < static_cast<short>(m_vDimensions.size()); i++ ) + for( sal_Int32 i = 1; i <= static_cast<sal_Int32>(m_vDimensions.size()); i++ ) { - short lb, ub; - GetDim( i, lb, ub ); - rStrm.WriteInt16( lb ).WriteInt16( ub ); + sal_Int32 lb32, ub32; + GetDim32(i, lb32, ub32); + assert(lb32 >= -SBX_MAXINDEX && ub32 <= SBX_MAXINDEX); + rStrm.WriteInt16(lb32).WriteInt16(ub32); } return SbxArray::StoreData( rStrm ); } diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx index ab69d3e032a6..7c186b4767aa 100644 --- a/basic/source/sbx/sbxcoll.cxx +++ b/basic/source/sbx/sbxcoll.cxx @@ -120,7 +120,7 @@ void SbxCollection::Notify( SfxBroadcaster& rCst, const SfxHint& rHint ) else if( pVar->GetHashCode() == nCountHash && aVarName.equalsIgnoreAsciiCase( pCount ) ) { - pVar->PutLong( pObjs->Count() ); + pVar->PutLong( sal::static_int_cast<sal_Int32>(pObjs->Count32()) ); } else if( pVar->GetHashCode() == nAddHash && aVarName.equalsIgnoreAsciiCase( pAdd ) ) @@ -151,13 +151,13 @@ void SbxCollection::Notify( SfxBroadcaster& rCst, const SfxHint& rHint ) void SbxCollection::CollAdd( SbxArray* pPar_ ) { - if( pPar_->Count() != 2 ) + if( pPar_->Count32() != 2 ) { SetError( ERRCODE_BASIC_WRONG_ARGS ); } else { - SbxBase* pObj = pPar_->Get( 1 )->GetObject(); + SbxBase* pObj = pPar_->Get32( 1 )->GetObject(); if( !pObj || dynamic_cast<const SbxObject*>(pObj) == nullptr ) { SetError( ERRCODE_BASIC_BAD_ARGUMENT ); @@ -173,14 +173,14 @@ void SbxCollection::CollAdd( SbxArray* pPar_ ) void SbxCollection::CollItem( SbxArray* pPar_ ) { - if( pPar_->Count() != 2 ) + if( pPar_->Count32() != 2 ) { SetError( ERRCODE_BASIC_WRONG_ARGS ); } else { SbxVariable* pRes = nullptr; - SbxVariable* p = pPar_->Get( 1 ); + SbxVariable* p = pPar_->Get32( 1 ); if( p->GetType() == SbxSTRING ) { pRes = Find( p->GetOUString(), SbxClassType::Object ); @@ -188,16 +188,16 @@ void SbxCollection::CollItem( SbxArray* pPar_ ) else { short n = p->GetInteger(); - if( n >= 1 && n <= static_cast<short>(pObjs->Count()) ) + if( n >= 1 && n <= static_cast<sal_Int32>(pObjs->Count32()) ) { - pRes = pObjs->Get( static_cast<sal_uInt16>(n) - 1 ); + pRes = pObjs->Get32( static_cast<sal_uInt32>(n) - 1 ); } } if( !pRes ) { SetError( ERRCODE_BASIC_BAD_INDEX ); } - pPar_->Get( 0 )->PutObject( pRes ); + pPar_->Get32( 0 )->PutObject( pRes ); } } @@ -205,15 +205,15 @@ void SbxCollection::CollItem( SbxArray* pPar_ ) void SbxCollection::CollRemove( SbxArray* pPar_ ) { - if( pPar_->Count() != 2 ) + if( pPar_->Count32() != 2 ) SetError( ERRCODE_BASIC_WRONG_ARGS ); else { - short n = pPar_->Get( 1 )->GetInteger(); - if( n < 1 || n > static_cast<short>(pObjs->Count()) ) + short n = pPar_->Get32( 1 )->GetInteger(); + if( n < 1 || n > static_cast<sal_Int32>(pObjs->Count32()) ) SetError( ERRCODE_BASIC_BAD_INDEX ); else - Remove( pObjs->Get( static_cast<sal_uInt16>(n) - 1 ) ); + Remove( pObjs->Get32( static_cast<sal_uInt32>(n) - 1 ) ); } } diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx index d5f46f06ac46..63f54b19d119 100644 --- a/basic/source/sbx/sbxexec.cxx +++ b/basic/source/sbx/sbxexec.cxx @@ -293,7 +293,7 @@ static SbxVariableRef Element { p++; auto refPar = tools::make_ref<SbxArray>(); - sal_uInt16 nArg = 0; + sal_uInt32 nArg = 0; // We are once relaxed and accept as well // the line- or command end as delimiter // Search parameter always global! @@ -310,7 +310,7 @@ static SbxVariableRef Element // One copies the parameter, so that // one have the current status (triggers also // the call per access) - refPar->Put( new SbxVariable( *refArg ), ++nArg ); + refPar->Put32( new SbxVariable( *refArg ), ++nArg ); } p = SkipWhitespace( p ); if( *p == ',' ) diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index f9ad3b24f816..143a1ea4156d 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -84,9 +84,9 @@ SbxObject& SbxObject::operator=( const SbxObject& r ) static void CheckParentsOnDelete( SbxObject* pObj, SbxArray* p ) { - for( sal_uInt16 i = 0; i < p->Count(); i++ ) + for( sal_uInt32 i = 0; i < p->Count32(); i++ ) { - SbxVariableRef& rRef = p->GetRef( i ); + SbxVariableRef& rRef = p->GetRef32( i ); if( rRef->IsBroadcaster() ) { pObj->EndListening( rRef->GetBroadcaster(), true ); @@ -301,7 +301,7 @@ void SbxObject::SetDfltProperty( const OUString& rName ) // the index will be set, otherwise the Count of the Array will be returned. // In any case the correct Array will be returned. -SbxArray* SbxObject::FindVar( SbxVariable const * pVar, sal_uInt16& nArrayIdx ) +SbxArray* SbxObject::FindVar( SbxVariable const * pVar, sal_uInt32& nArrayIdx ) { SbxArray* pArray = nullptr; if( pVar ) @@ -317,15 +317,15 @@ SbxArray* SbxObject::FindVar( SbxVariable const * pVar, sal_uInt16& nArrayIdx ) } if( pArray ) { - nArrayIdx = pArray->Count(); + nArrayIdx = pArray->Count32(); // Is the variable per name available? pArray->ResetFlag( SbxFlagBits::ExtSearch ); SbxVariable* pOld = pArray->Find( pVar->GetName(), pVar->GetClass() ); if( pOld ) { - for( sal_uInt16 i = 0; i < pArray->Count(); i++ ) + for( sal_uInt32 i = 0; i < pArray->Count32(); i++ ) { - SbxVariableRef& rRef = pArray->GetRef( i ); + SbxVariableRef& rRef = pArray->GetRef32( i ); if( rRef.get() == pOld ) { nArrayIdx = i; break; @@ -381,7 +381,7 @@ SbxVariable* SbxObject::Make( const OUString& rName, SbxClassType ct, SbxDataTyp break; } pVar->SetParent( this ); - pArray->Put( pVar, pArray->Count() ); + pArray->Put32( pVar, pArray->Count32() ); SetModified( true ); // The object listen always StartListening(pVar->GetBroadcaster(), DuplicateHandling::Prevent); @@ -390,22 +390,22 @@ SbxVariable* SbxObject::Make( const OUString& rName, SbxClassType ct, SbxDataTyp void SbxObject::Insert( SbxVariable* pVar ) { - sal_uInt16 nIdx; + sal_uInt32 nIdx; SbxArray* pArray = FindVar( pVar, nIdx ); if( pArray ) { // Into with it. But you should pay attention at the Pointer! - if( nIdx < pArray->Count() ) + if( nIdx < pArray->Count32() ) { // Then this element exists already // There are objects of the same name allowed at collections if( pArray == pObjs.get() && dynamic_cast<const SbxCollection*>( this ) != nullptr ) { - nIdx = pArray->Count(); + nIdx = pArray->Count32(); } else { - SbxVariable* pOld = pArray->Get( nIdx ); + SbxVariable* pOld = pArray->Get32( nIdx ); // already inside: overwrite if( pOld == pVar ) { @@ -422,7 +422,7 @@ void SbxObject::Insert( SbxVariable* pVar ) } } StartListening(pVar->GetBroadcaster(), DuplicateHandling::Prevent); - pArray->Put( pVar, nIdx ); + pArray->Put32( pVar, nIdx ); if( pVar->GetParent() != this ) { pVar->SetParent( this ); @@ -466,7 +466,7 @@ void SbxObject::QuickInsert( SbxVariable* pVar ) if( pArray ) { StartListening(pVar->GetBroadcaster(), DuplicateHandling::Prevent); - pArray->Put( pVar, pArray->Count() ); + pArray->Put32( pVar, pArray->Count32() ); if( pVar->GetParent() != this ) { pVar->SetParent( this ); @@ -498,9 +498,9 @@ void SbxObject::Remove( const OUString& rName, SbxClassType t ) void SbxObject::Remove( SbxVariable* pVar ) { - sal_uInt16 nIdx; + sal_uInt32 nIdx; SbxArray* pArray = FindVar( pVar, nIdx ); - if( pArray && nIdx < pArray->Count() ) + if( pArray && nIdx < pArray->Count32() ) { #ifdef DBG_UTIL OUString aVarName( pVar->GetName() ); @@ -512,7 +512,7 @@ void SbxObject::Remove( SbxVariable* pVar ) "basic.sbx", "remove " << aVarName << " in " << SbxVariable::GetName()); #endif - SbxVariableRef pVar_ = pArray->Get( nIdx ); + SbxVariableRef pVar_ = pArray->Get32( nIdx ); if( pVar_->IsBroadcaster() ) { EndListening( pVar_->GetBroadcaster(), true ); @@ -537,9 +537,9 @@ static bool LoadArray( SvStream& rStrm, SbxObject* pThis, SbxArray* pArray ) { return false; } - for( sal_uInt16 i = 0; i < p->Count(); i++ ) + for( sal_uInt32 i = 0; i < p->Count32(); i++ ) { - SbxVariableRef& r = p->GetRef( i ); + SbxVariableRef& r = p->GetRef32( i ); SbxVariable* pVar = r.get(); if( pVar ) { @@ -727,9 +727,9 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill ) // Methods rStrm.WriteOString( aIndentNameStr ).WriteCharPtr( "- Methods:" ) << endl; - for( sal_uInt16 i = 0; i < pMethods->Count(); i++ ) + for( sal_uInt32 i = 0; i < pMethods->Count32(); i++ ) { - SbxVariableRef& r = pMethods->GetRef( i ); + SbxVariableRef& r = pMethods->GetRef32( i ); SbxVariable* pVar = r.get(); if( pVar ) { @@ -764,9 +764,9 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill ) // Properties rStrm.WriteOString( aIndentNameStr ).WriteCharPtr( "- Properties:" ) << endl; { - for( sal_uInt16 i = 0; i < pProps->Count(); i++ ) + for( sal_uInt32 i = 0; i < pProps->Count32(); i++ ) { - SbxVariableRef& r = pProps->GetRef( i ); + SbxVariableRef& r = pProps->GetRef32( i ); SbxVariable* pVar = r.get(); if( pVar ) { @@ -802,9 +802,9 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill ) // Objects rStrm.WriteOString( aIndentNameStr ).WriteCharPtr( "- Objects:" ) << endl; { - for( sal_uInt16 i = 0; i < pObjs->Count(); i++ ) + for( sal_uInt32 i = 0; i < pObjs->Count32(); i++ ) { - SbxVariableRef& r = pObjs->GetRef( i ); + SbxVariableRef& r = pObjs->GetRef32( i ); SbxVariable* pVar = r.get(); if ( pVar ) { diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx index 65fdb906daf9..8edfb9d7ab2b 100644 --- a/basic/source/sbx/sbxstr.cxx +++ b/basic/source/sbx/sbxstr.cxx @@ -282,7 +282,7 @@ SbxArray* StringToByteArray(const OUString& rStr) } else { - pArray->unoAddDim( 0, -1 ); + pArray->unoAddDim32( 0, -1 ); } for( sal_Int32 i=0; i< nArraySize; i++) @@ -291,7 +291,7 @@ SbxArray* StringToByteArray(const OUString& rStr) sal_uInt8 aByte = static_cast< sal_uInt8 >( (i%2) ? ((*pSrc) >> 8) & 0xff : (*pSrc) & 0xff ); pNew->PutByte( aByte ); pNew->SetFlag( SbxFlagBits::Write ); - pArray->Put( pNew, i ); + pArray->Put32( pNew, i ); if( i%2 ) pSrc++; } @@ -301,12 +301,12 @@ SbxArray* StringToByteArray(const OUString& rStr) // Convert an array of bytes to string (2bytes per character) OUString ByteArrayToString(SbxArray* pArr) { - sal_uInt16 nCount = pArr->Count(); + sal_uInt32 nCount = pArr->Count32(); OUStringBuffer aStrBuf; sal_Unicode aChar = 0; - for( sal_uInt16 i = 0 ; i < nCount ; i++ ) + for( sal_uInt32 i = 0 ; i < nCount ; i++ ) { - sal_Unicode aTempChar = pArr->Get(i)->GetByte(); + sal_Unicode aTempChar = pArr->Get32(i)->GetByte(); if( i%2 ) { aChar = (aTempChar << 8 ) | aChar; diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index a36abf52256a..bd668a02964d 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -246,7 +246,7 @@ SbxValue* SbxValue::TheRealValue( bool bObjInObjError ) const if( pDimArray ) p = pDimArray->Get( pPar ); else - p = pArray->Get( pPar->Get( 1 )->GetInteger() ); + p = pArray->Get32( pPar->Get32( 1 )->GetInteger() ); break; } } diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 01d394b14d83..d8425d59aaa6 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -176,7 +176,7 @@ void SbxVariable::Broadcast( SfxHintId nHintId ) if( mpPar.is() ) { // Register this as element 0, but don't change over the parent! - mpPar->GetRef( 0 ) = this; + mpPar->GetRef32( 0 ) = this; } pSave->Broadcast( SbxHint( nHintId, this ) ); mpBroadcaster = std::move(pSave); @@ -396,9 +396,9 @@ void SbxVariable::SetParent( SbxObject* p ) SbxArray *pChildren = p->GetObjects(); if ( pChildren ) { - for ( sal_uInt16 nIdx = 0; !bFound && nIdx < pChildren->Count(); ++nIdx ) + for ( sal_uInt32 nIdx = 0; !bFound && nIdx < pChildren->Count32(); ++nIdx ) { - bFound = ( this == pChildren->Get(nIdx) ); + bFound = ( this == pChildren->Get32(nIdx) ); } } SAL_INFO_IF( |