diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-03-08 14:31:16 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-03-08 14:31:16 +0100 |
commit | c1723a3b66aabbbfacce6f66d370d09067b7ed27 (patch) | |
tree | 1882056f72b2c098b23cf2b099625c9d0a7fa721 /sw | |
parent | 8ac16e14f4a77b98716f059c51a4fe5dce6ef440 (diff) |
loplugin:loopvartoosmall
Change-Id: I01b42f92b553695724305c1604db967da114a818
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/crsr/findtxt.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentStylePoolManager.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/doc/docruby.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/doctxm.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/number.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/tblafmt.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/doc/tblcpy.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/doc/tblrwcl.cxx | 31 | ||||
-rw-r--r-- | sw/source/core/edit/autofmt.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/fields/expfld.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/frmedt/tblsel.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/html/htmlflywriter.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/app/mainwn.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/dbui/mailmergehelper.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/dbui/mmconfigitem.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/concustomshape.cxx | 3 |
18 files changed, 49 insertions, 56 deletions
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index c12aa4f9f2b2..91f477c64a21 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -410,7 +410,7 @@ bool SwPaM::Find( const i18nutil::SearchOptions2& rSearchOpt, bool bSearchInNote // now we have to split sal_Int32 nStartInside = 0; sal_Int32 nEndInside = 0; - sal_Int16 aLoop= bSrchForward ? aStart : aNumberPostits; + sal_Int32 aLoop= bSrchForward ? aStart : aNumberPostits; while ( (aLoop>=0) && (aLoop<=aNumberPostits)) { diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index b84ed8fb634e..23ca1027edb8 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -2124,7 +2124,7 @@ bool DocumentStylePoolManager::IsPoolTextCollUsed( sal_uInt16 nId ) const SwTextFormatColl* pNewColl = nullptr; bool bFnd = false; - for( sal_uInt16 n = 0; !bFnd && n < m_rDoc.GetTextFormatColls()->size(); ++n ) + for( SwTextFormatColls::size_type n = 0; !bFnd && n < m_rDoc.GetTextFormatColls()->size(); ++n ) { pNewColl = (*m_rDoc.GetTextFormatColls())[ n ]; if( nId == pNewColl->GetPoolFormatId() ) diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 89a8a25c7172..ac0fce441e94 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -2244,11 +2244,8 @@ OUString SwDoc::GetUniqueNumRuleName( const OUString* pChkStr, bool bAutoNum ) c } } - const SwNumRule* pNumRule; - sal_uInt16 n; - - for( n = 0; n < mpNumRuleTable->size(); ++n ) - if( nullptr != ( pNumRule = (*mpNumRuleTable)[ n ] ) ) + for( auto const & pNumRule: *mpNumRuleTable ) + if( nullptr != pNumRule ) { const OUString sNm = pNumRule->GetName(); if( sNm.startsWith( aName ) ) @@ -2266,7 +2263,7 @@ OUString SwDoc::GetUniqueNumRuleName( const OUString* pChkStr, bool bAutoNum ) c { // All Numbers have been flagged accordingly, so identify the right Number nNum = mpNumRuleTable->size(); - for( n = 0; n < nFlagSize; ++n ) + for( sal_uInt16 n = 0; n < nFlagSize; ++n ) if( 0xff != ( nTmp = pSetFlags[ n ] )) { // identify the Number diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx index 1d0e490fbfde..452907237398 100644 --- a/sw/source/core/doc/docruby.cxx +++ b/sw/source/core/doc/docruby.cxx @@ -97,7 +97,7 @@ void SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList, std::set<sal_uInt16> aDelArr; aDelArr.insert( RES_TXTATR_CJK_RUBY ); - sal_uInt16 nListEntry = 0; + SwRubyList::size_type nListEntry = 0; const SwPaM *_pStartCursor = rPam.GetNext(), *_pStartCursor2 = _pStartCursor; diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index df5d5d051046..2e08e18b8846 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1855,9 +1855,9 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew) } // find position and insert - short i; + long i; - for( i = (short)aRange.Min(); i < (short)aRange.Max(); ++i) + for( i = aRange.Min(); i < aRange.Max(); ++i) { // Only check for same level SwTOXSortTabBase* pOld = aSortArr[i]; if(*pOld == *pNew) diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 782c8c40fb68..c0bddb4c928e 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -620,7 +620,7 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto { OUString aStr; - unsigned int nLevel = rNumVector.size() - 1; + SwNumberTree::tNumberVector::size_type nLevel = rNumVector.size() - 1; if ( pExtremities ) pExtremities->nPrefixChars = pExtremities->nSuffixChars = 0; @@ -635,7 +635,7 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto const SwNumFormat& rMyNFormat = Get( static_cast<sal_uInt16>(nLevel) ); { - sal_uInt8 i = static_cast<sal_uInt8>(nLevel); + SwNumberTree::tNumberVector::size_type i = nLevel; if( !IsContinusNum() && // - do not include upper levels, if level isn't numbered. diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 08bf146b14d3..5738fb6cef6b 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -1409,10 +1409,9 @@ bool SwTableAutoFormatTable::Save( SvStream& rStream ) const rStream.WriteUInt16( m_pImpl->m_AutoFormats.size() - 1 ); bRet = 0 == rStream.GetError(); - for (sal_uInt16 i = 1; bRet && i < m_pImpl->m_AutoFormats.size(); ++i) + for (auto const & rFormat: m_pImpl->m_AutoFormats) { - SwTableAutoFormat const& rFormat = *m_pImpl->m_AutoFormats[i]; - bRet = rFormat.Save(rStream, AUTOFORMAT_FILE_VERSION); + bRet = rFormat->Save(rStream, AUTOFORMAT_FILE_VERSION); } } rStream.Flush(); diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index c6d42e695a91..1addcf3c5ca3 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -192,7 +192,7 @@ namespace maCols.push_front(0); const SwTableLine* pLine = rFndLines.front()->GetLine(); const sal_uInt16 nStartLn = rTable.GetTabLines().GetPos( pLine ); - sal_uInt16 nEndLn = nStartLn; + SwTableLines::size_type nEndLn = nStartLn; if( rFndLines.size() > 1 ) { pLine = rFndLines.back()->GetLine(); @@ -201,10 +201,9 @@ namespace if( nStartLn < USHRT_MAX && nEndLn < USHRT_MAX ) { const SwTableLines &rLines = rTable.GetTabLines(); - if( bNoSelection && - nMinSize > static_cast<LineStructure::size_type>(nEndLn - nStartLn + 1) ) + if( bNoSelection && nMinSize > nEndLn - nStartLn + 1 ) { - LineStructure::size_type nNewEndLn = nStartLn + nMinSize - 1; + SwTableLines::size_type nNewEndLn = nStartLn + nMinSize - 1; if( nNewEndLn >= rLines.size() ) { mnAddLine = nNewEndLn - rLines.size() + 1; @@ -222,7 +221,7 @@ namespace maLines.resize( nEndLn - nStartLn + 1 ); const SwSelBoxes* pSelBoxes = &rSelBoxes; sal_uInt16 nCnt = 0; - for( sal_uInt16 nLine = nStartLn; nLine <= nEndLn; ++nLine ) + for( SwTableLines::size_type nLine = nStartLn; nLine <= nEndLn; ++nLine ) { addLine( nCnt, rLines[nLine]->GetTabBoxes(), pSelBoxes, rTable.IsNewModel() ); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index cc67b7dcc577..15a01d9fdec4 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -3396,7 +3396,6 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, bLeft = nsTableChgWidthHeightType::WH_COL_LEFT == ( eType & 0xff ) || nsTableChgWidthHeightType::WH_CELL_LEFT == ( eType & 0xff ), bInsDel = 0 != (eType & nsTableChgWidthHeightType::WH_FLAG_INSDEL ); - sal_uInt16 n; sal_uLong nBoxIdx = rAktBox.GetSttIdx(); // Get the current Box's edge @@ -3478,10 +3477,10 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, else { bRet = true; - for( n = 0; n < m_aLines.size(); ++n ) + for( auto const & n: m_aLines ) { aParam.LoopClear(); - if( !(*fnSelBox)( m_aLines[ n ], aParam, nDistStt, true )) + if( !(*fnSelBox)( n, aParam, nDistStt, true )) { bRet = false; break; @@ -3585,7 +3584,7 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, UnlockModify(); - for( n = m_aLines.size(); n; ) + for( sal_uInt16 n = m_aLines.size(); n; ) { --n; aParam.LoopClear(); @@ -3615,10 +3614,10 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, { if( aParam.bBigger ) { - for( n = 0; n < m_aLines.size(); ++n ) + for( auto const & n: m_aLines ) { aParam.LoopClear(); - if( !(*fnSelBox)( m_aLines[ n ], aParam, nDistStt, true )) + if( !(*fnSelBox)( n, aParam, nDistStt, true )) { bRet = false; break; @@ -3630,10 +3629,10 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, bRet = bLeft ? nDist != 0 : ( rSz.GetWidth() - nDist ) > COLFUZZY; if( bRet ) { - for( n = 0; n < m_aLines.size(); ++n ) + for( auto const & n: m_aLines ) { aParam.LoopClear(); - if( !(*fnOtherBox)( m_aLines[ n ], aParam, 0, true )) + if( !(*fnOtherBox)( n, aParam, 0, true )) { bRet = false; break; @@ -3652,10 +3651,10 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, // We also need to test this! bRet = true; - for( n = 0; n < m_aLines.size(); ++n ) + for( auto const & n: m_aLines ) { aParam.LoopClear(); - if( !(*fnSelBox)( m_aLines[ n ], aParam, nDistStt, true )) + if( !(*fnSelBox)( n, aParam, nDistStt, true )) { bRet = false; break; @@ -3666,10 +3665,10 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, } else if( aParam.bBigger ) { - for( n = 0; n < m_aLines.size(); ++n ) + for( auto const & n: m_aLines ) { aParam.LoopClear(); - if( !(*fnOtherBox)( m_aLines[ n ], aParam, 0, true )) + if( !(*fnOtherBox)( n, aParam, 0, true )) { bRet = false; break; @@ -3678,10 +3677,10 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, } else { - for( n = 0; n < m_aLines.size(); ++n ) + for( auto const & n: m_aLines ) { aParam.LoopClear(); - if( !(*fnSelBox)( m_aLines[ n ], aParam, nDistStt, true )) + if( !(*fnSelBox)( n, aParam, nDistStt, true )) { bRet = false; break; @@ -3709,7 +3708,7 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, ? ( TBLFIX_CHGABS == m_eTableChgMode ? (bBigger && bLeft) : bLeft ) : ( TBLFIX_CHGABS != m_eTableChgMode && bLeft ) ) { - for( n = m_aLines.size(); n; ) + for( sal_uInt16 n = m_aLines.size(); n; ) { --n; aParam.LoopClear(); @@ -3720,7 +3719,7 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType, } else { - for( n = m_aLines.size(); n; ) + for( sal_uInt16 n = m_aLines.size(); n; ) { --n; aParam.LoopClear(); diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 59982f7a3c3c..65c8d285698e 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -1541,7 +1541,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) else { sal_uInt16 nSpaceSteps = nLvl ? sal_uInt16(nLeftTextPos / nLvl) : 0; - sal_uInt8 n; + sal_uInt16 n; for( n = 0; n <= nLvl; ++n ) { SwNumFormat aFormat( aRule.Get( n ) ); diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 813f8e100c10..2e10443c0aa9 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -19,6 +19,8 @@ #include <sal/config.h> +#include <limits> + #include <UndoTable.hxx> #include <hintids.hxx> #include <o3tl/any.hxx> @@ -568,8 +570,8 @@ void SwSetExpFieldType::SetSeqRefNo( SwSetExpField& rField ) } // flagged all numbers, so determine the right number - sal_uInt16 n = aArr.size(); - OSL_ENSURE( n == aArr.size(), "Array is too big for using a sal_uInt16 index" ); + std::vector<sal_uInt16>::size_type n = aArr.size(); + OSL_ENSURE( n <= std::numeric_limits<sal_uInt16>::max(), "Array is too big for using a sal_uInt16 index" ); if ( n > 0 && aArr[ n-1 ] != n-1 ) { diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 80a422887d71..51a416c96005 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -453,7 +453,6 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) bool bValidChartSel; // #i55421# Reduced value 10 int nLoopMax = 10; //JP 28.06.99: max 100 loops - Bug 67292 - sal_uInt16 i = 0; do { bool bTableIsValid = true; @@ -628,7 +627,7 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) // otherwise quickly "calculate" table layout and start over SwTabFrame *pTable = aUnions.front().GetTable(); - for( i = 0; i < aUnions.size(); ++i ) + for( SwSelUnions::size_type i = 0; i < aUnions.size(); ++i ) { if( pTable->IsValid() ) pTable->InvalidatePos(); @@ -691,10 +690,9 @@ bool GetAutoSumSel( const SwCursorShell& rShell, SwCellFrames& rBoxes ) ::MakeSelUnions( aUnions, pStart, pEnd, nsSwTableSearchType::TBLSEARCH_COL ); bool bTstRow = true, bFound = false; - sal_uInt16 i; // 1. check if box above contains value/formula - for( i = 0; i < aUnions.size(); ++i ) + for( SwSelUnions::size_type i = 0; i < aUnions.size(); ++i ) { SwSelUnion *pUnion = &aUnions[i]; const SwTabFrame *pTable = pUnion->GetTable(); @@ -763,7 +761,7 @@ bool GetAutoSumSel( const SwCursorShell& rShell, SwCellFrames& rBoxes ) aUnions.clear(); ::MakeSelUnions( aUnions, pStart, pEnd, nsSwTableSearchType::TBLSEARCH_ROW ); - for( i = 0; i < aUnions.size(); ++i ) + for( SwSelUnions::size_type i = 0; i < aUnions.size(); ++i ) { SwSelUnion *pUnion = &aUnions[i]; const SwTabFrame *pTable = pUnion->GetTable(); diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 21f6924f2833..bf6f1d2026c1 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -1996,7 +1996,7 @@ void SwHTMLWriter::AddLinkTarget( const OUString& rURL ) { sal_uInt32 nIdx = aPos.nNode.GetIndex(); - sal_uInt32 nIns=0; + decltype(m_aOutlineMarkPoss)::size_type nIns=0; while( nIns < m_aOutlineMarkPoss.size() && m_aOutlineMarkPoss[nIns] < nIdx ) nIns++; diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 979481f8440f..6560e5fea912 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -1100,7 +1100,7 @@ void SwHTMLWriter::OutBookmarks() pBookmark = (pMarkAccess->getAllMarksBegin() + m_nBkmkTabPos)->get(); } - sal_uInt32 nPos; + decltype(m_aOutlineMarkPoss)::size_type nPos; for( nPos = 0; nPos < m_aOutlineMarkPoss.size() && m_aOutlineMarkPoss[nPos] < nNode; nPos++ ) ; diff --git a/sw/source/uibase/app/mainwn.cxx b/sw/source/uibase/app/mainwn.cxx index a1968cf4b4bc..e37faf434c24 100644 --- a/sw/source/uibase/app/mainwn.cxx +++ b/sw/source/uibase/app/mainwn.cxx @@ -89,7 +89,7 @@ void EndProgress( SwDocShell *pDocShell ) if( pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave() ) { SwProgress *pProgress = nullptr; - sal_uInt16 i; + std::vector<SwProgress *>::size_type i; for ( i = 0; i < pProgressContainer->size(); ++i ) { SwProgress *pTmp = (*pProgressContainer)[i]; diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index f6e01c2bf324..385e3eb17bb0 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -493,8 +493,8 @@ OUString SwAddressPreview::FillData( //find the appropriate assignment OUString sConvertedColumn = aItem.sText; - for(sal_uInt16 nColumn = 0; - nColumn < rDefHeaders.Count() && nColumn < aAssignment.getLength(); + for(sal_uInt32 nColumn = 0; + nColumn < rDefHeaders.Count() && nColumn < sal_uInt32(aAssignment.getLength()); ++nColumn) { if (rDefHeaders.GetString(nColumn).equals(aItem.sText) && diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx index 054f5f4ff8b3..1e2648bdbb13 100644 --- a/sw/source/uibase/dbui/mmconfigitem.cxx +++ b/sw/source/uibase/dbui/mmconfigitem.cxx @@ -1237,8 +1237,8 @@ bool SwMailMergeConfigItem::IsAddressFieldsAssigned() const if(aItem.bIsColumn) { OUString sConvertedColumn = aItem.sText; - for(sal_uInt16 nColumn = 0; - nColumn < rHeaders.Count() && nColumn < aAssignment.getLength(); + for(sal_uInt32 nColumn = 0; + nColumn < rHeaders.Count() && nColumn < sal_uInt32(aAssignment.getLength()); ++nColumn) { if (rHeaders.GetString(nColumn).equals(aItem.sText) && @@ -1296,8 +1296,8 @@ bool SwMailMergeConfigItem::IsGreetingFieldsAssigned() const if(aItem.bIsColumn) { OUString sConvertedColumn = aItem.sText; - for(sal_uInt16 nColumn = 0; - nColumn < rHeaders.Count() && nColumn < aAssignment.getLength(); + for(sal_uInt32 nColumn = 0; + nColumn < rHeaders.Count() && nColumn < sal_uInt32(aAssignment.getLength()); ++nColumn) { if (rHeaders.GetString(nColumn).equals(aItem.sText) && diff --git a/sw/source/uibase/ribbar/concustomshape.cxx b/sw/source/uibase/ribbar/concustomshape.cxx index 42e31d9c0361..755eb8074da3 100644 --- a/sw/source/uibase/ribbar/concustomshape.cxx +++ b/sw/source/uibase/ribbar/concustomshape.cxx @@ -114,8 +114,7 @@ void ConstCustomShape::SetAttributes( SdrObject* pObj ) std::vector< OUString > aObjList; if ( GalleryExplorer::FillObjListTitle( GALLERY_THEME_POWERPOINT, aObjList ) ) { - sal_uInt16 i; - for ( i = 0; i < aObjList.size(); i++ ) + for ( std::vector<OUString>::size_type i = 0; i < aObjList.size(); i++ ) { if ( aObjList[ i ].equalsIgnoreAsciiCase( aCustomShape ) ) { |