basic/source/classes/image.cxx   |    6 ++---
 basic/source/inc/image.hxx       |    2 -
 basic/source/runtime/runtime.cxx |   40 +++++++++++++++++++--------------------
 3 files changed, 24 insertions(+), 24 deletions(-)

New commits:
commit 0af4324c57a2ee22afcba72c0244c56cb7df8d4b
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Wed Jun 1 16:05:07 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed Jun 1 21:20:29 2022 +0200

    Use more appropriate type for SbiImage::GetString nId param
    
    Change-Id: I4207830e3923ce9b4f7c0f59cf5880dfcf89979b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135243
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index 677e0a68c8f1..e5f9ac3f5df2 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -643,14 +643,14 @@ void SbiImage::AddEnum(SbxObject* pObject) // Register 
enum type
 }
 
 // Note: IDs start with 1
-OUString SbiImage::GetString( short nId, SbxDataType *eType ) const
+OUString SbiImage::GetString( sal_uInt32 nId, SbxDataType *eType ) const
 {
-    if( nId && nId <= short(mvStringOffsets.size()) )
+    if( nId && nId <= mvStringOffsets.size() )
     {
         sal_uInt32 nOff = mvStringOffsets[ nId - 1 ];
         sal_Unicode* pStr = pStrings.get() + nOff;
 
-        sal_uInt32 nNextOff = (nId < short(mvStringOffsets.size())) ? 
mvStringOffsets[ nId ] : nStringSize;
+        sal_uInt32 nNextOff = (nId < mvStringOffsets.size()) ? 
mvStringOffsets[ nId ] : nStringSize;
         sal_uInt32 nLen = nNextOff - nOff - 1;
         // #i42467: Special treatment for vbNullChar
         if (*pStr == 0)
diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx
index 4bd4201a46f9..f89776af09b9 100644
--- a/basic/source/inc/image.hxx
+++ b/basic/source/inc/image.hxx
@@ -85,7 +85,7 @@ public:
     const sal_uInt8* GetCode() const { return aCode.data(); }
     sal_uInt32 GetCodeSize() const { return aCode.size(); }
     sal_uInt16  GetBase() const     { return nDimBase;  }
-    OUString    GetString( short nId, SbxDataType *eType = nullptr ) const;
+    OUString    GetString( sal_uInt32 nId, SbxDataType *eType = nullptr ) 
const;
     const SbxObject* FindType (const OUString& aTypeName) const;
 
     const SbxArrayRef& GetEnums() const { return rEnums; }
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 871f1127d8a7..f5792fe33dba 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -2848,7 +2848,7 @@ void SbiRuntime::StepLOADNC( sal_uInt32 nOp1 )
     // tdf#143707 - check if the data type character was added after the 
string termination symbol
     SbxDataType eTypeStr;
     // #57844 use localized function
-    OUString aStr = pImg->GetString(static_cast<short>(nOp1), &eTypeStr);
+    OUString aStr = pImg->GetString(nOp1, &eTypeStr);
     // also allow , !!!
     sal_Int32 iComma = aStr.indexOf(',');
     if( iComma >= 0 )
@@ -2894,7 +2894,7 @@ void SbiRuntime::StepLOADNC( sal_uInt32 nOp1 )
 void SbiRuntime::StepLOADSC( sal_uInt32 nOp1 )
 {
     SbxVariable* p = new SbxVariable;
-    p->PutString( pImg->GetString( static_cast<short>( nOp1 ) ) );
+    p->PutString( pImg->GetString( nOp1 ) );
     PushVar( p );
 }
 
@@ -2916,7 +2916,7 @@ void SbiRuntime::StepARGN( sal_uInt32 nOp1 )
         StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR );
     else
     {
-        OUString aAlias( pImg->GetString( static_cast<short>( nOp1 ) ) );
+        OUString aAlias( pImg->GetString( nOp1 ) );
         SbxVariableRef pVal = PopVar();
         if( bVBAEnabled &&
                 ( dynamic_cast<const SbxMethod*>( pVal.get()) != nullptr
@@ -3427,7 +3427,7 @@ void SbiRuntime::StepSETCLASS_impl( sal_uInt32 nOp1, bool 
bHandleDflt )
 {
     SbxVariableRef refVal = PopVar();
     SbxVariableRef refVar = PopVar();
-    OUString aClass( pImg->GetString( static_cast<short>( nOp1 ) ) );
+    OUString aClass( pImg->GetString( nOp1 ) );
 
     bool bOk = checkClass_Impl( refVal, aClass, true, true );
     if( bOk )
@@ -3449,7 +3449,7 @@ void SbiRuntime::StepSETCLASS( sal_uInt32 nOp1 )
 void SbiRuntime::StepTESTCLASS( sal_uInt32 nOp1 )
 {
     SbxVariableRef xObjVal = PopVar();
-    OUString aClass( pImg->GetString( static_cast<short>( nOp1 ) ) );
+    OUString aClass( pImg->GetString( nOp1 ) );
     bool bDefault = !bVBAEnabled;
     bool bOk = checkClass_Impl( xObjVal, aClass, false, bDefault );
 
@@ -3462,7 +3462,7 @@ void SbiRuntime::StepTESTCLASS( sal_uInt32 nOp1 )
 
 void SbiRuntime::StepLIB( sal_uInt32 nOp1 )
 {
-    aLibName = pImg->GetString( static_cast<short>( nOp1 ) );
+    aLibName = pImg->GetString( nOp1 );
 }
 
 // TOS is incremented by BASE, BASE is pushed before (+BASE)
@@ -3516,7 +3516,7 @@ SbxVariable* SbiRuntime::FindElement( SbxObject* pObj, 
sal_uInt32 nOp1, sal_uInt
     {
         bool bFatalError = false;
         SbxDataType t = static_cast<SbxDataType>(nOp2);
-        OUString aName( pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) ) 
);
+        OUString aName( pImg->GetString( nOp1 & 0x7FFF ) );
         // Hacky capture of Evaluate [] syntax
         // this should be tackled I feel at the pcode level
         if ( bIsVBAInterOp && aName.startsWith("[") )
@@ -4308,7 +4308,7 @@ void SbiRuntime::StepCASEIS( sal_uInt32 nOp1, sal_uInt32 
nOp2 )
 
 void SbiRuntime::StepCALL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
 {
-    OUString aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
+    OUString aName = pImg->GetString( nOp1 & 0x7FFF );
     SbxArray* pArgs = nullptr;
     if( nOp1 & 0x8000 )
     {
@@ -4326,7 +4326,7 @@ void SbiRuntime::StepCALL( sal_uInt32 nOp1, sal_uInt32 
nOp2 )
 
 void SbiRuntime::StepCALLC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
 {
-    OUString aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
+    OUString aName = pImg->GetString( nOp1 & 0x7FFF );
     SbxArray* pArgs = nullptr;
     if( nOp1 & 0x8000 )
     {
@@ -4459,7 +4459,7 @@ void SbiRuntime::StepOPEN( sal_uInt32 nOp1, sal_uInt32 
nOp2 )
 
 void SbiRuntime::StepCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 )
 {
-    OUString aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
+    OUString aClass( pImg->GetString( nOp2 ) );
     SbxObjectRef pObj = SbxBase::CreateObject( aClass );
     if( !pObj )
     {
@@ -4467,7 +4467,7 @@ void SbiRuntime::StepCREATE( sal_uInt32 nOp1, sal_uInt32 
nOp2 )
     }
     else
     {
-        OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
+        OUString aName( pImg->GetString( nOp1 ) );
         pObj->SetName( aName );
         // the object must be able to call the BASIC
         pObj->SetParent( &rBasic );
@@ -4529,7 +4529,7 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, 
sal_uInt32 nOp2 )
         nTotalSize = 0; // on error, don't create objects
 
     // create objects and insert them into the array
-    OUString aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
+    OUString aClass( pImg->GetString( nOp2 ) );
     OUString aName;
     for( sal_Int32 i = 0 ; i < nTotalSize ; ++i )
     {
@@ -4544,7 +4544,7 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, 
sal_uInt32 nOp2 )
             else
             {
                 if (aName.isEmpty())
-                    aName = pImg->GetString(static_cast<short>(nOp1));
+                    aName = pImg->GetString(nOp1);
                 pClassObj->SetName(aName);
                 // the object must be able to call the basic
                 pClassObj->SetParent(&rBasic);
@@ -4556,8 +4556,8 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, 
sal_uInt32 nOp2 )
 
 void SbiRuntime::StepTCREATE( sal_uInt32 nOp1, sal_uInt32 nOp2 )
 {
-    OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
-    OUString aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
+    OUString aName( pImg->GetString( nOp1 ) );
+    OUString aClass( pImg->GetString( nOp2 ) );
 
     SbxObjectRef pCopyObj = createUserTypeImpl( aClass );
     if( pCopyObj )
@@ -4606,7 +4606,7 @@ void SbiRuntime::StepLOCAL( sal_uInt32 nOp1, sal_uInt32 
nOp2 )
     {
         refLocals = new SbxArray;
     }
-    OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
+    OUString aName( pImg->GetString( nOp1 ) );
     if( refLocals->Find( aName, SbxClassType::DontCare ) == nullptr )
     {
         SbxDataType t = static_cast<SbxDataType>(nOp2 & 0xffff);
@@ -4621,7 +4621,7 @@ void SbiRuntime::StepLOCAL( sal_uInt32 nOp1, sal_uInt32 
nOp2 )
 
 void SbiRuntime::StepPUBLIC_Impl( sal_uInt32 nOp1, sal_uInt32 nOp2, bool 
bUsedForClassModule )
 {
-    OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
+    OUString aName( pImg->GetString( nOp1 ) );
     SbxDataType t = static_cast<SbxDataType>(nOp2 & 0xffff);
     bool bFlag = pMod->IsSet( SbxFlagBits::NoModify );
     pMod->SetFlag( SbxFlagBits::NoModify );
@@ -4673,7 +4673,7 @@ void SbiRuntime::StepGLOBAL( sal_uInt32 nOp1, sal_uInt32 
nOp2 )
     {
         StepPUBLIC_Impl( nOp1, nOp2, true );
     }
-    OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
+    OUString aName( pImg->GetString( nOp1 ) );
     SbxDataType t = static_cast<SbxDataType>(nOp2 & 0xffff);
 
     // Store module scope variables at module scope
@@ -4733,7 +4733,7 @@ void SbiRuntime::StepFIND_G( sal_uInt32 nOp1, sal_uInt32 
nOp2 )
     {
         // Return dummy variable
         SbxDataType t = static_cast<SbxDataType>(nOp2);
-        OUString aName( pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) ) 
);
+        OUString aName( pImg->GetString( nOp1 & 0x7FFF ) );
 
         SbxVariable* pDummyVar = new SbxVariable( t );
         pDummyVar->SetName( aName );
@@ -4766,7 +4766,7 @@ SbxVariable* SbiRuntime::StepSTATIC_Impl(
 // establishing a static variable (+StringID+type)
 void SbiRuntime::StepSTATIC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
 {
-    OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
+    OUString aName( pImg->GetString( nOp1 ) );
     SbxDataType t = static_cast<SbxDataType>(nOp2 & 0xffff);
     StepSTATIC_Impl( aName, t, nOp2 );
 }

Reply via email to