loplugin:passstuffbyref in basic

Change-Id: I1aee08f0ff2a3dabcedc49a31e7ff4de9428007e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176136
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2024-11-06 13:39:01 +02:00
parent 95911bf6b8
commit d5b55513cd
10 changed files with 15 additions and 15 deletions

View File

@@ -1215,14 +1215,14 @@ bool BasicManager::HasLib( std::u16string_view rName ) const
return false;
}
OUString BasicManager::GetLibName( sal_uInt16 nLib )
const OUString & BasicManager::GetLibName( sal_uInt16 nLib )
{
DBG_ASSERT( nLib < maLibs.size(), "Lib?!" );
if ( nLib < maLibs.size() )
{
return maLibs[nLib]->GetLibName();
}
return OUString();
return EMPTY_OUSTRING;
}
bool BasicManager::LoadLib( sal_uInt16 nLib )

View File

@@ -1712,7 +1712,7 @@ ErrCode StarBASIC::GetErrBasic()
}
// make the additional message for the RTL function error accessible
OUString StarBASIC::GetErrorMsg()
const OUString & StarBASIC::GetErrorMsg()
{
if( GetSbData()->pInst )
{
@@ -1720,7 +1720,7 @@ OUString StarBASIC::GetErrorMsg()
}
else
{
return OUString();
return EMPTY_OUSTRING;
}
}

View File

@@ -40,10 +40,10 @@ SbiStringPool::SbiStringPool( )
SbiStringPool::~SbiStringPool()
{}
OUString SbiStringPool::Find( sal_uInt32 n ) const
const OUString & SbiStringPool::Find( sal_uInt32 n ) const
{
if( n == 0 || n > aData.size() )
return OUString();
return EMPTY_OUSTRING;
else
return aData[n - 1];
}

View File

@@ -42,7 +42,7 @@ public:
sal_uInt32 GetSize() const { return aData.size(); }
short Add( const OUString& );
short Add( double, SbxDataType );
OUString Find( sal_uInt32 ) const;
const OUString & Find( sal_uInt32 ) const;
};

View File

@@ -3564,7 +3564,7 @@ void SbRtl_VarType(StarBASIC *, SbxArray & rPar, bool)
}
// Exported function
OUString getBasicTypeName( SbxDataType eType )
const OUString & getBasicTypeName( SbxDataType eType )
{
static constexpr OUString pTypeNames[] =
{

View File

@@ -144,17 +144,17 @@ void SbxArray::Put( SbxVariable* pVar, sal_uInt32 nIdx )
}
}
OUString SbxArray::GetAlias( sal_uInt32 nIdx )
const OUString & SbxArray::GetAlias( sal_uInt32 nIdx )
{
if( !CanRead() )
{
SetError( ERRCODE_BASIC_PROP_WRITEONLY );
return OUString();
return EMPTY_OUSTRING;
}
SbxVarEntry& rRef = reinterpret_cast<SbxVarEntry&>(GetRef( nIdx ));
if (!rRef.maAlias)
return OUString();
return EMPTY_OUSTRING;
return *rRef.maAlias;
}

View File

@@ -127,7 +127,7 @@ public:
StarBASIC* GetLib( std::u16string_view rName ) const;
sal_uInt16 GetLibId( std::u16string_view rName ) const;
OUString GetLibName( sal_uInt16 nLib );
const OUString & GetLibName( sal_uInt16 nLib );
/** announces the library containers which belong to this BasicManager

View File

@@ -28,7 +28,7 @@ class ErrCode;
// Returns type name for Basic type, array flag is ignored
// implementation: basic/source/runtime/methods.cxx
BASIC_DLLPUBLIC OUString getBasicTypeName( SbxDataType eType );
BASIC_DLLPUBLIC const OUString & getBasicTypeName( SbxDataType eType );
// Returns type name for Basic objects, especially
// important for SbUnoObj instances

View File

@@ -93,7 +93,7 @@ public:
static bool IsRunning();
static ErrCode GetErrBasic();
// #66536 make additional message accessible by RTL function Error
static OUString GetErrorMsg();
static const OUString & GetErrorMsg();
static sal_Int32 GetErl();
virtual SbxVariable* Find( const OUString&, SbxClassType ) override;

View File

@@ -122,7 +122,7 @@ public:
void Remove( sal_uInt32 );
void Remove( SbxVariable const * );
void Merge( SbxArray* );
OUString GetAlias(sal_uInt32);
const OUString & GetAlias(sal_uInt32);
void PutAlias(const OUString&, sal_uInt32);
SbxVariable* Find( const OUString&, SbxClassType );
};