From ebb636473f6813a151dda07e4c2ae0960e684b2b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 11 Oct 2021 13:53:51 +0200 Subject: [PATCH] loplugin:moveparam in desktop Change-Id: Ie96a3887876bf9a0bb13ae4a69d1685186a4e9b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123384 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../source/deployment/gui/dp_gui_dialog2.cxx | 4 ++-- .../gui/dp_gui_extensioncmdqueue.cxx | 22 +++++++++---------- .../gui/dp_gui_extensioncmdqueue.hxx | 3 +-- .../deployment/gui/dp_gui_theextmgr.cxx | 2 +- .../deployment/gui/dp_gui_updatedialog.cxx | 10 ++++----- .../deployment/gui/dp_gui_updatedialog.hxx | 3 +-- desktop/source/migration/migration.cxx | 12 ++++------ 7 files changed, 25 insertions(+), 31 deletions(-) diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 9e700ff46a93..6d318726bb9f 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -595,7 +595,7 @@ void ExtMgrDialog::updatePackage( const uno::Reference< deployment::XPackage > & std::vector< css::uno::Reference< css::deployment::XPackage > > vEntries; vEntries.push_back(extension); - m_pManager->getCmdQueue()->checkForUpdates( vEntries ); + m_pManager->getCmdQueue()->checkForUpdates( std::move(vEntries) ); } @@ -1160,7 +1160,7 @@ IMPL_LINK_NOARG(UpdateRequiredDialog, HandleUpdateBtn, weld::Button&, void) aGuard.clear(); - m_pManager->getCmdQueue()->checkForUpdates( vUpdateEntries ); + m_pManager->getCmdQueue()->checkForUpdates( std::move(vUpdateEntries) ); } diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 80d682d7a855..863e6811c32d 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -184,10 +184,10 @@ struct ExtensionCmd m_bWarnUser( false ), m_xPackage( rPackage ) {}; ExtensionCmd( const E_CMD_TYPE eCommand, - const std::vector > &vExtensionList ) + std::vector >&&vExtensionList ) : m_eCmdType( eCommand ), m_bWarnUser( false ), - m_vExtensionList( vExtensionList ) {}; + m_vExtensionList( std::move(vExtensionList) ) {}; }; } @@ -208,7 +208,7 @@ public: void removeExtension( const uno::Reference< deployment::XPackage > &rPackage ); void enableExtension( const uno::Reference< deployment::XPackage > &rPackage, const bool bEnable ); - void checkForUpdates( const std::vector > &vExtensionList ); + void checkForUpdates( std::vector > && vExtensionList ); void acceptLicense( const uno::Reference< deployment::XPackage > &rPackage ); void stop(); bool isBusy(); @@ -230,7 +230,7 @@ private: const uno::Reference< deployment::XPackage > &xPackage ); void _disableExtension( ::rtl::Reference< ProgressCmdEnv > const &rCmdEnv, const uno::Reference< deployment::XPackage > &xPackage ); - void _checkForUpdates( const std::vector > &vExtensionList ); + void _checkForUpdates( std::vector > &&vExtensionList ); void _acceptLicense( ::rtl::Reference< ProgressCmdEnv > const &rCmdEnv, const uno::Reference< deployment::XPackage > &xPackage ); @@ -645,9 +645,9 @@ void ExtensionCmdQueue::Thread::enableExtension( const uno::Reference< deploymen void ExtensionCmdQueue::Thread::checkForUpdates( - const std::vector > &vExtensionList ) + std::vector > && vExtensionList ) { - TExtensionCmd pEntry = std::make_shared( ExtensionCmd::CHECK_FOR_UPDATES, vExtensionList ); + TExtensionCmd pEntry = std::make_shared( ExtensionCmd::CHECK_FOR_UPDATES, std::move(vExtensionList) ); _insert( pEntry ); } @@ -753,7 +753,7 @@ void ExtensionCmdQueue::Thread::execute() _disableExtension( currentCmdEnv, pEntry->m_xPackage ); break; case ExtensionCmd::CHECK_FOR_UPDATES : - _checkForUpdates( pEntry->m_vExtensionList ); + _checkForUpdates( std::vector(pEntry->m_vExtensionList) ); break; case ExtensionCmd::ACCEPT_LICENSE : _acceptLicense( currentCmdEnv, pEntry->m_xPackage ); @@ -913,7 +913,7 @@ void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdE void ExtensionCmdQueue::Thread::_checkForUpdates( - const std::vector > &vExtensionList ) + std::vector > && vExtensionList ) { const SolarMutexGuard guard; @@ -921,7 +921,7 @@ void ExtensionCmdQueue::Thread::_checkForUpdates( m_pDialogHelper->incBusy(); std::vector< UpdateData > vData; - UpdateDialog aUpdateDialog(m_xContext, m_pDialogHelper ? m_pDialogHelper->getFrameWeld() : nullptr, vExtensionList, &vData); + UpdateDialog aUpdateDialog(m_xContext, m_pDialogHelper ? m_pDialogHelper->getFrameWeld() : nullptr, std::move(vExtensionList), &vData); aUpdateDialog.notifyMenubar( true, false ); // prepare the checking, if there updates to be notified via menu bar icon @@ -1085,9 +1085,9 @@ void ExtensionCmdQueue::enableExtension( const uno::Reference< deployment::XPack m_thread->enableExtension( rPackage, bEnable ); } -void ExtensionCmdQueue::checkForUpdates( const std::vector > &vExtensionList ) +void ExtensionCmdQueue::checkForUpdates( std::vector > && vExtensionList ) { - m_thread->checkForUpdates( vExtensionList ); + m_thread->checkForUpdates( std::move(vExtensionList) ); } void ExtensionCmdQueue::acceptLicense( const uno::Reference< deployment::XPackage > &rPackage ) diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx index debc37db9123..c88e1223f357 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx @@ -72,8 +72,7 @@ public: void removeExtension( const css::uno::Reference< css::deployment::XPackage > &rPackage ); void enableExtension( const css::uno::Reference< css::deployment::XPackage > &rPackage, const bool bEnable ); - void checkForUpdates(const std::vector< css::uno::Reference< - css::deployment::XPackage > > &vList ); + void checkForUpdates( std::vector< css::uno::Reference< css::deployment::XPackage > > && vList ); void acceptLicense( const css::uno::Reference< css::deployment::XPackage > &rPackage ); static void syncRepositories( const css::uno::Reference< css::uno::XComponentContext > & xContext ); /** diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 8e7efa8cc0d6..6d39433a8f27 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -230,7 +230,7 @@ void TheExtensionManager::checkUpdates() } } - m_xExecuteCmdQueue->checkForUpdates( vEntries ); + m_xExecuteCmdQueue->checkForUpdates( std::move(vEntries) ); } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 719df5b0d9ba..00523112f88b 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -147,7 +147,7 @@ public: Thread( uno::Reference< uno::XComponentContext > const & context, UpdateDialog & dialog, - const std::vector< uno::Reference< deployment::XPackage > > & vExtensionList); + std::vector< uno::Reference< deployment::XPackage > > && vExtensionList); void stop(); @@ -185,11 +185,11 @@ private: UpdateDialog::Thread::Thread( uno::Reference< uno::XComponentContext > const & context, UpdateDialog & dialog, - const std::vector< uno::Reference< deployment::XPackage > > &vExtensionList): + std::vector< uno::Reference< deployment::XPackage > >&& vExtensionList): salhelper::Thread("dp_gui_updatedialog"), m_context(context), m_dialog(dialog), - m_vExtensionList(vExtensionList), + m_vExtensionList(std::move(vExtensionList)), m_updateInformation( deployment::UpdateInformationProvider::create(context)), m_stop(false) @@ -418,7 +418,7 @@ bool UpdateDialog::Thread::update( // UpdateDialog ---------------------------------------------------------- UpdateDialog::UpdateDialog( uno::Reference< uno::XComponentContext > const & context, - weld::Window * parent, const std::vector > &vExtensionList, + weld::Window * parent, std::vector > && vExtensionList, std::vector< dp_gui::UpdateData > * updateData) : GenericDialogController(parent, "desktop/ui/updatedialog.ui", "UpdateDialog") , m_context(context) @@ -434,7 +434,7 @@ UpdateDialog::UpdateDialog( , m_version(DpResId(RID_DLG_UPDATE_VERSION)) , m_ignoredUpdate(DpResId(RID_DLG_UPDATE_IGNORED_UPDATE)) , m_updateData(*updateData) - , m_thread(new UpdateDialog::Thread(context, *this, vExtensionList)) + , m_thread(new UpdateDialog::Thread(context, *this, std::move(vExtensionList))) , m_xChecking(m_xBuilder->weld_label("UPDATE_CHECKING")) , m_xThrobber(m_xBuilder->weld_spinner("THROBBER")) , m_xUpdate(m_xBuilder->weld_label("UPDATE_LABEL")) diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx index 04aeec8dab43..24728467debb 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx @@ -71,8 +71,7 @@ public: UpdateDialog( css::uno::Reference< css::uno::XComponentContext > const & context, weld::Window * parent, - const std::vector< css::uno::Reference< - css::deployment::XPackage > > & vExtensionList, + std::vector< css::uno::Reference< css::deployment::XPackage > > && vExtensionList, std::vector< dp_gui::UpdateData > * updateData); virtual ~UpdateDialog() override; diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index d1725fd8673d..d920cb40ff3f 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -562,12 +562,10 @@ namespace { // removes elements of vector 2 in vector 1 -strings_v subtract(strings_v const & va, strings_v const & vb) +strings_v subtract(strings_v && a, strings_v && b) { - strings_v a(va); std::sort(a.begin(), a.end()); strings_v::iterator ae(std::unique(a.begin(), a.end())); - strings_v b(vb); std::sort(b.begin(), b.end()); strings_v::iterator be(std::unique(b.begin(), b.end())); strings_v c; @@ -581,8 +579,6 @@ strings_vr MigrationImpl::compileFileList() { strings_vr vrResult(new strings_v); - strings_vr vrInclude; - strings_vr vrExclude; // get a list of all files: strings_vr vrFiles = getAllFiles(m_aInfo.userdata); @@ -590,9 +586,9 @@ strings_vr MigrationImpl::compileFileList() // get a file list result for each migration step for (auto const& rMigration : *m_vrMigrations) { - vrInclude = applyPatterns(*vrFiles, rMigration.includeFiles); - vrExclude = applyPatterns(*vrFiles, rMigration.excludeFiles); - strings_v sub(subtract(*vrInclude, *vrExclude)); + strings_vr vrInclude = applyPatterns(*vrFiles, rMigration.includeFiles); + strings_vr vrExclude = applyPatterns(*vrFiles, rMigration.excludeFiles); + strings_v sub(subtract(std::move(*vrInclude), std::move(*vrExclude))); vrResult->insert(vrResult->end(), sub.begin(), sub.end()); } return vrResult;