summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-11-06 13:39:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-11-06 15:45:14 +0100
commitd5b55513cdc05e8d622897201e233eb0ad5147b7 (patch)
tree4bd23ff2d444b876ef7cdbe3c4053929d7884d94
parent95911bf6b8ae0d13f0c3cfc93c06badff822eefb (diff)
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>
-rw-r--r--basic/source/basmgr/basmgr.cxx4
-rw-r--r--basic/source/classes/sb.cxx4
-rw-r--r--basic/source/comp/symtbl.cxx4
-rw-r--r--basic/source/inc/symtbl.hxx2
-rw-r--r--basic/source/runtime/methods.cxx2
-rw-r--r--basic/source/sbx/sbxarray.cxx6
-rw-r--r--include/basic/basmgr.hxx2
-rw-r--r--include/basic/sbdef.hxx2
-rw-r--r--include/basic/sbstar.hxx2
-rw-r--r--include/basic/sbx.hxx2
10 files changed, 15 insertions, 15 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 17e5d1760bbc..4173ad9c694c 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -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 )
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index e2fe5dfb3059..58ded6c8c3d1 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -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;
}
}
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 0040e55613d5..6f8b53ed0d5a 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -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];
}
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index 56f68d4fe882..eeb37844dbd1 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -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;
};
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index d0cf61f9fa42..597537385c7c 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -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[] =
{
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index 6cfbefad5500..f4025745e3d0 100644
--- a/basic/source/sbx/sbxarray.cxx
+++ b/basic/source/sbx/sbxarray.cxx
@@ -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;
}
diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx
index c9633425c4bc..b650c6f6cba7 100644
--- a/include/basic/basmgr.hxx
+++ b/include/basic/basmgr.hxx
@@ -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
diff --git a/include/basic/sbdef.hxx b/include/basic/sbdef.hxx
index 0fe4ce52b686..a82fc1c9461d 100644
--- a/include/basic/sbdef.hxx
+++ b/include/basic/sbdef.hxx
@@ -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
diff --git a/include/basic/sbstar.hxx b/include/basic/sbstar.hxx
index 5c4779de5949..f75845e93be7 100644
--- a/include/basic/sbstar.hxx
+++ b/include/basic/sbstar.hxx
@@ -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;
diff --git a/include/basic/sbx.hxx b/include/basic/sbx.hxx
index eb9007232391..dc4fdb7934e3 100644
--- a/include/basic/sbx.hxx
+++ b/include/basic/sbx.hxx
@@ -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 );
};