include/svl/sharecontrolfile.hxx                   |    2 +-
 svl/source/misc/sharecontrolfile.cxx               |    9 +++++----
 svl/source/passwordcontainer/passwordcontainer.cxx |    2 +-
 svl/source/passwordcontainer/passwordcontainer.hxx |   10 +++++-----
 4 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit d035f86de21f9508bc5ea0f35071873c0fd4c8c8
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Sun Oct 10 16:57:19 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Oct 10 18:24:35 2021 +0200

    loplugin:moveparam in svl
    
    Change-Id: Icd45c7f693c866e7eafcf6aeb052a4d190dce38c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123337
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svl/sharecontrolfile.hxx b/include/svl/sharecontrolfile.hxx
index ddd29717a3d1..97c1c2e4729e 100644
--- a/include/svl/sharecontrolfile.hxx
+++ b/include/svl/sharecontrolfile.hxx
@@ -56,7 +56,7 @@ public:
     virtual ~ShareControlFile() override;
 
     std::vector< LockFileEntry > GetUsersData();
-    void SetUsersDataAndStore( const std::vector< LockFileEntry >& aUserNames 
);
+    void SetUsersDataAndStore( std::vector< LockFileEntry >&& aUserNames );
     LockFileEntry InsertOwnEntry();
     bool HasOwnEntry();
     void RemoveEntry( const LockFileEntry& aOptionalSpecification );
diff --git a/svl/source/misc/sharecontrolfile.cxx 
b/svl/source/misc/sharecontrolfile.cxx
index 0ddc3efddd25..a7bdf7af85f6 100644
--- a/svl/source/misc/sharecontrolfile.cxx
+++ b/svl/source/misc/sharecontrolfile.cxx
@@ -174,7 +174,7 @@ std::vector< o3tl::enumarray< LockFileComponent, OUString > 
> ShareControlFile::
 }
 
 
-void ShareControlFile::SetUsersDataAndStore( const std::vector< LockFileEntry 
>& aUsersData )
+void ShareControlFile::SetUsersDataAndStore( std::vector< LockFileEntry >&& 
aUsersData )
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
@@ -243,7 +243,7 @@ LockFileEntry ShareControlFile::InsertOwnEntry()
     if ( !bExists )
         aNewData.push_back( aNewEntry );
 
-    SetUsersDataAndStore( aNewData );
+    SetUsersDataAndStore( std::move(aNewData) );
 
     return aNewEntry;
 }
@@ -301,9 +301,10 @@ void ShareControlFile::RemoveEntry( const LockFileEntry& 
aEntry )
         }
     }
 
-    SetUsersDataAndStore( aNewData );
+    const bool bNewDataEmpty = aNewData.empty();
+    SetUsersDataAndStore( std::move(aNewData) );
 
-    if ( aNewData.empty() )
+    if ( bNewDataEmpty )
     {
         // try to remove the file if it is empty
         RemoveFile();
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx 
b/svl/source/passwordcontainer/passwordcontainer.cxx
index 749f4c226a60..cbe36add1bb2 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -607,7 +607,7 @@ void PasswordContainer::PrivateAdd( const OUString& Url, 
const OUString& UserNam
     if( Mode == PERSISTENT_RECORD )
         aRecord.SetPersistentPasswords( EncodePasswords( aStorePass, 
GetMasterPassword( aHandler ) ) );
     else if( Mode == MEMORY_RECORD )
-        aRecord.SetMemoryPasswords( aStorePass );
+        aRecord.SetMemoryPasswords( std::move(aStorePass) );
     else
     {
         OSL_FAIL( "Unexpected persistence status!" );
diff --git a/svl/source/passwordcontainer/passwordcontainer.hxx 
b/svl/source/passwordcontainer/passwordcontainer.hxx
index 2687298ea23c..8bafeaa2d6fc 100644
--- a/svl/source/passwordcontainer/passwordcontainer.hxx
+++ b/svl/source/passwordcontainer/passwordcontainer.hxx
@@ -54,7 +54,7 @@ class NamePasswordRecord
     bool                        m_bHasPersistentPassword;
     OUString                    m_aPersistentPassword;
 
-    void InitArrays( bool bHasMemoryList, const ::std::vector< OUString >& 
aMemoryList,
+    void InitArrays( bool bHasMemoryList, ::std::vector< OUString >&& 
aMemoryList,
                      bool bHasPersistentList, const OUString& aPersistentList )
     {
         m_bHasMemoryPasswords = bHasMemoryList;
@@ -88,7 +88,7 @@ public:
         , m_bHasMemoryPasswords( false )
         , m_bHasPersistentPassword( false )
     {
-        InitArrays( aRecord.m_bHasMemoryPasswords, aRecord.m_aMemoryPasswords, 
aRecord.m_bHasPersistentPassword, aRecord.m_aPersistentPassword );
+        InitArrays( aRecord.m_bHasMemoryPasswords, 
std::vector(aRecord.m_aMemoryPasswords), aRecord.m_bHasPersistentPassword, 
aRecord.m_aPersistentPassword );
     }
 
     NamePasswordRecord& operator=( const NamePasswordRecord& aRecord )
@@ -99,7 +99,7 @@ public:
 
             m_aMemoryPasswords.clear();
             m_aPersistentPassword.clear();
-            InitArrays( aRecord.m_bHasMemoryPasswords, 
aRecord.m_aMemoryPasswords, aRecord.m_bHasPersistentPassword, 
aRecord.m_aPersistentPassword );
+            InitArrays( aRecord.m_bHasMemoryPasswords, 
std::vector(aRecord.m_aMemoryPasswords), aRecord.m_bHasPersistentPassword, 
aRecord.m_aPersistentPassword );
         }
         return *this;
     }
@@ -135,9 +135,9 @@ public:
         return OUString();
     }
 
-    void SetMemoryPasswords( const ::std::vector< OUString >& aMemList )
+    void SetMemoryPasswords( ::std::vector< OUString >&& aMemList )
     {
-        m_aMemoryPasswords = aMemList;
+        m_aMemoryPasswords = std::move(aMemList);
         m_bHasMemoryPasswords = true;
     }
 

Reply via email to