From f59d4e4e3e41326b6bb4d0175fb9ad812012f92d Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 11 Nov 2024 11:14:06 +0200 Subject: [PATCH] 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 --- basctl/source/basicide/baside3.cxx | 10 +++++----- basctl/source/basicide/iderdll.cxx | 2 +- basctl/source/basicide/localizationmgr.cxx | 10 ++++------ 3 files changed, 10 insertions(+), 12 deletions(-) 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 )