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

Arkadiy Illarionov (via logerrit) logerrit at kemper.freedesktop.org
Thu May 9 06:50:16 UTC 2019


 UnoControls/source/base/basecontainercontrol.cxx |    5 ++---
 UnoControls/source/base/multiplexer.cxx          |   12 ++++--------
 2 files changed, 6 insertions(+), 11 deletions(-)

New commits:
commit a11572dc2eeee7b5fea1935b63208c779a20eb56
Author:     Arkadiy Illarionov <qarkai at gmail.com>
AuthorDate: Wed May 8 23:47:55 2019 +0300
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu May 9 08:48:32 2019 +0200

    Simplify Sequence iterations in UnoControls
    
    Use range-based loops
    
    Change-Id: I4d3be75bb83c74267b9dec6f1dcdc105c292be9d
    Reviewed-on: https://gerrit.libreoffice.org/72011
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/UnoControls/source/base/basecontainercontrol.cxx b/UnoControls/source/base/basecontainercontrol.cxx
index 91efd22a28f7..3c6469def44a 100644
--- a/UnoControls/source/base/basecontainercontrol.cxx
+++ b/UnoControls/source/base/basecontainercontrol.cxx
@@ -117,11 +117,10 @@ void SAL_CALL BaseContainerControl::createPeer( const   Reference< XToolkit >&
 
         // create peers at all children
         Sequence< Reference< XControl > >   seqControlList  = getControls();
-        sal_uInt32                          nControls       = seqControlList.getLength();
 
-        for ( sal_uInt32 n=0; n<nControls; n++ )
+        for ( auto& rxControl : seqControlList )
         {
-            seqControlList.getArray()[n]->createPeer( xToolkit, getPeer() );
+            rxControl->createPeer( xToolkit, getPeer() );
         }
     }
 }
diff --git a/UnoControls/source/base/multiplexer.cxx b/UnoControls/source/base/multiplexer.cxx
index e1353add0d80..d7008c652083 100644
--- a/UnoControls/source/base/multiplexer.cxx
+++ b/UnoControls/source/base/multiplexer.cxx
@@ -156,22 +156,18 @@ void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer )
         {
             // get all types from the listener added to the peer
             Sequence< Type >    aContainedTypes = m_aListenerHolder.getContainedTypes();
-            const Type*         pArray          = aContainedTypes.getConstArray();
-            sal_Int32           nCount          = aContainedTypes.getLength();
             // loop over all listener types and remove the listeners from the peer
-            for( sal_Int32 i=0; i<nCount; i++ )
-                impl_unadviseFromPeer( m_xPeer, pArray[i] );
+            for( const auto& rContainedType : aContainedTypes )
+                impl_unadviseFromPeer( m_xPeer, rContainedType );
         }
         m_xPeer = xPeer;
         if( m_xPeer.is() )
         {
             // get all types from the listener added to the peer
             Sequence< Type >    aContainedTypes = m_aListenerHolder.getContainedTypes();
-            const Type*         pArray          = aContainedTypes.getConstArray();
-            sal_Int32           nCount          = aContainedTypes.getLength();
             // loop over all listener types and add the listeners to the peer
-            for( sal_Int32 i = 0; i < nCount; i++ )
-                impl_adviseToPeer( m_xPeer, pArray[i] );
+            for( const auto& rContainedType : aContainedTypes )
+                impl_adviseToPeer( m_xPeer, rContainedType );
         }
     }
 }


More information about the Libreoffice-commits mailing list