[Libreoffice-commits] core.git: include/ucbhelper ucbhelper/source ucb/source

Julien Nabet serval2412 at yahoo.fr
Fri Nov 3 06:14:54 UTC 2017


 include/ucbhelper/providerhelper.hxx         |    4 +--
 ucb/source/core/providermap.hxx              |    4 +--
 ucb/source/ucp/cmis/children_provider.hxx    |    4 +--
 ucb/source/ucp/cmis/cmis_content.cxx         |    4 +--
 ucb/source/ucp/cmis/cmis_content.hxx         |    4 +--
 ucb/source/ucp/cmis/cmis_datasupplier.cxx    |    5 +---
 ucb/source/ucp/cmis/cmis_repo_content.cxx    |   19 ++++++++----------
 ucb/source/ucp/cmis/cmis_repo_content.hxx    |    2 -
 ucb/source/ucp/gio/gio_content.hxx           |    4 +--
 ucb/source/ucp/package/pkgcontent.hxx        |    4 +--
 ucb/source/ucp/tdoc/tdoc_content.hxx         |    2 -
 ucb/source/ucp/webdav-neon/webdavcontent.hxx |    2 -
 ucb/source/ucp/webdav/webdavcontent.hxx      |    2 -
 ucbhelper/source/client/proxydecider.cxx     |   28 +++++++--------------------
 14 files changed, 37 insertions(+), 51 deletions(-)

New commits:
commit b80403167935550a4dd97f31b79d2bdcb97e4e88
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Thu Nov 2 22:46:22 2017 +0100

    Replace lists by vector or deque in ucb/ucbhelper
    
    Change-Id: I9f72d7c8ab48f8dc2eec779db2f40531a33db6f9
    Reviewed-on: https://gerrit.libreoffice.org/44238
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/include/ucbhelper/providerhelper.hxx b/include/ucbhelper/providerhelper.hxx
index 894d6177b41b..8d3508784d10 100644
--- a/include/ucbhelper/providerhelper.hxx
+++ b/include/ucbhelper/providerhelper.hxx
@@ -20,7 +20,7 @@
 #ifndef INCLUDED_UCBHELPER_PROVIDERHELPER_HXX
 #define INCLUDED_UCBHELPER_PROVIDERHELPER_HXX
 
-#include <list>
+#include <vector>
 #include <memory>
 #include <com/sun/star/ucb/XContentProvider.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
