From 79d58ee14da8fbf636fb087453834abb7173d3fc Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Sun, 12 May 2019 16:07:58 +0300 Subject: Simplify Sequence iterations in xmloff/source/{style..xforms} Use range-based loops or replace with comphelper or STL functions Change-Id: Ie268d80b9c01d38c745c14a81c219d9930860562 Reviewed-on: https://gerrit.libreoffice.org/72189 Tested-by: Jenkins Reviewed-by: Noel Grandin --- xmloff/source/style/xmlnumfe.cxx | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'xmloff/source/style/xmlnumfe.cxx') diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 98a8e72f17ce..80f8511499b3 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -194,11 +194,9 @@ uno::Sequence SvXMLNumUsedList_Impl::GetWasUsed() void SvXMLNumUsedList_Impl::SetWasUsed(const uno::Sequence& rWasUsed) { DBG_ASSERT(nWasUsedCount == 0, "WasUsed should be empty"); - sal_Int32 nCount(rWasUsed.getLength()); - const sal_Int32* pWasUsed = rWasUsed.getConstArray(); - for (sal_Int32 i = 0; i < nCount; i++, pWasUsed++) + for (const auto nWasUsed : rWasUsed) { - std::pair aPair = aWasUsed.insert( *pWasUsed ); + std::pair aPair = aWasUsed.insert( nWasUsed ); if (aPair.second) nWasUsedCount++; } @@ -929,16 +927,10 @@ static OUString lcl_GetDefaultCalendar( SvNumberFormatter const * pFormatter, La lang::Locale aLocale( LanguageTag::convertToLocale( nLang ) ); uno::Sequence aCals = pCalendar->getAllCalendars( aLocale ); - sal_Int32 nCnt = aCals.getLength(); - bool bFound = false; - for ( sal_Int32 j=0; j < nCnt && !bFound; j++ ) - { - if ( aCals[j] != "gregorian" ) - { - aCalendar = aCals[j]; - bFound = true; - } - } + auto pCal = std::find_if(aCals.begin(), aCals.end(), + [](const OUString& rCal) { return rCal != "gregorian"; }); + if (pCal != aCals.end()) + aCalendar = *pCal; } return aCalendar; } -- cgit