summaryrefslogtreecommitdiff
path: root/basic/source/sbx/sbxcoll.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/sbx/sbxcoll.cxx')
-rw-r--r--basic/source/sbx/sbxcoll.cxx31
1 files changed, 16 insertions, 15 deletions
diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx
index 7c186b4767aa..a29e832fa2a8 100644
--- a/basic/source/sbx/sbxcoll.cxx
+++ b/basic/source/sbx/sbxcoll.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <o3tl/safeint.hxx>
#include <tools/stream.hxx>
#include <basic/sbx.hxx>
@@ -120,7 +121,7 @@ void SbxCollection::Notify( SfxBroadcaster& rCst, const SfxHint& rHint )
else if( pVar->GetHashCode() == nCountHash
&& aVarName.equalsIgnoreAsciiCase( pCount ) )
{
- pVar->PutLong( sal::static_int_cast<sal_Int32>(pObjs->Count32()) );
+ pVar->PutLong(sal::static_int_cast<sal_Int32>(pObjs->Count()));
}
else if( pVar->GetHashCode() == nAddHash
&& aVarName.equalsIgnoreAsciiCase( pAdd ) )
@@ -151,13 +152,13 @@ void SbxCollection::Notify( SfxBroadcaster& rCst, const SfxHint& rHint )
void SbxCollection::CollAdd( SbxArray* pPar_ )
{
- if( pPar_->Count32() != 2 )
+ if (pPar_->Count() != 2)
{
SetError( ERRCODE_BASIC_WRONG_ARGS );
}
else
{
- SbxBase* pObj = pPar_->Get32( 1 )->GetObject();
+ SbxBase* pObj = pPar_->Get(1)->GetObject();
if( !pObj || dynamic_cast<const SbxObject*>(pObj) == nullptr )
{
SetError( ERRCODE_BASIC_BAD_ARGUMENT );
@@ -173,14 +174,14 @@ void SbxCollection::CollAdd( SbxArray* pPar_ )
void SbxCollection::CollItem( SbxArray* pPar_ )
{
- if( pPar_->Count32() != 2 )
+ if (pPar_->Count() != 2)
{
SetError( ERRCODE_BASIC_WRONG_ARGS );
}
else
{
SbxVariable* pRes = nullptr;
- SbxVariable* p = pPar_->Get32( 1 );
+ SbxVariable* p = pPar_->Get(1);
if( p->GetType() == SbxSTRING )
{
pRes = Find( p->GetOUString(), SbxClassType::Object );
@@ -188,16 +189,16 @@ void SbxCollection::CollItem( SbxArray* pPar_ )
else
{
short n = p->GetInteger();
- if( n >= 1 && n <= static_cast<sal_Int32>(pObjs->Count32()) )
+ if (n >= 1 && o3tl::make_unsigned(n) <= pObjs->Count())
{
- pRes = pObjs->Get32( static_cast<sal_uInt32>(n) - 1 );
+ pRes = pObjs->Get(static_cast<sal_uInt32>(n) - 1);
}
}
if( !pRes )
{
SetError( ERRCODE_BASIC_BAD_INDEX );
}
- pPar_->Get32( 0 )->PutObject( pRes );
+ pPar_->Get(0)->PutObject(pRes);
}
}
@@ -205,15 +206,15 @@ void SbxCollection::CollItem( SbxArray* pPar_ )
void SbxCollection::CollRemove( SbxArray* pPar_ )
{
- if( pPar_->Count32() != 2 )
+ if (pPar_->Count() != 2)
SetError( ERRCODE_BASIC_WRONG_ARGS );
else
{
- short n = pPar_->Get32( 1 )->GetInteger();
- if( n < 1 || n > static_cast<sal_Int32>(pObjs->Count32()) )
+ short n = pPar_->Get(1)->GetInteger();
+ if (n < 1 || o3tl::make_unsigned(n) > pObjs->Count())
SetError( ERRCODE_BASIC_BAD_INDEX );
else
- Remove( pObjs->Get32( static_cast<sal_uInt32>(n) - 1 ) );
+ Remove(pObjs->Get(static_cast<sal_uInt32>(n) - 1));
}
}
@@ -292,16 +293,16 @@ bool SbxStdCollection::LoadData( SvStream& rStrm, sal_uInt16 nVer )
return bRes;
}
-bool SbxStdCollection::StoreData( SvStream& rStrm ) const
+std::pair<bool, sal_uInt32> SbxStdCollection::StoreData( SvStream& rStrm ) const
{
- bool bRes = SbxCollection::StoreData( rStrm );
+ const auto& [bRes, nVersion] = SbxCollection::StoreData(rStrm);
if( bRes )
{
write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, aElemClass,
RTL_TEXTENCODING_ASCII_US);
rStrm.WriteBool( bAddRemoveOk );
}
- return bRes;
+ return { bRes, nVersion };
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */