From 91adb929d747ef1434fb1732fdbf51283fda78e8 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 28 Apr 2016 10:24:35 +0200 Subject: clang-tidy modernize-loop-convert in h-l/* Change-Id: I843528327b25d18476f8959cabba16371213a48a Reviewed-on: https://gerrit.libreoffice.org/24460 Tested-by: Jenkins Reviewed-by: Noel Grandin --- helpcompiler/source/HelpCompiler.cxx | 4 +-- helpcompiler/source/HelpLinker.cxx | 19 ++++++----- hwpfilter/source/hinfo.cxx | 12 +++---- .../source/breakiterator/breakiteratorImpl.cxx | 10 +++--- .../source/breakiterator/breakiterator_unicode.cxx | 4 +-- i18npool/source/breakiterator/xdictionary.cxx | 18 +++++------ i18npool/source/calendar/calendarImpl.cxx | 4 +-- .../characterclassificationImpl.cxx | 8 ++--- i18npool/source/collator/collatorImpl.cxx | 8 ++--- .../source/inputchecker/inputsequencechecker.cxx | 8 ++--- i18npool/source/localedata/localedata.cxx | 37 +++++++++++----------- .../source/nativenumber/nativenumbersupplier.cxx | 4 +-- i18nutil/source/utility/oneToOneMapping.cxx | 8 ++--- linguistic/source/dicimp.cxx | 4 +-- linguistic/source/dlistimp.cxx | 6 ++-- linguistic/source/iprcache.cxx | 8 ++--- linguistic/source/misc.cxx | 4 +-- lotuswordpro/source/filter/lwpdrawobj.cxx | 18 +++++------ lotuswordpro/source/filter/lwplayout.cxx | 6 ++-- lotuswordpro/source/filter/lwprowlayout.cxx | 4 +-- lotuswordpro/source/filter/lwpsortopt.cxx | 4 +-- lotuswordpro/source/filter/xfilter/xfliststyle.cxx | 8 ++--- 22 files changed, 98 insertions(+), 108 deletions(-) diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx index c25b69bc1933..91458e09e057 100644 --- a/helpcompiler/source/HelpCompiler.cxx +++ b/helpcompiler/source/HelpCompiler.cxx @@ -460,9 +460,9 @@ bool HelpCompiler::compile() std::string title; // returns a clone of the document with switch-cases resolved std::string appl = module.substr(1); - for (size_t i = 0; i < appl.length(); ++i) + for (char & i : appl) { - appl[i]=toupper(appl[i]); + i=toupper(i); } xmlNodePtr docResolved = clone(xmlDocGetRootElement(docResolvedOrg), appl); myparser aparser(documentId, fileName, title); diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx index 95821f172a4b..dcf195b77d86 100644 --- a/helpcompiler/source/HelpLinker.cxx +++ b/helpcompiler/source/HelpLinker.cxx @@ -210,9 +210,8 @@ namespace URLEncoder static const char hex[17] = "0123456789ABCDEF"; std::string result; - for (size_t i=0; i < rIn.length(); ++i) + for (char c : rIn) { - unsigned char c = rIn[i]; if (isalnum (c) || strchr (good, c)) result += c; else { @@ -242,21 +241,21 @@ void HelpLinker::addBookmark( FILE* pFile_DBHelp, std::string thishid, std::vector dataB(dataLen); size_t i = 0; dataB[i++] = static_cast(fileLen); - for (size_t j = 0; j < fileB.length(); ++j) - dataB[i++] = static_cast(fileB[j]); + for (char j : fileB) + dataB[i++] = static_cast(j); if (!anchorB.empty()) { dataB[i++] = '#'; - for (size_t j = 0; j < anchorB.length(); ++j) - dataB[i++] = anchorB[j]; + for (char j : anchorB) + dataB[i++] = j; } dataB[i++] = static_cast(jarfileB.length()); - for (size_t j = 0; j < jarfileB.length(); ++j) - dataB[i++] = jarfileB[j]; + for (char j : jarfileB) + dataB[i++] = j; dataB[i++] = static_cast(titleB.length()); - for (size_t j = 0; j < titleB.length(); ++j) - dataB[i++] = titleB[j]; + for (char j : titleB) + dataB[i++] = j; if( pFile_DBHelp != nullptr ) { diff --git a/hwpfilter/source/hinfo.cxx b/hwpfilter/source/hinfo.cxx index 241ab2f80304..2e5d4b1c9a16 100644 --- a/hwpfilter/source/hinfo.cxx +++ b/hwpfilter/source/hinfo.cxx @@ -140,11 +140,11 @@ void HWPInfo::Read(HWPFile & hwpf) hwpf.Read1b(&fnchar, 1); hwpf.Read1b(&fnlinetype, 1); // border layout - for (int ii = 0; ii < 4; ++ii) + for (int & ii : bordermargin) { if (!hwpf.Read2b(tmp16)) return; - bordermargin[ii] = tmp16; + ii = tmp16; } hwpf.Read2b(&borderline, 1); @@ -217,13 +217,13 @@ void ParaShape::Read(HWPFile & hwpf) hwpf.Read1b(&condense, 1); hwpf.Read1b(&arrange_type, 1); - for (int ii = 0; ii < MAXTABS; ii++) + for (TabSet & tab : tabs) { - hwpf.Read1b(&tabs[ii].type, 1); - hwpf.Read1b(&tabs[ii].dot_continue, 1); + hwpf.Read1b(&tab.type, 1); + hwpf.Read1b(&tab.dot_continue, 1); if (!hwpf.Read2b(tmp16)) return; - tabs[ii].position = tmp16; + tab.position = tmp16; } hwpf.Read1b(&coldef.ncols, 1); hwpf.Read1b(&coldef.separator, 1); diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx index 7fa79cf62696..33ac5864a79c 100644 --- a/i18npool/source/breakiterator/breakiteratorImpl.cxx +++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx @@ -39,8 +39,8 @@ BreakIteratorImpl::BreakIteratorImpl() BreakIteratorImpl::~BreakIteratorImpl() { // Clear lookuptable - for (size_t l = 0; l < lookupTable.size(); l++) - delete lookupTable[l]; + for (lookupTableItem* p : lookupTable) + delete p; lookupTable.clear(); } @@ -526,8 +526,7 @@ sal_Int16 BreakIteratorImpl::getScriptClass(sal_uInt32 currentChar) bool SAL_CALL BreakIteratorImpl::createLocaleSpecificBreakIterator(const OUString& aLocaleName) throw( RuntimeException ) { // to share service between same Language but different Country code, like zh_CN and zh_TW - for (size_t l = 0; l < lookupTable.size(); l++) { - lookupTableItem *listItem = lookupTable[l]; + for (lookupTableItem* listItem : lookupTable) { if (aLocaleName == listItem->aLocale.Language) { xBI = listItem->xBI; return true; @@ -555,8 +554,7 @@ BreakIteratorImpl::getLocaleSpecificBreakIterator(const Locale& rLocale) throw ( else if (m_xContext.is()) { aLocale = rLocale; - for (size_t i = 0; i < lookupTable.size(); i++) { - lookupTableItem *listItem = lookupTable[i]; + for (lookupTableItem* listItem : lookupTable) { if (rLocale == listItem->aLocale) return xBI = listItem->xBI; } diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index f061d11001e5..8707dd452b83 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -52,8 +52,8 @@ BreakIterator_Unicode::~BreakIterator_Unicode() delete character.aBreakIterator; delete sentence.aBreakIterator; delete line.aBreakIterator; - for (size_t i = 0; i < SAL_N_ELEMENTS(words); i++) - delete words[i].aBreakIterator; + for (BI_Data & word : words) + delete word.aBreakIterator; } /* diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index 536b67e3edb8..551ce859592b 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -115,18 +115,18 @@ xdictionary::xdictionary(const sal_Char *lang) : #endif - for (sal_Int32 i = 0; i < CACHE_MAX; i++) - cache[i].size = 0; + for (WordBreakCache & i : cache) + i.size = 0; japaneseWordBreak = false; } xdictionary::~xdictionary() { - for (sal_Int32 i = 0; i < CACHE_MAX; i++) { - if (cache[i].size > 0) { - delete [] cache[i].contents; - delete [] cache[i].wordboundary; + for (WordBreakCache & i : cache) { + if (i.size > 0) { + delete [] i.contents; + delete [] i.wordboundary; } } } @@ -147,11 +147,11 @@ void xdictionary::initDictionaryData(const sal_Char *pLang) static std::vector< datacache > aLoadedCache; osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ); - for( size_t i = 0; i < aLoadedCache.size(); ++i ) + for(datacache & i : aLoadedCache) { - if( !strcmp( pLang, aLoadedCache[ i ].maLang.getStr() ) ) + if( !strcmp( pLang, i.maLang.getStr() ) ) { - data = aLoadedCache[ i ].maData; + data = i.maData; return; } } diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx index 67a82dbb7795..48c4ad2d02a3 100644 --- a/i18npool/source/calendar/calendarImpl.cxx +++ b/i18npool/source/calendar/calendarImpl.cxx @@ -36,8 +36,8 @@ CalendarImpl::CalendarImpl(const Reference< XComponentContext > &rxContext) : m_ CalendarImpl::~CalendarImpl() { // Clear lookuptable - for (size_t l = 0; l < lookupTable.size(); l++) - delete lookupTable[l]; + for (lookupTableItem* p : lookupTable) + delete p; lookupTable.clear(); } diff --git a/i18npool/source/characterclassification/characterclassificationImpl.cxx b/i18npool/source/characterclassification/characterclassificationImpl.cxx index be40da7fb53f..41aa591bb148 100644 --- a/i18npool/source/characterclassification/characterclassificationImpl.cxx +++ b/i18npool/source/characterclassification/characterclassificationImpl.cxx @@ -36,8 +36,8 @@ CharacterClassificationImpl::CharacterClassificationImpl( CharacterClassificationImpl::~CharacterClassificationImpl() { // Clear lookuptable - for (size_t l = 0; l < lookupTable.size(); l++) - delete lookupTable[l]; + for (lookupTableItem* p : lookupTable) + delete p; lookupTable.clear(); } @@ -160,8 +160,8 @@ CharacterClassificationImpl::getLocaleSpecificCharacterClassification(const Loca if (cachedItem && cachedItem->equals(rLocale)) return cachedItem->xCI; else { - for (size_t i = 0; i < lookupTable.size(); i++) { - cachedItem = lookupTable[i]; + for (lookupTableItem* i : lookupTable) { + cachedItem = i; if (cachedItem->equals(rLocale)) return cachedItem->xCI; } diff --git a/i18npool/source/collator/collatorImpl.cxx b/i18npool/source/collator/collatorImpl.cxx index 874e3469f1f0..8b4919a68400 100644 --- a/i18npool/source/collator/collatorImpl.cxx +++ b/i18npool/source/collator/collatorImpl.cxx @@ -40,8 +40,8 @@ CollatorImpl::CollatorImpl( const Reference < XComponentContext >& rxContext ) : CollatorImpl::~CollatorImpl() { // Clear lookuptable - for (size_t l = 0; l < lookupTable.size(); l++) - delete lookupTable[l]; + for (lookupTableItem* p : lookupTable) + delete p; lookupTable.clear(); } @@ -170,8 +170,8 @@ void SAL_CALL CollatorImpl::loadCachedCollator(const lang::Locale& rLocale, const OUString& rSortAlgorithm) throw(RuntimeException) { - for (size_t i = 0; i < lookupTable.size(); i++) { - cachedItem = lookupTable[i]; + for (lookupTableItem* i : lookupTable) { + cachedItem = i; if (cachedItem->equals(rLocale, rSortAlgorithm)) { return; } diff --git a/i18npool/source/inputchecker/inputsequencechecker.cxx b/i18npool/source/inputchecker/inputsequencechecker.cxx index b1e71c125910..69c8525985af 100644 --- a/i18npool/source/inputchecker/inputsequencechecker.cxx +++ b/i18npool/source/inputchecker/inputsequencechecker.cxx @@ -43,8 +43,8 @@ InputSequenceCheckerImpl::InputSequenceCheckerImpl(const char *pServiceName) InputSequenceCheckerImpl::~InputSequenceCheckerImpl() { // Clear lookuptable - for (size_t l = 0; l < lookupTable.size(); l++) - delete lookupTable[l]; + for (lookupTableItem* p : lookupTable) + delete p; lookupTable.clear(); } @@ -111,8 +111,8 @@ InputSequenceCheckerImpl::getInputSequenceChecker(sal_Char* rLanguage) throw (Ru return cachedItem->xISC; } else { - for (size_t l = 0; l < lookupTable.size(); l++) { - cachedItem = lookupTable[l]; + for (lookupTableItem* l : lookupTable) { + cachedItem = l; if (cachedItem->aLanguage == rLanguage) return cachedItem->xISC; } diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index d8f5ed09371a..bfb59aac8864 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -484,26 +484,25 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName( aFallback = LocaleDataImpl::getFirstLocaleServiceName( aFbLocale); } - for ( sal_Int16 i = 0; i < nbOfLocales; i++) + for (const auto & i : aLibTable) { - if (localeName.equalsAscii(aLibTable[i].pLocale) || - (bFallback && aFallback.equalsAscii(aLibTable[i].pLocale))) + if (localeName.equalsAscii(i.pLocale) || + (bFallback && aFallback.equalsAscii(i.pLocale))) { #ifndef DISABLE_DYNLOADING OUStringBuffer aBuf(sal::static_int_cast( - strlen(aLibTable[i].pLocale) + 1 + strlen(pFunction))); + strlen(i.pLocale) + 1 + strlen(pFunction))); { ::osl::MutexGuard aGuard( maMutex ); - for (size_t l = 0; l < maLookupTable.size(); l++) + for (LocaleDataLookupTableItem* pCurrent : maLookupTable) { - LocaleDataLookupTableItem* pCurrent = maLookupTable[l]; - if (pCurrent->dllName == aLibTable[i].pLib) + if (pCurrent->dllName == i.pLib) { OSL_ASSERT( pOutCachedItem ); if( pOutCachedItem ) { (*pOutCachedItem) = new LocaleDataLookupTableItem( *pCurrent ); - (*pOutCachedItem)->localeName = aLibTable[i].pLocale; + (*pOutCachedItem)->localeName = i.pLocale; return (*pOutCachedItem)->module->getFunctionSymbol( aBuf.appendAscii( pFunction).append( cUnder). appendAscii( (*pOutCachedItem)->localeName).makeStringAndClear()); @@ -515,17 +514,17 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName( } // Library not loaded, load it and add it to the list. #ifdef SAL_DLLPREFIX - aBuf.ensureCapacity(strlen(aLibTable[i].pLib) + 6); // mostly "lib*.so" - aBuf.append( SAL_DLLPREFIX ).appendAscii(aLibTable[i].pLib).append( SAL_DLLEXTENSION ); + aBuf.ensureCapacity(strlen(i.pLib) + 6); // mostly "lib*.so" + aBuf.append( SAL_DLLPREFIX ).appendAscii(i.pLib).append( SAL_DLLEXTENSION ); #else - aBuf.ensureCapacity(strlen(aLibTable[i].pLib) + 4); // mostly "*.dll" - aBuf.appendAscii(aLibTable[i].pLib).appendAscii( SAL_DLLEXTENSION ); + aBuf.ensureCapacity(strlen(i.pLib) + 4); // mostly "*.dll" + aBuf.appendAscii(i.pLib).appendAscii( SAL_DLLEXTENSION ); #endif osl::Module *module = new osl::Module(); if ( module->loadRelative(&thisModule, aBuf.makeStringAndClear()) ) { ::osl::MutexGuard aGuard( maMutex ); - LocaleDataLookupTableItem* pNewItem = new LocaleDataLookupTableItem(aLibTable[i].pLib, module, aLibTable[i].pLocale); + LocaleDataLookupTableItem* pNewItem = new LocaleDataLookupTableItem(i.pLib, module, i.pLocale); maLookupTable.push_back(pNewItem); OSL_ASSERT( pOutCachedItem ); if( pOutCachedItem ) @@ -844,15 +843,15 @@ LocaleDataImpl::getAllFormats( const Locale& rLocale ) throw(RuntimeException, s Sequence< FormatElement > seq(formatCount); sal_Int32 f = 0; - for (int s = 0; s < SECTIONS; ++s) + for (FormatSection & s : section) { - sal_Unicode const * const * const formatArray = section[s].formatArray; + sal_Unicode const * const * const formatArray = s.formatArray; if ( formatArray ) { - for (int i = 0, nOff = 0; i < section[s].formatCount; ++i, nOff += 7, ++f) + for (int i = 0, nOff = 0; i < s.formatCount; ++i, nOff += 7, ++f) { FormatElement elem( - OUString(formatArray[nOff]).replaceAll(section[s].from, section[s].to), + OUString(formatArray[nOff]).replaceAll(s.from, s.to), formatArray[nOff + 1], formatArray[nOff + 2], formatArray[nOff + 3], @@ -1468,8 +1467,8 @@ LocaleDataImpl::getAllInstalledLocaleNames() throw(RuntimeException, std::except Sequence< lang::Locale > seq( nbOfLocales ); sal_Int16 nInstalled = 0; - for( sal_Int16 i=0; iWriteLine(OString("---")); if (0 != (nErr = pStream->GetError())) return nErr; - for (size_t i = 0; i < aEntries.size(); i++) + for (Reference & aEntrie : aEntries) { - OString aOutStr = formatForSave(aEntries[i], eEnc); + OString aOutStr = formatForSave(aEntrie, eEnc); pStream->WriteLine (aOutStr); if (0 != (nErr = pStream->GetError())) break; diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index 0bf680bd9501..bba17f95bf55 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -626,10 +626,10 @@ void DicList::CreateDicList() // look for dictionaries const OUString aWriteablePath( GetDictionaryWriteablePath() ); std::vector< OUString > aPaths( GetDictionaryPaths() ); - for (size_t i = 0; i < aPaths.size(); ++i) + for (OUString & aPath : aPaths) { - const bool bIsWriteablePath = (aPaths[i] == aWriteablePath); - SearchForDictionaries( aDicList, aPaths[i], bIsWriteablePath ); + const bool bIsWriteablePath = (aPath == aWriteablePath); + SearchForDictionaries( aDicList, aPath, bIsWriteablePath ); } // create IgnoreAllList dictionary with empty URL (non persistent) diff --git a/linguistic/source/iprcache.cxx b/linguistic/source/iprcache.cxx index e5b38c0eb183..fbcbb446b25d 100644 --- a/linguistic/source/iprcache.cxx +++ b/linguistic/source/iprcache.cxx @@ -63,10 +63,10 @@ static void lcl_AddAsPropertyChangeListener( { if (xListener.is() && rPropSet.is()) { - for (int i = 0; i < NUM_FLUSH_PROPS; ++i) + for (auto& aFlushPropertie : aFlushProperties) { rPropSet->addPropertyChangeListener( - OUString::createFromAscii(aFlushProperties[i].pPropName), xListener ); + OUString::createFromAscii(aFlushPropertie.pPropName), xListener ); } } } @@ -78,10 +78,10 @@ static void lcl_RemoveAsPropertyChangeListener( { if (xListener.is() && rPropSet.is()) { - for (int i = 0; i < NUM_FLUSH_PROPS; ++i) + for (auto& aFlushPropertie : aFlushProperties) { rPropSet->removePropertyChangeListener( - OUString::createFromAscii(aFlushProperties[i].pPropName), xListener ); + OUString::createFromAscii(aFlushPropertie.pPropName), xListener ); } } } diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 4cb427d805be..1edcdf1ec48e 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -680,16 +680,14 @@ static const sal_uInt32 the_aDigitZeroes [] = bool HasDigits( const OUString &rText ) { - static const int nNumDigitZeroes = SAL_N_ELEMENTS(the_aDigitZeroes); const sal_Int32 nLen = rText.getLength(); sal_Int32 i = 0; while (i < nLen) // for all characters ... { const sal_uInt32 nCodePoint = rText.iterateCodePoints( &i ); // handle unicode surrogates correctly... - for (int j = 0; j < nNumDigitZeroes; ++j) // ... check in all 0..9 ranges + for (unsigned int nDigitZero : the_aDigitZeroes) // ... check in all 0..9 ranges { - sal_uInt32 nDigitZero = the_aDigitZeroes[ j ]; if (nDigitZero > nCodePoint) break; if (/*nDigitZero <= nCodePoint &&*/ nCodePoint <= nDigitZero + 9) diff --git a/lotuswordpro/source/filter/lwpdrawobj.cxx b/lotuswordpro/source/filter/lwpdrawobj.cxx index 82e1fc5f9842..cab4dd260125 100644 --- a/lotuswordpro/source/filter/lwpdrawobj.cxx +++ b/lotuswordpro/source/filter/lwpdrawobj.cxx @@ -835,10 +835,10 @@ void LwpDrawEllipse::Read() { ReadClosedObjStyle(); - for (sal_uInt8 nC = 0; nC < 13; nC++) + for (SdwPoint & nC : m_aVector) { - m_pStream->ReadInt16( m_aVector[nC].x ); - m_pStream->ReadInt16( m_aVector[nC].y ); + m_pStream->ReadInt16( nC.x ); + m_pStream->ReadInt16( nC.y ); } } @@ -914,10 +914,10 @@ void LwpDrawArc::Read() m_pStream->ReadUChar( m_aArcRec.aPenColor.unused ); m_pStream->ReadUChar( m_aArcRec.nLineEnd ); - for (sal_uInt8 nC = 0; nC < 4; nC++) + for (SdwPoint & nC : m_aVector) { - m_pStream->ReadInt16( m_aVector[nC].x ); - m_pStream->ReadInt16( m_aVector[nC].y ); + m_pStream->ReadInt16( nC.x ); + m_pStream->ReadInt16( nC.y ); } } @@ -1194,10 +1194,10 @@ void LwpDrawTextArt::CreateFWPath(XFDrawPath* pPath) void LwpDrawTextArt::Read() { - for (sal_uInt8 nC = 0; nC < 4; nC++) + for (SdwPoint & nC : m_aVector) { - m_pStream->ReadInt16( m_aVector[nC].x ); - m_pStream->ReadInt16( m_aVector[nC].y ); + m_pStream->ReadInt16( nC.x ); + m_pStream->ReadInt16( nC.y ); } ReadClosedObjStyle(); diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index c70153c02991..3e80d8a6fd0a 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -826,11 +826,11 @@ XFBorders* LwpMiddleLayout::GetXFBorders() LwpBorderStuff::BorderType pType[] = { LwpBorderStuff::LEFT, LwpBorderStuff::RIGHT, LwpBorderStuff::TOP, LwpBorderStuff::BOTTOM }; - for (sal_uInt8 nC = 0; nC < 4; nC++) + for (LwpBorderStuff::BorderType & nC : pType) { - if (pBorderStuff->HasSide(pType[nC])) + if (pBorderStuff->HasSide(nC)) { - LwpParaStyle::ApplySubBorder(pBorderStuff, pType[nC], pXFBorders); + LwpParaStyle::ApplySubBorder(pBorderStuff, nC, pXFBorders); } } return pXFBorders; diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx index 906c09cdb052..a936f0e1e251 100644 --- a/lotuswordpro/source/filter/lwprowlayout.cxx +++ b/lotuswordpro/source/filter/lwprowlayout.cxx @@ -445,10 +445,8 @@ void LwpRowLayout::CollectMergeInfo() */ void LwpRowLayout::SetCellSplit(sal_uInt16 nEffectRows) { - LwpConnectedCellLayout* pConnCell; - for (size_t i=0; iGetRowID()+pConnCell->GetNumrows(); if ( nRowSpan > nEffectRows ) { diff --git a/lotuswordpro/source/filter/lwpsortopt.cxx b/lotuswordpro/source/filter/lwpsortopt.cxx index 886bac534ebe..e740ec95cae2 100644 --- a/lotuswordpro/source/filter/lwpsortopt.cxx +++ b/lotuswordpro/source/filter/lwpsortopt.cxx @@ -79,9 +79,9 @@ void LwpSortOption::Read(LwpObjectStream *pStrm) m_nCount = pStrm->QuickReaduInt16(); m_nFlags = pStrm->QuickReaduInt16(); m_nText = pStrm->QuickReaduInt8(); - for(sal_uInt8 i=0; i<3; i++) + for(LwpSortKey & key : m_Keys) { - m_Keys[i].Read(pStrm); + key.Read(pStrm); } pStrm->SkipExtra(); } diff --git a/lotuswordpro/source/filter/xfilter/xfliststyle.cxx b/lotuswordpro/source/filter/xfilter/xfliststyle.cxx index 7f7e868247f7..b989875221be 100644 --- a/lotuswordpro/source/filter/xfilter/xfliststyle.cxx +++ b/lotuswordpro/source/filter/xfilter/xfliststyle.cxx @@ -209,10 +209,9 @@ XFListStyle& XFListStyle::operator=(const XFListStyle& other) XFListStyle::~XFListStyle() { - for( int i=0; i<10; i++ ) + for(XFListLevel* p : m_pListLevels) { - if( m_pListLevels[i] ) - delete m_pListLevels[i]; + delete p; } } @@ -318,9 +317,8 @@ void XFListStyle::ToXml(IXFStream *pStrm) pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName()); pStrm->StartElement( "text:list-style" ); - for( int i=0; i<10; i++ ) + for(XFListLevel* pLevel : m_pListLevels) { - XFListLevel *pLevel = m_pListLevels[i]; if( pLevel ) pLevel->ToXml(pStrm); } -- cgit