From b38e690296e48657ec8c66427a6511f42f4b0115 Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Wed, 19 Dec 2018 21:53:06 +0300 Subject: Simplify containers iterations in scaddins, sccomp, scripting Use range-based loop or replace with STL functions Change-Id: I21ec2eea8f322e2792097d352fc352dc6099c7b7 Reviewed-on: https://gerrit.libreoffice.org/65461 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../source/provider/BrowseNodeFactoryImpl.cxx | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'scripting/source/provider/BrowseNodeFactoryImpl.cxx') diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx index a0ff04cf2e1f..6621d5453737 100644 --- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx +++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx @@ -105,17 +105,17 @@ public: } } - std::vector< Sequence< Reference < browse::XBrowseNode > > >::const_iterator it = seqs.begin(); - std::vector< Sequence< Reference < browse::XBrowseNode > > >::const_iterator it_end = seqs.end(); - Sequence< Reference < browse::XBrowseNode > > result( numChildren ); - for ( sal_Int32 index = 0; it != it_end && index < numChildren ; ++it ) + sal_Int32 index = 0; + for ( Sequence< Reference < browse::XBrowseNode > >& children : seqs ) { - Sequence< Reference < browse::XBrowseNode > > children = *it; for ( sal_Int32 j = 0; j < children.getLength(); j++ ) { result[ index++ ] = children[ j ]; } + + if (index >= numChildren) + break; } return result; } @@ -411,10 +411,11 @@ public: ::std::sort( aVNodes.begin(), aVNodes.end(), alphaSortForBNodes() ); Sequence < Reference< browse::XBrowseNode > > children( aVNodes.size() ); - vXBrowseNodes::const_iterator it = aVNodes.begin(); - for ( sal_Int32 i=0; it != aVNodes.end() && i > children( m_vNodes.size() ); - vXBrowseNodes::const_iterator it = m_vNodes.begin(); - for ( sal_Int32 i=0; it != m_vNodes.end() && i