basctl/source/basicide/baside3.cxx         |   10 +++++-----
 basctl/source/basicide/iderdll.cxx         |    2 +-
 basctl/source/basicide/localizationmgr.cxx |   10 ++++------
 basic/source/classes/sbunoobj.cxx          |    4 ++--
 basic/source/classes/sbxmod.cxx            |    4 ++--
 5 files changed, 14 insertions(+), 16 deletions(-)

New commits:
commit cc70c63f8f6277edc492700f4b33588591f6485b
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Nov 11 11:14:54 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Mon Nov 11 15:46:52 2024 +0100

    clang-tidy: performance-unnecessary-copy-initialization in basic
    
    Change-Id: I38bc2711bdec2bdaf998401083ff9b62a5595616
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176389
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/basic/source/classes/sbunoobj.cxx 
b/basic/source/classes/sbunoobj.cxx
index 5b1947b4f013..7f75e18bbe5b 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -1842,7 +1842,7 @@ static OUString Impl_DumpProperties(SbUnoObject& rUnoObj)
     Reference< XIntrospectionAccess > xAccess = 
rUnoObj.getIntrospectionAccess();
     if( !xAccess.is() )
     {
-        Reference< XInvocation > xInvok = rUnoObj.getInvocation();
+        const Reference< XInvocation >& xInvok = rUnoObj.getInvocation();
         if( xInvok.is() )
             xAccess = xInvok->getIntrospection();
     }
@@ -1916,7 +1916,7 @@ static OUString Impl_DumpMethods(SbUnoObject& rUnoObj)
     Reference< XIntrospectionAccess > xAccess = 
