[Libreoffice-commits] core.git: scripting/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Oct 6 11:54:49 UTC 2018


 scripting/source/provider/ProviderCache.cxx |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 4435135e68f7d1024875defc3df18de183607048
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Oct 6 12:27:44 2018 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Oct 6 13:54:29 2018 +0200

    Use range-based loop
    
    Change-Id: I5c1233f53ca5c9f4322ecf7a832880399d6fec5e
    Reviewed-on: https://gerrit.libreoffice.org/61463
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/scripting/source/provider/ProviderCache.cxx b/scripting/source/provider/ProviderCache.cxx
index 4e3b0230efa9..eeaac5fd44eb 100644
--- a/scripting/source/provider/ProviderCache.cxx
+++ b/scripting/source/provider/ProviderCache.cxx
@@ -88,16 +88,13 @@ ProviderCache::getAllProviders()
 
     ::osl::Guard< osl::Mutex > aGuard( m_mutex );
     Sequence < Reference< provider::XScriptProvider > > providers (  m_hProviderDetailsCache.size() );
-    ProviderDetails_hash::iterator h_itEnd =  m_hProviderDetailsCache.end();
-    ProviderDetails_hash::iterator h_it = m_hProviderDetailsCache.begin();
     // should assert if size !>  0
     if (  !m_hProviderDetailsCache.empty() )
     {
         sal_Int32 providerIndex = 0;
-        sal_Int32 index = 0;
-        for ( index = 0; h_it !=  h_itEnd; ++h_it, index++ )
+        for (auto& rDetail : m_hProviderDetailsCache)
         {
-            Reference< provider::XScriptProvider > xScriptProvider  = h_it->second.provider;
+            Reference<provider::XScriptProvider> xScriptProvider = rDetail.second.provider;
             if ( xScriptProvider.is() )
             {
                 providers[ providerIndex++ ] = xScriptProvider;
@@ -107,7 +104,7 @@ ProviderCache::getAllProviders()
                 // create provider
                 try
                 {
-                    xScriptProvider  = createProvider( h_it->second );
+                    xScriptProvider = createProvider(rDetail.second);
                     providers[ providerIndex++ ] = xScriptProvider;
                 }
                 catch ( const Exception& )
@@ -117,7 +114,7 @@ ProviderCache::getAllProviders()
             }
         }
 
-        if ( providerIndex < index )
+        if (providerIndex < providers.getLength())
         {
             providers.realloc( providerIndex );
         }


More information about the Libreoffice-commits mailing list