summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-23 07:36:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-23 08:39:10 +0200
commit44688e498c9672f0a1759ead394f6d6e0f0ef5fd (patch)
treef2f1b33f882ced5c23c2854177c9b266c907ac56 /basic
parentb0c6d587405af9e2263dc5073a9a965db46ff986 (diff)
clang-tidy performance-unnecessary-copy-initialization in
basctl..basic Change-Id: I4009282869cd8a2f269093564bd4fafccab80ec3 Reviewed-on: https://gerrit.libreoffice.org/62212 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/classes/image.cxx2
-rw-r--r--basic/source/classes/sb.cxx2
-rw-r--r--basic/source/classes/sbunoobj.cxx18
-rw-r--r--basic/source/runtime/methods.cxx24
-rw-r--r--basic/source/runtime/methods1.cxx10
-rw-r--r--basic/source/runtime/runtime.cxx2
6 files changed, 29 insertions, 29 deletions
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index 28667187513e..932a541bb57a 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -465,7 +465,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
SbxProperty* pTypeElem = static_cast< SbxProperty* > ( pTypeMembers->Get(j) );
- OUString aElemName = pTypeElem->GetName();
+ const OUString& aElemName = pTypeElem->GetName();
r.WriteUniOrByteString( aElemName, eCharSet );
SbxDataType dataType = pTypeElem->GetType();
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 944836865545..23fedab3b08b 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -730,7 +730,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
SbxObject* pObj = dynamic_cast<SbxObject*>( pObjBase );
if( pObj != nullptr )
{
- OUString aObjClass = pObj->GetClassName();
+ const OUString& aObjClass = pObj->GetClassName();
SbClassModuleObject* pClassModuleObj = dynamic_cast<SbClassModuleObject*>( pObjBase );
if( pClassModuleObj != nullptr )
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 3e9df83c4df7..9aa7725aca74 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -327,7 +327,7 @@ static OUString implGetExceptionMsg( const Any& _rCaughtException )
static Any convertAny( const Any& rVal, const Type& aDestType )
{
Any aConvertedVal;
- Reference< XTypeConverter > xConverter = getTypeConverter_Impl();
+ const Reference< XTypeConverter >& xConverter = getTypeConverter_Impl();
try
{
aConvertedVal = xConverter->convertTo( rVal, aDestType );
@@ -1146,7 +1146,7 @@ static bool implGetTypeByName( const OUString& rName, Type& rRetType )
{
bool bSuccess = false;
- Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
+ const Reference< XHierarchicalNameAccess >& xTypeAccess = getTypeProvider_Impl();
if( xTypeAccess->hasByHierarchicalName( rName ) )
{
Any aRet = xTypeAccess->getByHierarchicalName( rName );
@@ -2835,7 +2835,7 @@ static SbUnoObject* Impl_CreateUnoStruct( const OUString& aClassName )
// search for the class
Reference< XIdlClass > xClass;
- Reference< XHierarchicalNameAccess > xHarryName =
+ const Reference< XHierarchicalNameAccess >& xHarryName =
getCoreReflection_HierarchicalNameAccess_Impl();
if( xHarryName.is() && xHarryName->hasByHierarchicalName( aClassName ) )
xClass = xCoreReflection->forName( aClassName );
@@ -3294,7 +3294,7 @@ SbUnoClass* findUnoClass( const OUString& rName )
// #105550 Check if module exists
SbUnoClass* pUnoClass = nullptr;
- Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
+ const Reference< XHierarchicalNameAccess >& xTypeAccess = getTypeProvider_Impl();
if( xTypeAccess->hasByHierarchicalName( rName ) )
{
Any aRet = xTypeAccess->getByHierarchicalName( rName );
@@ -3444,7 +3444,7 @@ SbUnoService* findUnoService( const OUString& rName )
{
SbUnoService* pSbUnoService = nullptr;
- Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
+ const Reference< XHierarchicalNameAccess >& xTypeAccess = getTypeProvider_Impl();
if( xTypeAccess->hasByHierarchicalName( rName ) )
{
Any aRet = xTypeAccess->getByHierarchicalName( rName );
@@ -3691,7 +3691,7 @@ SbUnoSingleton* findUnoSingleton( const OUString& rName )
{
SbUnoSingleton* pSbUnoSingleton = nullptr;
- Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
+ const Reference< XHierarchicalNameAccess >& xTypeAccess = getTypeProvider_Impl();
if( xTypeAccess->hasByHierarchicalName( rName ) )
{
Any aRet = xTypeAccess->getByHierarchicalName( rName );
@@ -4130,7 +4130,7 @@ void RTL_Impl_CreateUnoValue( SbxArray& rPar )
}
// Check the type
- Reference< XHierarchicalNameAccess > xTypeAccess = getTypeProvider_Impl();
+ const Reference< XHierarchicalNameAccess >& xTypeAccess = getTypeProvider_Impl();
Any aRet;
try
{
@@ -4507,7 +4507,7 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
for( sal_uInt16 i = 0 ; i < nCount ; ++i )
{
SbxVariable* pVar = pModIfaces->Get( i );
- OUString aIfaceName = pVar->GetName();
+ const OUString& aIfaceName = pVar->GetName();
if( !aIfaceName.isEmpty() )
{
@@ -4778,7 +4778,7 @@ OUString SbUnoStructRefObject::Impl_DumpProperties()
// Is it in Uno a sequence?
SbxDataType eType = pVar->GetFullType();
- OUString aName( pVar->GetName() );
+ const OUString& aName( pVar->GetName() );
StructFieldInfo::iterator it = maFields.find( aName );
if ( it != maFields.end() )
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 6225cb58e0f8..05ce540be4b1 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -460,7 +460,7 @@ void SbRtl_ChDrive(StarBASIC *, SbxArray & rPar, bool)
// Implementation of StepRENAME with UCB
void implStepRenameUCB( const OUString& aSource, const OUString& aDest )
{
- uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+ const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
if( xSFI.is() )
{
try
@@ -508,7 +508,7 @@ void SbRtl_FileCopy(StarBASIC *, SbxArray & rPar, bool)
OUString aDest = rPar.Get(2)->GetOUString();
if( hasUno() )
{
- uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+ const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
if( xSFI.is() )
{
try
@@ -543,7 +543,7 @@ void SbRtl_Kill(StarBASIC *, SbxArray & rPar, bool)
if( hasUno() )
{
- uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+ const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
if( xSFI.is() )
{
OUString aFullPath = getFullPath( aFileSpec );
@@ -604,7 +604,7 @@ void SbRtl_MkDir(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
if( hasUno() )
{
- uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+ const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
if( xSFI.is() )
{
try
@@ -700,7 +700,7 @@ void SbRtl_RmDir(StarBASIC *, SbxArray & rPar, bool)
OUString aPath = rPar.Get(1)->GetOUString();
if( hasUno() )
{
- uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+ const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
if( xSFI.is() )
{
try
@@ -774,7 +774,7 @@ void SbRtl_FileLen(StarBASIC *, SbxArray & rPar, bool)
sal_Int32 nLen = 0;
if( hasUno() )
{
- uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+ const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
if( xSFI.is() )
{
try
@@ -2651,7 +2651,7 @@ void SbRtl_Dir(StarBASIC *, SbxArray & rPar, bool)
}
if( hasUno() )
{
- uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+ const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
if( xSFI.is() )
{
if ( nParCount >= 2 )
@@ -2946,7 +2946,7 @@ void SbRtl_GetAttr(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
if( hasUno() )
{
- uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+ const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
if( xSFI.is() )
{
try
@@ -3025,7 +3025,7 @@ void SbRtl_FileDateTime(StarBASIC *, SbxArray & rPar, bool)
Date aDate( Date::EMPTY );
if( hasUno() )
{
- uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+ const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
if( xSFI.is() )
{
try
@@ -4319,7 +4319,7 @@ void SbRtl_SavePicture(StarBASIC *, SbxArray & rPar, bool)
if (SbStdPicture *pPicture = dynamic_cast<SbStdPicture*>(pObj))
{
SvFileStream aOStream( rPar.Get(2)->GetOUString(), StreamMode::WRITE | StreamMode::TRUNC );
- Graphic aGraphic = pPicture->GetGraphic();
+ const Graphic& aGraphic = pPicture->GetGraphic();
WriteGraphic( aOStream, aGraphic );
}
}
@@ -4467,7 +4467,7 @@ void SbRtl_SetAttr(StarBASIC *, SbxArray & rPar, bool)
if( hasUno() )
{
- uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+ const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
if( xSFI.is() )
{
try
@@ -4538,7 +4538,7 @@ void SbRtl_FileExists(StarBASIC *, SbxArray & rPar, bool)
if( hasUno() )
{
- uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
+ const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
if( xSFI.is() )
{
try
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 92cd189ca587..0c89f9125d86 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1671,7 +1671,7 @@ void SbRtl_MonthName(StarBASIC *, SbxArray & rPar, bool)
return;
}
- Reference< XCalendar4 > xCalendar = getLocaleCalendar();
+ const Reference< XCalendar4 >& xCalendar = getLocaleCalendar();
if( !xCalendar.is() )
{
StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR );
@@ -1708,7 +1708,7 @@ void SbRtl_WeekdayName(StarBASIC *, SbxArray & rPar, bool)
return;
}
- Reference< XCalendar4 > xCalendar = getLocaleCalendar();
+ const Reference< XCalendar4 >& xCalendar = getLocaleCalendar();
if( !xCalendar.is() )
{
StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR );
@@ -2042,7 +2042,7 @@ void SbRtl_DateDiff(StarBASIC *, SbxArray & rPar, bool)
}
if( nFirstDay == 0 )
{
- Reference< XCalendar4 > xCalendar = getLocaleCalendar();
+ const Reference< XCalendar4 >& xCalendar = getLocaleCalendar();
if( !xCalendar.is() )
{
StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR );
@@ -2292,7 +2292,7 @@ void SbRtl_FormatDateTime(StarBASIC *, SbxArray & rPar, bool)
}
}
- Reference< XCalendar4 > xCalendar = getLocaleCalendar();
+ const Reference< XCalendar4 >& xCalendar = getLocaleCalendar();
if( !xCalendar.is() )
{
StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR );
@@ -3053,7 +3053,7 @@ sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam, sal_Int16 nFirstDay
}
if( nFirstDay == 0 )
{
- Reference< XCalendar4 > xCalendar = getLocaleCalendar();
+ const Reference< XCalendar4 >& xCalendar = getLocaleCalendar();
if( !xCalendar.is() )
{
#if HAVE_FEATURE_SCRIPTING
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index e2c1e2ef7920..7d881967c6df 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -3155,7 +3155,7 @@ bool SbiRuntime::implIsClass( SbxObject const * pObj, const OUString& aClass )
bRet = aClass.equalsIgnoreAsciiCase( "object" );
if( !bRet )
{
- OUString aObjClass = pObj->GetClassName();
+ const OUString& aObjClass = pObj->GetClassName();
SbModule* pClassMod = GetSbData()->pClassFac->FindClass( aObjClass );
if( pClassMod && pClassMod->pClassData )
{