@@ -45,7 +45,7 @@ namespace ucbhelper {
 
 class ContentImplHelper;
 typedef rtl::Reference< ContentImplHelper > ContentImplHelperRef;
-typedef std::list< ContentImplHelperRef > ContentRefList;
+typedef std::vector< ContentImplHelperRef > ContentRefList;
 
 /**
   * This is an abstract base class for implementations of the service
diff --git a/ucb/source/core/providermap.hxx b/ucb/source/core/providermap.hxx
index ba793aad9e73..c1b50e058820 100644
--- a/ucb/source/core/providermap.hxx
+++ b/ucb/source/core/providermap.hxx
@@ -20,7 +20,7 @@
 #ifndef INCLUDED_UCB_SOURCE_CORE_PROVIDERMAP_HXX
 #define INCLUDED_UCB_SOURCE_CORE_PROVIDERMAP_HXX
 
-#include <list>
+#include <deque>
 #include <com/sun/star/uno/Reference.h>
 #include <regexpmap.hxx>
 
@@ -56,7 +56,7 @@ ProviderListEntry_Impl::getResolvedProvider() const
 }
 
 
-typedef std::list< ProviderListEntry_Impl > ProviderList_Impl;
+typedef std::deque< ProviderListEntry_Impl > ProviderList_Impl;
 
 
 typedef ucb_impl::RegexpMap< ProviderList_Impl > ProviderMap_Impl;
diff --git a/ucb/source/ucp/cmis/children_provider.hxx b/ucb/source/ucp/cmis/children_provider.hxx
index 770c29e68d11..210522a5f916 100644
--- a/ucb/source/ucp/cmis/children_provider.hxx
+++ b/ucb/source/ucp/cmis/children_provider.hxx
@@ -9,7 +9,7 @@
 #ifndef INCLUDED_UCB_SOURCE_UCP_CMIS_CHILDREN_PROVIDER_HXX
 #define INCLUDED_UCB_SOURCE_UCP_CMIS_CHILDREN_PROVIDER_HXX
 
-#include <list>
+#include <vector>
 
 #include <com/sun/star/ucb/XContent.hpp>
 
@@ -20,7 +20,7 @@ namespace cmis
         public:
             virtual ~ChildrenProvider( ) { };
 
-            virtual std::list< css::uno::Reference< css::ucb::XContent > > getChildren( ) = 0;
+            virtual std::vector< css::uno::Reference< css::ucb::XContent > > getChildren( ) = 0;
     };
 }
 
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index da5f779631ec..db55e200b6e5 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -2033,9 +2033,9 @@ namespace cmis
         return uno::Sequence< ucb::ContentInfo >();
     }
 
-    list< uno::Reference< ucb::XContent > > Content::getChildren( )
+    std::vector< uno::Reference< ucb::XContent > > Content::getChildren( )
     {
-        list< uno::Reference< ucb::XContent > > results;
+        std::vector< uno::Reference< ucb::XContent > > results;
         SAL_INFO( "ucb.ucp.cmis", "Content::getChildren() " << m_sURL );
 
         libcmis::FolderPtr pFolder = boost::dynamic_pointer_cast< libcmis::Folder >( getObject( uno::Reference< ucb::XCommandEnvironment >() ) );
diff --git a/ucb/source/ucp/cmis/cmis_content.hxx b/ucb/source/ucp/cmis/cmis_content.hxx
index acd45e8d65b6..3a83cde97b06 100644
--- a/ucb/source/ucp/cmis/cmis_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_content.hxx
@@ -98,7 +98,7 @@ private:
 
 private:
     typedef rtl::Reference< Content > ContentRef;
-    typedef std::list< ContentRef > ContentRefList;
+    typedef std::vector< ContentRef > ContentRefList;
 
     /// @throws css::uno::Exception
     /// @throws libcmis::Exception
@@ -201,7 +201,7 @@ public:
     css::uno::Sequence< css::ucb::ContentInfo >
         queryCreatableContentsInfo( const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
 
-    virtual std::list< css::uno::Reference< css::ucb::XContent > > getChildren( ) override;
+    virtual std::vector< css::uno::Reference< css::ucb::XContent > > getChildren( ) override;
 
     /// @throws css::uno::RuntimeException
     /// @throws css::ucb::CommandFailedException
diff --git a/ucb/source/ucp/cmis/cmis_datasupplier.cxx b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
index a09bceace7b7..13133a2d27ad 100644
--- a/ucb/source/ucp/cmis/cmis_datasupplier.cxx
+++ b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
@@ -19,7 +19,6 @@
 #include "cmis_provider.hxx"
 
 using namespace com::sun::star;
-using namespace std;
 
 namespace cmis
 {
@@ -36,10 +35,10 @@ namespace cmis
         if ( mbCountFinal )
             return true;
 
-        list< uno::Reference< ucb::XContent > > aChildren = m_pChildrenProvider->getChildren( );
+        std::vector< uno::Reference< ucb::XContent > > aChildren = m_pChildrenProvider->getChildren( );
 
         // Loop over the results and filter them
-        for ( list< uno::Reference< ucb::XContent > >::iterator it = aChildren.begin();
+        for ( std::vector< uno::Reference< ucb::XContent > >::iterator it = aChildren.begin();
                 it != aChildren.end(); ++it )
         {
             OUString sContentType = ( *it )->getContentType( );
diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx b/ucb/source/ucp/cmis/cmis_repo_content.cxx
index d12cbdae8a27..ed87ad5f3323 100644
--- a/ucb/source/ucp/cmis/cmis_repo_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx
@@ -40,17 +40,16 @@
 #include "cmis_resultset.hxx"
 #include <memory>
 
-#define OUSTR_TO_STDSTR(s) string( OUStringToOString( s, RTL_TEXTENCODING_UTF8 ).getStr() )
+#define OUSTR_TO_STDSTR(s) std::string( OUStringToOString( s, RTL_TEXTENCODING_UTF8 ).getStr() )
 #define STD_TO_OUSTR( str ) OUString( str.c_str(), str.length( ), RTL_TEXTENCODING_UTF8 )
 
 using namespace com::sun::star;
-using namespace std;
 
 namespace cmis
 {
     RepoContent::RepoContent( const uno::Reference< uno::XComponentContext >& rxContext,
         ContentProvider *pProvider, const uno::Reference< ucb::XContentIdentifier >& Identifier,
-        vector< libcmis::RepositoryPtr > const & aRepos )
+        std::vector< libcmis::RepositoryPtr > const & aRepos )
         : ContentImplHelper( rxContext, pProvider, Identifier ),
         m_pProvider( pProvider ),
         m_aURL( Identifier->getContentIdentifier( ) ),
@@ -148,7 +147,7 @@ namespace cmis
         OUString sProxy = rProxy.aName;
         if ( rProxy.nPort > 0 )
             sProxy += ":" + OUString::number( rProxy.nPort );
-        libcmis::SessionFactory::setProxySettings( OUSTR_TO_STDSTR( sProxy ), string(), string(), string() );
+        libcmis::SessionFactory::setProxySettings( OUSTR_TO_STDSTR( sProxy ), std::string(), std::string(), std::string() );
 
         if ( m_aRepositories.empty() )
         {
@@ -161,8 +160,8 @@ namespace cmis
             AuthProvider authProvider( xEnv, m_xIdentifier->getContentIdentifier( ), m_aURL.getBindingUrl( ) );
             AuthProvider::setXEnv( xEnv );
 
-            string rUsername = OUSTR_TO_STDSTR( m_aURL.getUsername( ) );
-            string rPassword = OUSTR_TO_STDSTR( m_aURL.getPassword( ) );
+            std::string rUsername = OUSTR_TO_STDSTR( m_aURL.getUsername( ) );
+            std::string rPassword = OUSTR_TO_STDSTR( m_aURL.getPassword( ) );
 
             bool bIsDone = false;
 
@@ -243,7 +242,7 @@ namespace cmis
 
         if ( !m_sRepositoryId.isEmpty() )
         {
-            for ( vector< libcmis::RepositoryPtr >::iterator it = m_aRepositories.begin( );
+            for ( std::vector< libcmis::RepositoryPtr >::iterator it = m_aRepositories.begin( );
                     it != m_aRepositories.end( ) && nullptr == repo.get( ); ++it )
             {
                 if ( STD_TO_OUSTR( ( *it )->getId( ) ) == m_sRepositoryId )
@@ -396,16 +395,16 @@ namespace cmis
         return s_aFolderCollection.getTypes();
     }
 
-    list< uno::Reference< ucb::XContent > > RepoContent::getChildren( )
+    std::vector< uno::Reference< ucb::XContent > > RepoContent::getChildren( )
     {
-        list< uno::Reference< ucb::XContent > > result;
+        std::vector< uno::Reference< ucb::XContent > > result;
 
         // TODO Cache the results somehow
         SAL_INFO( "ucb.ucp.cmis", "RepoContent::getChildren" );
 
         if ( m_sRepositoryId.isEmpty( ) )
         {
-            for ( vector< libcmis::RepositoryPtr >::iterator it = m_aRepositories.begin( );
+            for ( std::vector< libcmis::RepositoryPtr >::iterator it = m_aRepositories.begin( );
                     it != m_aRepositories.end(); ++it )
             {
                 URL aUrl( m_aURL );
diff --git a/ucb/source/ucp/cmis/cmis_repo_content.hxx b/ucb/source/ucp/cmis/cmis_repo_content.hxx
index 4be969ee1c24..241d9fb44853 100644
--- a/ucb/source/ucp/cmis/cmis_repo_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_repo_content.hxx
@@ -109,7 +109,7 @@ public:
 
     virtual void SAL_CALL abort( sal_Int32 CommandId ) override;
 
-    virtual std::list< css::uno::Reference< css::ucb::XContent > > getChildren( ) override;
+    virtual std::vector< css::uno::Reference< css::ucb::XContent > > getChildren( ) override;
 };
 
 }
diff --git a/ucb/source/ucp/gio/gio_content.hxx b/ucb/source/ucp/gio/gio_content.hxx
index 9b2849e726e4..56196295025f 100644
--- a/ucb/source/ucp/gio/gio_content.hxx
+++ b/ucb/source/ucp/gio/gio_content.hxx
@@ -29,7 +29,7 @@
 #include <ucbhelper/contenthelper.hxx>
 #include <gio/gio.h>
 
-#include <list>
+#include <vector>
 
 namespace com { namespace sun { namespace star {
     namespace beans {
@@ -82,7 +82,7 @@ private:
             const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
 private:
     typedef rtl::Reference< Content > ContentRef;
-    typedef std::list< ContentRef > ContentRefList;
+    typedef std::vector< ContentRef > ContentRefList;
 
     void queryChildren( ContentRefList& rChildren );
 
diff --git a/ucb/source/ucp/package/pkgcontent.hxx b/ucb/source/ucp/package/pkgcontent.hxx
index f6b0ad555b56..0b57fed019cf 100644
--- a/ucb/source/ucp/package/pkgcontent.hxx
+++ b/ucb/source/ucp/package/pkgcontent.hxx
@@ -20,7 +20,7 @@
 #ifndef INCLUDED_UCB_SOURCE_UCP_PACKAGE_PKGCONTENT_HXX
 #define INCLUDED_UCB_SOURCE_UCP_PACKAGE_PKGCONTENT_HXX
 
-#include <list>
+#include <vector>
 #include <rtl/ref.hxx>
 
 #include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp>
@@ -165,7 +165,7 @@ private:
     flushData();
 
     typedef rtl::Reference< Content > ContentRef;
-    typedef std::list< ContentRef > ContentRefList;
+    typedef std::vector< ContentRef > ContentRefList;
     void queryChildren( ContentRefList& rChildren );
 
     bool
diff --git a/ucb/source/ucp/tdoc/tdoc_content.hxx b/ucb/source/ucp/tdoc/tdoc_content.hxx
index baa47bb37fba..cf1032a514da 100644
--- a/ucb/source/ucp/tdoc/tdoc_content.hxx
+++ b/ucb/source/ucp/tdoc/tdoc_content.hxx
@@ -133,7 +133,7 @@ private:
     makeNewIdentifier( const OUString& rTitle );
 
     typedef rtl::Reference< Content > ContentRef;
-    typedef std::list< ContentRef > ContentRefList;
+    typedef std::vector< ContentRef > ContentRefList;
     void queryChildren( ContentRefList& rChildren );
 
     bool exchangeIdentity(
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.hxx b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
index 571dec7b2fa6..4eb700d91d36 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
@@ -136,7 +136,7 @@ private:
                        const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
 
     typedef rtl::Reference< Content > ContentRef;
-    typedef std::list< ContentRef > ContentRefList;
+    typedef std::vector< ContentRef > ContentRefList;
     void queryChildren( ContentRefList& rChildren);
 
     bool
diff --git a/ucb/source/ucp/webdav/webdavcontent.hxx b/ucb/source/ucp/webdav/webdavcontent.hxx
index 8eefba6f2f32..5c0b47bda8ce 100644
--- a/ucb/source/ucp/webdav/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav/webdavcontent.hxx
@@ -104,7 +104,7 @@ private:
                        const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv );
 
     typedef rtl::Reference< Content > ContentRef;
-    typedef std::list< ContentRef > ContentRefList;
+    typedef std::vector< ContentRef > ContentRefList;
     void queryChildren( ContentRefList& rChildren);
 
     bool
diff --git a/ucbhelper/source/client/proxydecider.cxx b/ucbhelper/source/client/proxydecider.cxx
index 2109f439c0df..cc0dd60afeab 100644
--- a/ucbhelper/source/client/proxydecider.cxx
+++ b/ucbhelper/source/client/proxydecider.cxx
@@ -19,7 +19,7 @@
 
 #include <utility>
 #include <vector>
-#include <list>
+#include <deque>
 
 #include <osl/diagnose.h>
 #include <osl/mutex.hxx>
@@ -78,7 +78,7 @@ class HostnameCache
 {
     typedef std::pair< OUString, OUString > HostListEntry;
 
-    std::list< HostListEntry >     m_aHostList;
+    std::deque< HostListEntry >    m_aHostList;
     sal_uInt32                     m_nCapacity;
 
 public:
@@ -87,19 +87,13 @@ public:
 
     bool get( const OUString & rKey, OUString & rValue ) const
     {
-        std::list< HostListEntry >::const_iterator it
-            = m_aHostList.begin();
-        const std::list< HostListEntry >::const_iterator end
-            = m_aHostList.end();
-
-        while ( it != end )
+        for (auto const& host : m_aHostList)
         {
-            if ( (*it).first == rKey )
+            if ( host.first == rKey )
             {
-                rValue = (*it).second;
+                rValue = host.second;
                 return true;
             }
-            ++it;
         }
         return false;
     }
@@ -417,24 +411,18 @@ bool InternetProxyDecider_Impl::shouldUseProxy( const OUString & rHost,
     aBuffer.append( OUString::number( nPort ) );
     const OUString aHostAndPort( aBuffer.makeStringAndClear() );
 
-    std::vector< NoProxyListEntry >::const_iterator it
-        = m_aNoProxyList.begin();
-    const std::vector< NoProxyListEntry >::const_iterator end
-        = m_aNoProxyList.end();
-
-    while ( it != end )
+    for (auto const& noProxy : m_aNoProxyList)
     {
         if ( bUseFullyQualified )
         {
-            if ( (*it).second.Matches( aHostAndPort ) )
+            if ( noProxy.second.Matches( aHostAndPort ) )
                 return false;
         }
         else
         {
-            if ( (*it).first.Matches( aHostAndPort ) )
+            if ( noProxy.first.Matches( aHostAndPort ) )
                 return false;
         }
-        ++it;
     }
 
     return true;


More information about the Libreoffice-commits mailing list