From 6ffdc88e79904882e319bdd0b901e7491abae0b3 Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Sat, 20 Jul 2019 20:03:15 +0300 Subject: Simplify Sequence iterations in shell..svgio Use range-based loops, STL and comphelper functions Change-Id: I612d36abcc09a91c60f7212de6747a1a1bdcfc69 Reviewed-on: https://gerrit.libreoffice.org/76056 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov --- sot/source/sdstor/ucbstorage.cxx | 12 ++++-------- sot/source/unoolestorage/xolesimplestorage.cxx | 8 ++++---- 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'sot/source') diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index a4c754610229..591a22805946 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -1813,14 +1813,12 @@ sal_Int32 UCBStorage_Impl::GetObjectCount() static OUString Find_Impl( const Sequence < Sequence < PropertyValue > >& rSequence, const OUString& rPath ) { bool bFound = false; - for ( sal_Int32 nSeqs=0; nSeqs& rMyProps : rSequence ) { - const Sequence < PropertyValue >& rMyProps = rSequence[nSeqs]; OUString aType; - for ( sal_Int32 nProps=0; nProps aInfo = pContent->queryCreatableContentsInfo(); - sal_Int32 nCount = aInfo.getLength(); - if ( nCount == 0 ) + if ( !aInfo.hasElements() ) return false; - for ( sal_Int32 i = 0; i < nCount; ++i ) + for ( const ContentInfo & rCurr : aInfo ) { // Simply look for the first KIND_FOLDER... - const ContentInfo & rCurr = aInfo[i]; if ( rCurr.Attributes & ContentInfoAttribute::KIND_FOLDER ) { // Make sure the only required bootstrap property is "Title", diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx index 80f2d0605c10..09de314226ab 100644 --- a/sot/source/unoolestorage/xolesimplestorage.cxx +++ b/sot/source/unoolestorage/xolesimplestorage.cxx @@ -237,15 +237,15 @@ void OLESimpleStorage::InsertNameAccessToStorage_Impl( BaseStorage* pStorage, co try { uno::Sequence< OUString > aElements = xNameAccess->getElementNames(); - for ( sal_Int32 nInd = 0; nInd < aElements.getLength(); nInd++ ) + for ( const auto& rElement : aElements ) { uno::Reference< io::XInputStream > xInputStream; uno::Reference< container::XNameAccess > xSubNameAccess; - uno::Any aAny = xNameAccess->getByName( aElements[nInd] ); + uno::Any aAny = xNameAccess->getByName( rElement ); if ( aAny >>= xInputStream ) - InsertInputStreamToStorage_Impl( pNewStorage.get(), aElements[nInd], xInputStream ); + InsertInputStreamToStorage_Impl( pNewStorage.get(), rElement, xInputStream ); else if ( aAny >>= xSubNameAccess ) - InsertNameAccessToStorage_Impl( pNewStorage.get(), aElements[nInd], xSubNameAccess ); + InsertNameAccessToStorage_Impl( pNewStorage.get(), rElement, xSubNameAccess ); } } catch( uno::Exception& ) -- cgit