summaryrefslogtreecommitdiff
path: root/vcl/source/edit/texteng.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-05-27 16:33:44 +0200
committerNoel Grandin <noel@peralex.com>2015-05-28 12:49:54 +0200
commitd5129a9dd68978f9eccdd4597b5b6834557c422a (patch)
treedf43250172f784f3048ce42ce1c3410d1d449c1e /vcl/source/edit/texteng.cxx
parentf3331f7694e74f349375c223ce7ed84838e92d89 (diff)
new clang plugin: loopvartoosmall
Idea from bubli - look for loops where the index variable is of such size that it cannot cover the range revealed by examining the length part of the condition. So far, I have only run the plugin up till the VCL module. Also the plugin deliberately excludes anything more complicated than a straightforward incrementing for loop. Change-Id: Ifced18b01c03ea537c64168465ce0b8287a42015
Diffstat (limited to 'vcl/source/edit/texteng.cxx')
-rw-r--r--vcl/source/edit/texteng.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index bde1b0ffb3d7..acbe1c56ed2d 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -430,7 +430,7 @@ void TextEngine::ImpRemoveText()
TextPaM aStartPaM( 0, 0 );
TextSelection aEmptySel( aStartPaM, aStartPaM );
- for ( sal_uInt16 nView = 0; nView < mpViews->size(); nView++ )
+ for ( size_t nView = 0; nView < mpViews->size(); nView++ )
{
TextView* pView = (*mpViews)[ nView ];
pView->ImpSetSelection( aEmptySel );
@@ -453,7 +453,7 @@ void TextEngine::SetText( const OUString& rText )
if ( !rText.isEmpty() )
aPaM = ImpInsertText( aEmptySel, rText );
- for ( sal_uInt16 nView = 0; nView < mpViews->size(); nView++ )
+ for ( size_t nView = 0; nView < mpViews->size(); nView++ )
{
TextView* pView = (*mpViews)[ nView ];
pView->ImpSetSelection( aEmptySel );
@@ -898,7 +898,7 @@ Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bP
long nY = 0;
sal_uInt16 nCurIndex = 0;
TextLine* pLine = 0;
- for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().size(); nLine++ )
+ for ( size_t nLine = 0; nLine < pPortion->GetLines().size(); nLine++ )
{
TextLine& pTmpLine = pPortion->GetLines()[ nLine ];
if ( ( pTmpLine.GetStart() == rPaM.GetIndex() ) || ( pTmpLine.IsIn( rPaM.GetIndex(), bSpecial ) ) )
@@ -1482,7 +1482,7 @@ void TextEngine::UpdateViews( TextView* pCurView )
DBG_ASSERT( IsFormatted(), "UpdateViews: Doc not formatted!" );
- for ( sal_uInt16 nView = 0; nView < mpViews->size(); nView++ )
+ for ( size_t nView = 0; nView < mpViews->size(); nView++ )
{
TextView* pView = (*mpViews)[ nView ];
pView->HideCursor();
@@ -1769,7 +1769,7 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos )
if ( mpIMEInfos && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetPara() == nPara ) )
{
sal_uInt16 nLastAttr = 0xFFFF;
- for( sal_uInt16 n = 0; n < mpIMEInfos->nLen; n++ )
+ for( sal_Int32 n = 0; n < mpIMEInfos->nLen; n++ )
{
if ( mpIMEInfos->pAttribs[n] != nLastAttr )
{
@@ -2936,7 +2936,7 @@ void TextEngine::ImpInitWritingDirections( sal_uLong nPara )
int32_t nEnd;
UBiDiLevel nCurrDir;
- for ( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
+ for ( long nIdx = 0; nIdx < nCount; ++nIdx )
{
ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir );
rInfos.push_back( TEWritingDirectionInfo( nCurrDir, (sal_uInt16)nStart, (sal_uInt16)nEnd ) );