From 24c709655e5c1ca51c6c6da7ef0cb733354f6d20 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 26 May 2022 09:30:35 +0200 Subject: clang-tidy modernize-pass-by-value in comphelper Change-Id: I29074d801eaef57f160ce14b943b21831b327ecf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134979 Tested-by: Jenkins Reviewed-by: Noel Grandin --- comphelper/source/container/container.cxx | 5 +++-- comphelper/source/container/enumhelper.cxx | 15 ++++++++------- comphelper/source/eventattachermgr/eventattachermgr.cxx | 13 +++++++------ comphelper/source/misc/backupfilehelper.cxx | 9 +++++---- comphelper/source/misc/instancelocker.cxx | 13 +++++++------ comphelper/source/misc/instancelocker.hxx | 6 +++--- comphelper/source/misc/interaction.cxx | 9 +++++---- comphelper/source/misc/mimeconfighelper.cxx | 5 +++-- comphelper/source/misc/officerestartmanager.hxx | 5 +++-- comphelper/source/misc/stillreadwriteinteraction.cxx | 5 +++-- comphelper/source/misc/string.cxx | 3 ++- comphelper/source/misc/threadpool.cxx | 5 +++-- .../officeinstdir/officeinstallationdirectories.cxx | 5 +++-- .../officeinstdir/officeinstallationdirectories.hxx | 2 +- comphelper/source/property/propertycontainerhelper.cxx | 3 ++- comphelper/source/property/propertysethelper.cxx | 5 +++-- comphelper/source/streaming/seekableinput.cxx | 9 +++++---- 17 files changed, 66 insertions(+), 51 deletions(-) (limited to 'comphelper') diff --git a/comphelper/source/container/container.cxx b/comphelper/source/container/container.cxx index 1a6132e0d65a..7b2432723360 100644 --- a/comphelper/source/container/container.cxx +++ b/comphelper/source/container/container.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -29,8 +30,8 @@ namespace comphelper { -IndexAccessIterator::IndexAccessIterator(css::uno::Reference< css::uno::XInterface> const & xStartingPoint) - :m_xStartingPoint(xStartingPoint) +IndexAccessIterator::IndexAccessIterator(css::uno::Reference< css::uno::XInterface> xStartingPoint) + :m_xStartingPoint(std::move(xStartingPoint)) { OSL_ENSURE(m_xStartingPoint.is(), "IndexAccessIterator::IndexAccessIterator : no starting point !"); } diff --git a/comphelper/source/container/enumhelper.cxx b/comphelper/source/container/enumhelper.cxx index b5fe864c8820..bc9ae43e44ad 100644 --- a/comphelper/source/container/enumhelper.cxx +++ b/comphelper/source/container/enumhelper.cxx @@ -21,13 +21,14 @@ #include #include #include +#include namespace comphelper { -OEnumerationByName::OEnumerationByName(const css::uno::Reference& _rxAccess) - :m_aNames(_rxAccess->getElementNames()) - ,m_xAccess(_rxAccess) +OEnumerationByName::OEnumerationByName(css::uno::Reference _xAccess) + :m_aNames(_xAccess->getElementNames()) + ,m_xAccess(_xAccess) ,m_nPos(0) ,m_bListening(false) { @@ -35,10 +36,10 @@ OEnumerationByName::OEnumerationByName(const css::uno::Reference& _rxAccess, +OEnumerationByName::OEnumerationByName(const css::uno::Reference _xAccess, std::vector _aNames ) :m_aNames(std::move(_aNames)) - ,m_xAccess(_rxAccess) + ,m_xAccess(std::move(_xAccess)) ,m_nPos(0) ,m_bListening(false) { @@ -147,8 +148,8 @@ const OUString& OEnumerationByName::getElement(sal_Int32 nIndex) const } -OEnumerationByIndex::OEnumerationByIndex(const css::uno::Reference< css::container::XIndexAccess >& _rxAccess) - :m_xAccess(_rxAccess) +OEnumerationByIndex::OEnumerationByIndex(css::uno::Reference< css::container::XIndexAccess > _xAccess) + :m_xAccess(std::move(_xAccess)) ,m_nPos(0) ,m_bListening(false) { diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx index a08c6cf4777a..1c9f1a23cdc6 100644 --- a/comphelper/source/eventattachermgr/eventattachermgr.cxx +++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx @@ -49,6 +49,7 @@ #include #include +#include using namespace com::sun::star::uno; using namespace com::sun::star::io; @@ -140,8 +141,8 @@ class AttacherAllListener_Impl : public WeakImplHelper< XAllListener > /// @throws CannotConvertException void convertToEventReturn( Any & rRet, const Type & rRetType ); public: - AttacherAllListener_Impl( ImplEventAttacherManager* pManager_, const OUString &rScriptType_, - const OUString & rScriptCode_ ); + AttacherAllListener_Impl( ImplEventAttacherManager* pManager_, OUString aScriptType_, + OUString aScriptCode_ ); // Methods of XAllListener virtual void SAL_CALL firing(const AllEventObject& Event) override; @@ -156,12 +157,12 @@ public: AttacherAllListener_Impl::AttacherAllListener_Impl ( ImplEventAttacherManager* pManager_, - const OUString & rScriptType_, - const OUString & rScriptCode_ + OUString aScriptType_, + OUString aScriptCode_ ) : mxManager( pManager_ ) - , aScriptType( rScriptType_ ) - , aScriptCode( rScriptCode_ ) + , aScriptType(std::move( aScriptType_ )) + , aScriptCode(std::move( aScriptCode_ )) { } diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index 22bd5c5a851f..d225b9f301d9 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -221,8 +222,8 @@ namespace { } - ExtensionInfoEntry(const OString& rName, bool bEnabled) - : maName(rName), + ExtensionInfoEntry(OString aName, bool bEnabled) + : maName(std::move(aName)), maRepository(USER), mbEnabled(bEnabled) { @@ -995,13 +996,13 @@ namespace PackedFileEntry( sal_uInt32 nFullFileSize, sal_uInt32 nCrc32, - FileSharedPtr const & rFile, + FileSharedPtr xFile, bool bDoCompress) : mnFullFileSize(nFullFileSize), mnPackFileSize(nFullFileSize), mnOffset(0), mnCrc32(nCrc32), - maFile(rFile), + maFile(std::move(xFile)), mbDoCompress(bDoCompress) { } diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx index 2b1e89604e6a..84c8054ecbb8 100644 --- a/comphelper/source/misc/instancelocker.cxx +++ b/comphelper/source/misc/instancelocker.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include "instancelocker.hxx" @@ -188,13 +189,13 @@ uno::Sequence< OUString > SAL_CALL OInstanceLocker::getSupportedServiceNames() // OLockListener -OLockListener::OLockListener( const uno::WeakReference< lang::XComponent >& xWrapper, - const uno::Reference< uno::XInterface >& xInstance, +OLockListener::OLockListener( uno::WeakReference< lang::XComponent > xWrapper, + uno::Reference< uno::XInterface > xInstance, sal_Int32 nMode, - const uno::Reference< embed::XActionsApproval >& rApproval ) -: m_xInstance( xInstance ) -, m_xApproval( rApproval ) -, m_xWrapper( xWrapper ) + uno::Reference< embed::XActionsApproval > xApproval ) +: m_xInstance(std::move( xInstance )) +, m_xApproval(std::move( xApproval )) +, m_xWrapper(std::move( xWrapper )) , m_bDisposed( false ) , m_bInitialized( false ) , m_nMode( nMode ) diff --git a/comphelper/source/misc/instancelocker.hxx b/comphelper/source/misc/instancelocker.hxx index 7391c5d7d365..6a050c7f437c 100644 --- a/comphelper/source/misc/instancelocker.hxx +++ b/comphelper/source/misc/instancelocker.hxx @@ -85,10 +85,10 @@ class OLockListener : public ::cppu::WeakImplHelper< css::util::XCloseListener, sal_Int32 m_nMode; public: - OLockListener( const css::uno::WeakReference< css::lang::XComponent >& xWrapper, - const css::uno::Reference< css::uno::XInterface >& xInstance, + OLockListener( css::uno::WeakReference< css::lang::XComponent > xWrapper, + css::uno::Reference< css::uno::XInterface > xInstance, sal_Int32 nMode, - const css::uno::Reference< css::embed::XActionsApproval >& rApproval ); + css::uno::Reference< css::embed::XActionsApproval > xApproval ); virtual ~OLockListener() override; diff --git a/comphelper/source/misc/interaction.cxx b/comphelper/source/misc/interaction.cxx index e1fd64d9b04b..9e7b1706d111 100644 --- a/comphelper/source/misc/interaction.cxx +++ b/comphelper/source/misc/interaction.cxx @@ -20,6 +20,7 @@ #include #include +#include #include @@ -30,14 +31,14 @@ namespace comphelper using namespace ::com::sun::star::uno; using namespace ::com::sun::star::task; - OInteractionRequest::OInteractionRequest(const Any& _rRequestDescription) - :m_aRequest(_rRequestDescription) + OInteractionRequest::OInteractionRequest(Any _aRequestDescription) + :m_aRequest(std::move(_aRequestDescription)) { } - OInteractionRequest::OInteractionRequest(const Any& rRequestDescription, + OInteractionRequest::OInteractionRequest(Any aRequestDescription, std::vector>&& rContinuations) - : m_aRequest(rRequestDescription) + : m_aRequest(std::move(aRequestDescription)) , m_aContinuations(std::move(rContinuations)) { } diff --git a/comphelper/source/misc/mimeconfighelper.cxx b/comphelper/source/misc/mimeconfighelper.cxx index 3b234b6591ae..7f402b6351ec 100644 --- a/comphelper/source/misc/mimeconfighelper.cxx +++ b/comphelper/source/misc/mimeconfighelper.cxx @@ -33,14 +33,15 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace comphelper; -MimeConfigurationHelper::MimeConfigurationHelper( const uno::Reference< uno::XComponentContext >& rxContext ) -: m_xContext( rxContext ) +MimeConfigurationHelper::MimeConfigurationHelper( uno::Reference< uno::XComponentContext > xContext ) +: m_xContext(std::move( xContext )) { if ( !m_xContext.is() ) throw uno::RuntimeException(); diff --git a/comphelper/source/misc/officerestartmanager.hxx b/comphelper/source/misc/officerestartmanager.hxx index 8b3658a8e892..bc95668b9399 100644 --- a/comphelper/source/misc/officerestartmanager.hxx +++ b/comphelper/source/misc/officerestartmanager.hxx @@ -26,6 +26,7 @@ #include #include +#include namespace comphelper { @@ -41,8 +42,8 @@ class OOfficeRestartManager : public ::cppu::WeakImplHelper< css::task::XRestart bool m_bRestartRequested; public: - explicit OOfficeRestartManager( const css::uno::Reference< css::uno::XComponentContext >& xContext ) - : m_xContext( xContext ) + explicit OOfficeRestartManager( css::uno::Reference< css::uno::XComponentContext > xContext ) + : m_xContext(std::move( xContext )) , m_bOfficeInitialized( false ) , m_bRestartRequested( false ) {} diff --git a/comphelper/source/misc/stillreadwriteinteraction.cxx b/comphelper/source/misc/stillreadwriteinteraction.cxx index 7bf48b2d97b2..88bc25bc46cb 100644 --- a/comphelper/source/misc/stillreadwriteinteraction.cxx +++ b/comphelper/source/misc/stillreadwriteinteraction.cxx @@ -30,14 +30,15 @@ #include #include +#include namespace comphelper{ StillReadWriteInteraction::StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler, - const css::uno::Reference< css::task::XInteractionHandler >& xAuxiliaryHandler) + css::uno::Reference< css::task::XInteractionHandler > xAuxiliaryHandler) : m_bUsed (false) , m_bHandledByMySelf (false) - , m_xAuxiliaryHandler(xAuxiliaryHandler) + , m_xAuxiliaryHandler(std::move(xAuxiliaryHandler)) { std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest > lInterceptions; lInterceptions.reserve(4); diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index 0041f53d153d..979964f17552 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -495,7 +496,7 @@ sal_Int32 compareNatural( const OUString & rLHS, const OUString & rRHS, NaturalStringSorter::NaturalStringSorter( const uno::Reference< uno::XComponentContext > &rContext, - const lang::Locale &rLocale) : m_aLocale(rLocale) + lang::Locale aLocale) : m_aLocale(std::move(aLocale)) { m_xCollator = i18n::Collator::create( rContext ); m_xCollator->loadDefaultCollator(m_aLocale, 0); diff --git a/comphelper/source/misc/threadpool.cxx b/comphelper/source/misc/threadpool.cxx index 48ff4af2d7c6..00fee7d8eb59 100644 --- a/comphelper/source/misc/threadpool.cxx +++ b/comphelper/source/misc/threadpool.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #if defined HAVE_VALGRIND_HEADERS #include @@ -304,8 +305,8 @@ bool ThreadPool::isTaskTagDone(const std::shared_ptr& pTag) return pTag->isDone(); } -ThreadTask::ThreadTask(const std::shared_ptr& pTag) - : mpTag(pTag) +ThreadTask::ThreadTask(std::shared_ptr xTag) + : mpTag(std::move(xTag)) { } diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx index fb0359a748f7..4cb3eb5e3702 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include "officeinstallationdirectories.hxx" @@ -78,8 +79,8 @@ constexpr OUStringLiteral g_aOfficeBrandDirMacro(u"$(brandbaseurl)"); constexpr OUStringLiteral g_aUserDirMacro(u"$(userdataurl)"); OfficeInstallationDirectories::OfficeInstallationDirectories( - const uno::Reference< uno::XComponentContext > & xCtx ) -: m_xCtx( xCtx ) + uno::Reference< uno::XComponentContext > xCtx ) +: m_xCtx(std::move( xCtx )) { } diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx index f3546831f408..cc0881c236fd 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx @@ -41,7 +41,7 @@ class OfficeInstallationDirectories : public cppu::BaseMutex, public UnoImplBase { public: explicit OfficeInstallationDirectories( - const css::uno::Reference< css::uno::XComponentContext > & xCtx ); + css::uno::Reference< css::uno::XComponentContext > xCtx ); virtual ~OfficeInstallationDirectories() override; // XOfficeInstallationDirectories diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx index 5fd6053ce100..7ff224bec741 100644 --- a/comphelper/source/property/propertycontainerhelper.cxx +++ b/comphelper/source/property/propertycontainerhelper.cxx @@ -26,6 +26,7 @@ #include #include +#include namespace comphelper @@ -51,7 +52,7 @@ namespace struct PropertyDescriptionNameMatch { OUString const m_rCompare; - explicit PropertyDescriptionNameMatch( const OUString& _rCompare ) : m_rCompare( _rCompare ) { } + explicit PropertyDescriptionNameMatch( OUString _aCompare ) : m_rCompare(std::move( _aCompare )) { } bool operator() (const PropertyDescription& x ) const { diff --git a/comphelper/source/property/propertysethelper.cxx b/comphelper/source/property/propertysethelper.cxx index 1568aca9b49d..519b0705fadd 100644 --- a/comphelper/source/property/propertysethelper.cxx +++ b/comphelper/source/property/propertysethelper.cxx @@ -23,6 +23,7 @@ #include #include +#include using namespace ::comphelper; using namespace ::com::sun::star; @@ -41,8 +42,8 @@ static PropertyMapEntry const * find( const rtl::Reference& mxI } -PropertySetHelper::PropertySetHelper( rtl::Reference const & xInfo ) noexcept - : mxInfo(xInfo) +PropertySetHelper::PropertySetHelper( rtl::Reference xInfo ) noexcept + : mxInfo(std::move(xInfo)) { } diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx index bd30aa354620..3508f933ee26 100644 --- a/comphelper/source/streaming/seekableinput.cxx +++ b/comphelper/source/streaming/seekableinput.cxx @@ -26,6 +26,7 @@ #include +#include using namespace ::com::sun::star; @@ -57,10 +58,10 @@ static void copyInputToOutput_Impl( const uno::Reference< io::XInputStream >& xI OSeekableInputWrapper::OSeekableInputWrapper( - const uno::Reference< io::XInputStream >& xInStream, - const uno::Reference< uno::XComponentContext >& rxContext ) -: m_xContext( rxContext ) -, m_xOriginalStream( xInStream ) + uno::Reference< io::XInputStream > xInStream, + uno::Reference< uno::XComponentContext > xContext ) +: m_xContext(std::move( xContext )) +, m_xOriginalStream(std::move( xInStream )) { if ( !m_xContext.is() ) throw uno::RuntimeException(); -- cgit