rUnoObj.getIntrospectionAccess();
     if( !xAccess.is() )
     {
-        Reference< XInvocation > xInvok = rUnoObj.getInvocation();
+        const Reference< XInvocation >& xInvok = rUnoObj.getInvocation();
         if( xInvok.is() )
             xAccess = xInvok->getIntrospection();
     }
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index a8ecb3a6df1a..6558050e1325 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -857,13 +857,13 @@ void SbModule::SetSource32( const OUString& r )
             sal_uInt16 nLine1 = aTok.GetLine();
             if( aTok.Next() == SYMBOL )
             {
-                OUString aName_( aTok.GetSym() );
+                const OUString& rName_( aTok.GetSym() );
                 SbxDataType t = aTok.GetType();
                 if( t == SbxVARIANT && eEndTok == ENDSUB )
                 {
                     t = SbxVOID;
                 }
-                pMeth = GetMethod( aName_, t );
+                pMeth = GetMethod( rName_, t );
                 pMeth->nLine1 = pMeth->nLine2 = nLine1;
                 // The method is for a start VALID
                 pMeth->bInvalid = false;
commit f59d4e4e3e41326b6bb4d0175fb9ad812012f92d
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Nov 11 11:14:06 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Mon Nov 11 15:46:42 2024 +0100

    clang-tidy: performance-unnecessary-copy-initialization in basctl
    
    Change-Id: Icc609ffded11c78c7052356a0ecc8b138a11f13e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176388
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/basctl/source/basicide/baside3.cxx 
b/basctl/source/basicide/baside3.cxx
index a4d845d0878c..2b2b12b9f0a2 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -801,10 +801,10 @@ bool implImportDialog(weld::Window* pWin, const 
ScriptDocument& rDocument, const
         Sequence< OUString > aPaths = xFP->getSelectedFiles();
 
         OUString aBasePath;
-        OUString aOUCurPath( aPaths[0] );
-        sal_Int32 iSlash = aOUCurPath.lastIndexOf( '/' );
+        const OUString& rOUCurPath( aPaths[0] );
+        sal_Int32 iSlash = rOUCurPath.lastIndexOf( '/' );
         if( iSlash != -1 )
-            aBasePath = aOUCurPath.copy( 0, iSlash + 1 );
+            aBasePath = rOUCurPath.copy( 0, iSlash + 1 );
 
         try
         {
@@ -816,8 +816,8 @@ bool implImportDialog(weld::Window* pWin, const 
ScriptDocument& rDocument, const
             Reference< XSimpleFileAccess3 > xSFI( 
SimpleFileAccess::create(xContext) );
 
             Reference< XInputStream > xInput;
-            if( xSFI->exists( aOUCurPath ) )
-                xInput = xSFI->openFileRead( aOUCurPath );
+            if( xSFI->exists( rOUCurPath ) )
+                xInput = xSFI->openFileRead( rOUCurPath );
 
             ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, 
rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() 
);
 
diff --git a/basctl/source/basicide/iderdll.cxx 
b/basctl/source/basicide/iderdll.cxx
index 2a3328475c84..6796cc640c46 100644
--- a/basctl/source/basicide/iderdll.cxx
+++ b/basctl/source/basicide/iderdll.cxx
@@ -177,7 +177,7 @@ IMPL_STATIC_LINK(ExtraData, GlobalBasicBreakHdl, StarBASIC 
*, pBasic, BasicDebug
             OSL_ENSURE( aDocument.isValid(), 
"basctl::ExtraData::GlobalBasicBreakHdl: no document for the basic manager!" );
             if ( aDocument.isValid() )
             {
-                OUString aOULibName( pBasic->GetName() );
+                const OUString& aOULibName( pBasic->GetName() );
                 Reference< script::XLibraryContainer > xModLibContainer = 
aDocument.getLibraryContainer( E_SCRIPTS );
                 if ( xModLibContainer.is() && xModLibContainer->hasByName( 
aOULibName ) )
                 {
diff --git a/basctl/source/basicide/localizationmgr.cxx 
b/basctl/source/basicide/localizationmgr.cxx
index 02ff357f40dd..e63d17eba387 100644
--- a/basctl/source/basicide/localizationmgr.cxx
+++ b/basctl/source/basicide/localizationmgr.cxx
@@ -387,7 +387,7 @@ sal_Int32 
LocalizationMgr::implHandleControlResourceProperties
                         sal_Int32 i;
                         for ( i = 0; i < nPropStringCount; ++i )
                         {
-                            OUString aPropStr = aPropStrings[i];
+                            const OUString& aPropStr = aPropStrings[i];
                             bool bEscAlreadyExisting = 
aPropStr.startsWith("&");
                             if( bEscAlreadyExisting )
                             {
@@ -417,7 +417,7 @@ sal_Int32 
LocalizationMgr::implHandleControlResourceProperties
 
                         for (sal_Int32 i = 0; i < nPropStringCount; ++i)
                         {
-                            OUString aIdStr = aPropStrings[i];
+                            const OUString& aIdStr = aPropStrings[i];
                             OUString aNewPropStr = aIdStr;
                             if( aIdStr.getLength() > 1 )
                             {
@@ -469,8 +469,7 @@ sal_Int32 
LocalizationMgr::implHandleControlResourceProperties
 
                         for (sal_Int32 i = 0; i < nPropStringCount; ++i)
                         {
-                            OUString aSourceIdStr = aPropStrings[i];
-                            OUString aPureSourceIdStr = aSourceIdStr.copy( 1 );
+                            OUString aPureSourceIdStr = aPropStrings[i].copy( 
1 );
 
                             sal_Int32 nUniqueId = 
xStringResourceManager->getUniqueNumericId();
                             OUString aPureIdStr = OUString::number( nUniqueId )
@@ -509,8 +508,7 @@ sal_Int32 
LocalizationMgr::implHandleControlResourceProperties
 
                         for (sal_Int32 i = 0; i < nPropStringCount; ++i)
                         {
-                            OUString aSourceIdStr = aPropStrings[i];
-                            OUString aPureSourceIdStr = aSourceIdStr.copy( 1 );
+                            OUString aPureSourceIdStr = aPropStrings[i].copy( 
1 );
 
                             sal_Int32 nUniqueId = 
xStringResourceManager->getUniqueNumericId();
                             OUString aPureIdStr = OUString::number( nUniqueId )

Reply via email to