From 40afc6f25a95fba8824b60d0ced265ff80e62a4b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 11 Nov 2024 11:15:50 +0200 Subject: [PATCH] clang-tidy: performance-unnecessary-copy-initialization in desktop Change-Id: I0e6ce8858fc058403020e2db863730f04cac70db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176392 Reviewed-by: Noel Grandin Tested-by: Jenkins --- desktop/source/deployment/manager/dp_manager.cxx | 2 +- desktop/source/deployment/registry/help/dp_help.cxx | 5 ++--- desktop/source/migration/migration.cxx | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 99996531af5e..0e22618e04dd 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -411,7 +411,7 @@ Reference PackageManagerImpl::create( // Initialize logger which will be used in ProgressLogImpl (created below) rtl::Bootstrap::expandMacros(logFile); comphelper::EventLogger logger(xComponentContext, "unopkg"); - const Reference xLogger(logger.getLogger()); + const Reference& xLogger(logger.getLogger()); Reference xLogFormatter(SimpleTextFormatter::create(xComponentContext)); Sequence < beans::NamedValue > aSeq2 { { u"Formatter"_ustr, Any(xLogFormatter) }, {u"FileURL"_ustr, Any(logFile)} }; Reference xFileHandler(css::logging::FileHandler::createWithSettings(xComponentContext, aSeq2)); diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 936875a886eb..68882e1cd254 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -450,9 +450,8 @@ void BackendImpl::implProcessHelp( std::unique_ptr pXhpFiles(new OUString[nXhpFileCount]); for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) { - OUString aXhpFile = aXhpFileVector[iXhp]; - OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL ); - pXhpFiles[iXhp] = aXhpRelFile; + const OUString& aXhpFile = aXhpFileVector[iXhp]; + pXhpFiles[iXhp] = aXhpFile.copy( nLenLangFolderURL ); } OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() ); diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 439265546ae7..da01086b7a17 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -922,7 +922,7 @@ std::vector< MigrationModuleInfo > MigrationImpl::detectUIChangesForAllModules() uno::Sequence< OUString > lNames = xModules->getElementNames(); sal_Int32 nLength = lNames.getLength(); for (sal_Int32 i=0; i xModule = xModules->openStorageElement(sModuleShortName, embed::ElementModes::READ); if (xModule.is()) { MigrationModuleInfo aModuleInfo;