ucb/source/ucp/file/filtask.cxx |    9 +++++----
 ucb/source/ucp/file/filtask.hxx |   15 ++++-----------
 2 files changed, 9 insertions(+), 15 deletions(-)

New commits:
commit 86c95d195dfb1af7511cc0e70a93de9813284855
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon May 23 11:05:10 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon May 23 18:48:25 2022 +0200

    std::unordered_set->o3tl::sorted_vector in TaskManager
    
    avoids repeated allocation
    
    Change-Id: Ie3f380ab2f38314b9c8a51fdcd1985329254f5dc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134804
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx
index 122ad052618c..7c87f5652be7 100644
--- a/ucb/source/ucp/file/filtask.cxx
+++ b/ucb/source/ucp/file/filtask.cxx
@@ -539,7 +539,7 @@ TaskManager::associate( const OUString& aUnqPath,
                             beans::PropertyState_DEFAULT_VALUE,
                             Attributes );
 
-    TaskManager::PropertySet::iterator it1 = m_aDefaultProperties.find( 
newProperty );
+    auto it1 = m_aDefaultProperties.find( newProperty );
     if( it1 != m_aDefaultProperties.end() )
         throw beans::PropertyExistException( THROW_WHERE );
 
@@ -570,7 +570,7 @@ TaskManager::deassociate( const OUString& aUnqPath,
 {
     MyProperty oldProperty( PropertyName );
 
-    TaskManager::PropertySet::iterator it1 = m_aDefaultProperties.find( 
oldProperty );
+    auto it1 = m_aDefaultProperties.find( oldProperty );
     if( it1 != m_aDefaultProperties.end() )
         throw beans::NotRemoveableException( THROW_WHERE );
 
@@ -845,7 +845,7 @@ TaskManager::setv( const OUString& aUnqPath,
 
     TaskManager::ContentMap::iterator it = m_aContent.find( aUnqPath );
     PropertySet& properties = it->second.properties;
-    TaskManager::PropertySet::iterator it1;
+    TaskManager::PropertySet::const_iterator it1;
     uno::Any aAny;
 
     for( sal_Int32 i = 0; i < values.getLength(); ++i )
@@ -1934,6 +1934,7 @@ void TaskManager::insertDefaultProperties( const 
OUString& aUnqPath )
     PropertySet& properties = it->second.properties;
     bool ContentNotDefau = properties.find( ContentTProperty ) != 
properties.end();
 
+    properties.reserve(properties.size() + m_aDefaultProperties.size());
     for (auto const& defaultprop : m_aDefaultProperties)
     {
         if( !ContentNotDefau || defaultprop.getPropertyName() != ContentType )
@@ -2243,7 +2244,7 @@ void
 TaskManager::commit( const TaskManager::ContentMap::iterator& it,
                const osl::FileStatus& aFileStatus )
 {
-    TaskManager::PropertySet::iterator it1;
+    TaskManager::PropertySet::const_iterator it1;
 
     if( it->second.properties.empty() )
     {
diff --git a/ucb/source/ucp/file/filtask.hxx b/ucb/source/ucp/file/filtask.hxx
index 3fa4b85752ed..c7199159fb44 100644
--- a/ucb/source/ucp/file/filtask.hxx
+++ b/ucb/source/ucp/file/filtask.hxx
@@ -18,6 +18,7 @@
  */
 #pragma once
 
+#include <o3tl/sorted_vector.hxx>
 #include <osl/file.hxx>
 #include <rtl/ustring.hxx>
 
@@ -186,23 +187,15 @@ namespace fileaccess
             inline void setState( const css::beans::PropertyState& theState ) 
const;
         };
 
-        struct eMyProperty
+        struct MyPropertyLess
         {
             bool operator()( const MyProperty& rKey1, const MyProperty& rKey2 
) const
             {
-                return rKey1.getPropertyName() == rKey2.getPropertyName();
+                return rKey1.getPropertyName() < rKey2.getPropertyName();
             }
         };
 
-        struct hMyProperty
-        {
-            size_t operator()( const MyProperty& rName ) const
-            {
-                return rName.getPropertyName().hashCode();
-            }
-        };
-
-        typedef std::unordered_set< MyProperty,hMyProperty,eMyProperty > 
PropertySet;
+        typedef o3tl::sorted_vector< MyProperty, MyPropertyLess > PropertySet;
 
         class UnqPathData
         {

Reply via email to