diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-27 16:33:44 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-05-28 12:49:54 +0200 |
commit | d5129a9dd68978f9eccdd4597b5b6834557c422a (patch) | |
tree | df43250172f784f3048ce42ce1c3410d1d449c1e /vcl | |
parent | f3331f7694e74f349375c223ce7ed84838e92d89 (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')
-rw-r--r-- | vcl/generic/print/prtsetup.cxx | 2 | ||||
-rw-r--r-- | vcl/source/bitmap/BitmapFilterStackBlur.cxx | 4 | ||||
-rw-r--r-- | vcl/source/bitmap/bitmapscalesuper.cxx | 20 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 2 | ||||
-rw-r--r-- | vcl/source/edit/textdata.cxx | 4 | ||||
-rw-r--r-- | vcl/source/edit/texteng.cxx | 12 | ||||
-rw-r--r-- | vcl/source/filter/wmf/winmtf.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/wmf/winwmf.cxx | 4 | ||||
-rw-r--r-- | vcl/source/filter/wmf/wmfwr.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/bitmap.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/bitmap4.cxx | 8 | ||||
-rw-r--r-- | vcl/source/gdi/bitmapex.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/image.cxx | 10 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 16 | ||||
-rw-r--r-- | vcl/source/gdi/pngread.cxx | 28 | ||||
-rw-r--r-- | vcl/source/gdi/pngwrite.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/print.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/region.cxx | 4 | ||||
-rw-r--r-- | vcl/source/opengl/OpenGLHelper.cxx | 4 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/splitwin.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/x11windowprovider.cxx | 2 |
22 files changed, 75 insertions, 75 deletions
diff --git a/vcl/generic/print/prtsetup.cxx b/vcl/generic/print/prtsetup.cxx index 738d00de721a..9d74f048ae3a 100644 --- a/vcl/generic/print/prtsetup.cxx +++ b/vcl/generic/print/prtsetup.cxx @@ -341,7 +341,7 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent ) m_pLevelBox->SetEntryData(0, m_pLevelBox->GetEntryData(1)); m_pLevelBox->RemoveEntry(1); - for( sal_uInt16 i = 0; i < m_pLevelBox->GetEntryCount(); i++ ) + for( sal_Int32 i = 0; i < m_pLevelBox->GetEntryCount(); i++ ) { if( reinterpret_cast<sal_uLong>(m_pLevelBox->GetEntryData( i )) == nLevelEntryData ) { diff --git a/vcl/source/bitmap/BitmapFilterStackBlur.cxx b/vcl/source/bitmap/BitmapFilterStackBlur.cxx index 975f3ad0fa00..4358f2b90fb7 100644 --- a/vcl/source/bitmap/BitmapFilterStackBlur.cxx +++ b/vcl/source/bitmap/BitmapFilterStackBlur.cxx @@ -492,9 +492,9 @@ void centerExtendBitmap(Bitmap& rBitmap, sal_Int32 nExtendSize, Color aColor) long nWidthBorder = nExtendSize + rSize.Width(); long nHeightBorder = nExtendSize + rSize.Height(); - for (int y = 0; y < aNewSize.Height(); y++) + for (long y = 0; y < aNewSize.Height(); y++) { - for (int x = 0; x < aNewSize.Width(); x++) + for (long x = 0; x < aNewSize.Width(); x++) { if (y < nExtendSize || y >= nHeightBorder || x < nExtendSize || x >= nWidthBorder) diff --git a/vcl/source/bitmap/bitmapscalesuper.cxx b/vcl/source/bitmap/bitmapscalesuper.cxx index 2172aa53c0de..b19930409935 100644 --- a/vcl/source/bitmap/bitmapscalesuper.cxx +++ b/vcl/source/bitmap/bitmapscalesuper.cxx @@ -327,7 +327,7 @@ void scalePallete8bit2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumB = 0; long nTotalWeightY = 0; - for(int i = 0; i<= nLineRange; i++) + for(long i = 0; i<= nLineRange; i++) { Scanline pTmpY = rCtx.mpSrc->GetScanline( nLineStart + i ); long nSumRowR = 0; @@ -335,7 +335,7 @@ void scalePallete8bit2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumRowB = 0; long nTotalWeightX = 0; - for(int j = 0; j <= nRowRange; j++) + for(long j = 0; j <= nRowRange; j++) { const BitmapColor& rCol = rCtx.mpSrc->GetPaletteColor( pTmpY[ nRowStart + j ] ); @@ -451,14 +451,14 @@ void scalePalleteGeneral2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumB = 0; long nTotalWeightY = 0; - for(int i = 0; i<= nLineRange; i++) + for(long i = 0; i<= nLineRange; i++) { long nSumRowR = 0; long nSumRowG = 0; long nSumRowB = 0; long nTotalWeightX = 0; - for(int j = 0; j <= nRowRange; j++) + for(long j = 0; j <= nRowRange; j++) { BitmapColor aCol0 = rCtx.mpSrc->GetPaletteColor ( rCtx.mpSrc->GetPixelIndex( nLineStart + i, nRowStart + j ) ); @@ -580,7 +580,7 @@ void scale24bitBGR2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumB = 0; long nTotalWeightY = 0; - for(int i = 0; i<= nLineRange; i++) + for(long i = 0; i<= nLineRange; i++) { Scanline pTmpY = rCtx.mpSrc->GetScanline( nLineStart + i ); Scanline pTmpX = pTmpY + 3L * nRowStart; @@ -589,7 +589,7 @@ void scale24bitBGR2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumRowB = 0; long nTotalWeightX = 0; - for(int j = 0; j <= nRowRange; j++) + for(long j = 0; j <= nRowRange; j++) { if(nX == nEndX ) { @@ -701,7 +701,7 @@ void scale24bitRGB2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumB = 0; long nTotalWeightY = 0; - for(int i = 0; i<= nLineRange; i++) + for(long i = 0; i<= nLineRange; i++) { Scanline pTmpY = rCtx.mpSrc->GetScanline( nLineStart + i ); Scanline pTmpX = pTmpY + 3L * nRowStart; @@ -710,7 +710,7 @@ void scale24bitRGB2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumRowB = 0; long nTotalWeightX = 0; - for(int j = 0; j <= nRowRange; j++) + for(long j = 0; j <= nRowRange; j++) { if(nX == nEndX ) { @@ -822,14 +822,14 @@ void scaleNonPalleteGeneral2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumB = 0; long nTotalWeightY = 0; - for(int i = 0; i<= nLineRange; i++) + for(long i = 0; i<= nLineRange; i++) { long nSumRowR = 0; long nSumRowG = 0; long nSumRowB = 0; long nTotalWeightX = 0; - for(int j = 0; j <= nRowRange; j++) + for(long j = 0; j <= nRowRange; j++) { BitmapColor aCol0 = rCtx.mpSrc->GetPixel( nLineStart + i, nRowStart + j ); diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 9ff20ba8b47e..05eb6054b62f 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -2361,7 +2361,7 @@ TextFilter::~TextFilter() OUString TextFilter::filter(const OUString &rText) { OUString sTemp(rText); - for (sal_uInt16 i = 0; i < sForbiddenChars.getLength(); ++i) + for (sal_Int32 i = 0; i < sForbiddenChars.getLength(); ++i) { sTemp = comphelper::string::remove(sTemp, sForbiddenChars[i]); } diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx index 30eb44e05f28..80d1680d14e5 100644 --- a/vcl/source/edit/textdata.cxx +++ b/vcl/source/edit/textdata.cxx @@ -74,7 +74,7 @@ sal_uInt16 TETextPortionList::FindPortion( sal_uInt16 nCharPos, sal_uInt16& nPor { // find left portion at nCharPos at portion border sal_uInt16 nTmpPos = 0; - for ( sal_uInt16 nPortion = 0; nPortion < size(); nPortion++ ) + for ( size_t nPortion = 0; nPortion < size(); nPortion++ ) { TETextPortion* pPortion = operator[]( nPortion ); nTmpPos = nTmpPos + pPortion->GetLen(); @@ -161,7 +161,7 @@ void TEParaPortion::MarkSelectionInvalid( sal_uInt16 nStart, sal_uInt16 /*nEnd*/ sal_uInt16 TEParaPortion::GetLineNumber( sal_uInt16 nChar, bool bInclEnd ) { - for ( sal_uInt16 nLine = 0; nLine < maLines.size(); nLine++ ) + for ( size_t nLine = 0; nLine < maLines.size(); nLine++ ) { TextLine& pLine = maLines[ nLine ]; if ( ( bInclEnd && ( pLine.GetEnd() >= nChar ) ) || 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 ) ); diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx index f14f9345ffc7..c77088989a16 100644 --- a/vcl/source/filter/wmf/winmtf.cxx +++ b/vcl/source/filter/wmf/winmtf.cxx @@ -867,7 +867,7 @@ WinMtfOutput::~WinMtfOutput() else mpGDIMetaFile->SetPrefSize( mrclFrame.GetSize() ); - for ( sal_uInt32 i = 0; i < vGDIObj.size(); i++ ) + for ( size_t i = 0; i < vGDIObj.size(); i++ ) delete vGDIObj[ i ]; } diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx index c7d131586c92..028e7fc675d3 100644 --- a/vcl/source/filter/wmf/winwmf.cxx +++ b/vcl/source/filter/wmf/winwmf.cxx @@ -745,9 +745,9 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) pBmp = aBmp.AcquireReadAccess(); if ( pBmp ) { - for ( sal_Int32 y = 0; y < pBmp->Height(); y++ ) + for ( long y = 0; y < pBmp->Height(); y++ ) { - for ( sal_Int32 x = 0; x < pBmp->Width(); x++ ) + for ( long x = 0; x < pBmp->Width(); x++ ) { const BitmapColor aColor( pBmp->GetColor( y, x ) ); diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx index 83b98ce7f454..ca3f77f9aa63 100644 --- a/vcl/source/filter/wmf/wmfwr.cxx +++ b/vcl/source/filter/wmf/wmfwr.cxx @@ -570,11 +570,11 @@ void WMFWriter::TrueExtTextOut( const Point& rPoint, const OUString& rString, boost::scoped_array<sal_Int16> pConvertedDXAry(new sal_Int16[ nOriginalTextLen ]); sal_Int32 j = 0; pConvertedDXAry[ j++ ] = (sal_Int16)ScaleWidth( pDXAry[ 0 ] ); - for (sal_uInt16 i = 1; i < ( nOriginalTextLen - 1 ); ++i) + for (sal_Int32 i = 1; i < ( nOriginalTextLen - 1 ); ++i) pConvertedDXAry[ j++ ] = (sal_Int16)ScaleWidth( pDXAry[ i ] - pDXAry[ i - 1 ] ); pConvertedDXAry[ j ] = (sal_Int16)ScaleWidth( pDXAry[ nOriginalTextLen - 2 ] / ( nOriginalTextLen - 1 ) ); - for (sal_uInt16 i = 0; i < nOriginalTextLen; ++i) + for (sal_Int32 i = 0; i < nOriginalTextLen; ++i) { sal_Int16 nDx = pConvertedDXAry[ i ]; pWMF->WriteInt16( nDx ); diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index 51e5db80924f..db5c1e9ba7d5 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -1435,7 +1435,7 @@ vcl::Region Bitmap::CreateRegion( const Color& rColor, const Rectangle& rRect ) aSubRect.Top() = nYStart; aSubRect.Bottom() = nY ? nY - 1 : 0; - for(sal_uInt32 a(0); a < aLine.size();) + for(size_t a(0); a < aLine.size();) { aSubRect.Left() = aLine[a++]; aSubRect.Right() = aLine[a++]; @@ -1458,7 +1458,7 @@ vcl::Region Bitmap::CreateRegion( const Color& rColor, const Rectangle& rRect ) aSubRect.Top() = nYStart; aSubRect.Bottom() = nY ? nY - 1 : 0; - for(sal_uInt32 a(0); a < aLine.size();) + for(size_t a(0); a < aLine.size();) { aSubRect.Left() = aLine[a++]; aSubRect.Right() = aLine[a++]; diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx index 42ac92d0b859..24a4b08251e7 100644 --- a/vcl/source/gdi/bitmap4.cxx +++ b/vcl/source/gdi/bitmap4.cxx @@ -1160,9 +1160,9 @@ bool Bitmap::ImplSeparableUnsharpenFilter(const double radius) { BitmapColor aColor, aColorBlur; // For all pixels in original image subtract pixels values from blurred image - for( int x = 0; x < nWidth; x++ ) + for( long x = 0; x < nWidth; x++ ) { - for( int y = 0; y < nHeight; y++ ) + for( long y = 0; y < nHeight; y++ ) { aColorBlur = pReadAccBlur->GetColor( y , x ); aColor = pReadAcc->GetColor( y , x ); @@ -1194,9 +1194,9 @@ bool Bitmap::ImplDuotoneFilter( const sal_uLong nColorOne, const sal_uLong nColo const BitmapColor aColorOne( static_cast< sal_uInt8 >( nColorOne >> 16 ), static_cast< sal_uInt8 >( nColorOne >> 8 ), static_cast< sal_uInt8 >( nColorOne ) ); const BitmapColor aColorTwo( static_cast< sal_uInt8 >( nColorTwo >> 16 ), static_cast< sal_uInt8 >( nColorTwo >> 8 ), static_cast< sal_uInt8 >( nColorTwo ) ); - for( int x = 0; x < nWidth; x++ ) + for( long x = 0; x < nWidth; x++ ) { - for( int y = 0; y < nHeight; y++ ) + for( long y = 0; y < nHeight; y++ ) { BitmapColor aColor = pReadAcc->GetColor( y, x ); sal_uInt8 luminance = aColor.GetLuminance(); diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index e6fa951a0927..5b0567a0cb38 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -855,9 +855,9 @@ namespace const Size aDestinationSizePixel(aDestination.GetSizePixel()); const BitmapColor aOutside(BitmapColor(0xff, 0xff, 0xff)); - for(sal_Int32 y(0L); y < aDestinationSizePixel.getHeight(); y++) + for(long y(0L); y < aDestinationSizePixel.getHeight(); y++) { - for(sal_Int32 x(0L); x < aDestinationSizePixel.getWidth(); x++) + for(long x(0L); x < aDestinationSizePixel.getWidth(); x++) { const basegfx::B2DPoint aSourceCoor(rTransform * basegfx::B2DPoint(x, y)); diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index c57c53bb4f9b..aceb2524364e 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -341,7 +341,7 @@ ImageList::ImageList( const ::std::vector< OUString >& rNameVector, ImplInit( sal::static_int_cast< sal_uInt16 >( rNameVector.size() ), Size() ); mpImplData->maPrefix = rPrefix; - for( sal_uInt32 i = 0; i < rNameVector.size(); ++i ) + for( size_t i = 0; i < rNameVector.size(); ++i ) { mpImplData->AddImage( rNameVector[ i ], static_cast< sal_uInt16 >( i ) + 1, BitmapEx() ); } @@ -515,7 +515,7 @@ void ImageList::ReplaceImage( const OUString& rImageName, const Image& rImage ) void ImageList::RemoveImage( sal_uInt16 nId ) { - for( sal_uInt32 i = 0; i < mpImplData->maImages.size(); ++i ) + for( size_t i = 0; i < mpImplData->maImages.size(); ++i ) { if( mpImplData->maImages[ i ]->mnId == nId ) { @@ -585,7 +585,7 @@ sal_uInt16 ImageList::GetImagePos( sal_uInt16 nId ) const if( mpImplData && nId ) { - for( sal_uInt32 i = 0; i < mpImplData->maImages.size(); ++i ) + for( size_t i = 0; i < mpImplData->maImages.size(); ++i ) { if (mpImplData->maImages[ i ]->mnId == nId) return static_cast< sal_uInt16 >( i ); @@ -605,7 +605,7 @@ sal_uInt16 ImageList::GetImagePos( const OUString& rImageName ) const if( mpImplData && !rImageName.isEmpty() ) { - for( sal_uInt32 i = 0; i < mpImplData->maImages.size(); i++ ) + for( size_t i = 0; i < mpImplData->maImages.size(); i++ ) { if (mpImplData->maImages[i]->maName == rImageName) return static_cast< sal_uInt16 >( i ); @@ -641,7 +641,7 @@ void ImageList::GetImageNames( ::std::vector< OUString >& rNames ) const if( mpImplData ) { - for( sal_uInt32 i = 0; i < mpImplData->maImages.size(); i++ ) + for( size_t i = 0; i < mpImplData->maImages.size(); i++ ) { const OUString& rName( mpImplData->maImages[ i ]->maName ); if( !rName.isEmpty()) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 37ab711f393d..fe1b8330ffb8 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1359,7 +1359,7 @@ bool PDFWriterImpl::PDFPage::emit(sal_Int32 nParentObject ) unsigned int nStreamObjects = m_aStreamObjects.size(); if( nStreamObjects > 1 ) aLine.append( '[' ); - for( unsigned int i = 0; i < m_aStreamObjects.size(); i++ ) + for( size_t i = 0; i < m_aStreamObjects.size(); i++ ) { aLine.append( ' ' ); aLine.append( m_aStreamObjects[i] ); @@ -5394,7 +5394,7 @@ bool PDFWriterImpl::emitWidgetAnnotations() if( rWidget.m_nFlags & 0x200000 ) // multiselect { aValue.append( "[" ); - for( unsigned int i = 0; i < rWidget.m_aSelectedEntries.size(); i++ ) + for( size_t i = 0; i < rWidget.m_aSelectedEntries.size(); i++ ) { sal_Int32 nEntry = rWidget.m_aSelectedEntries[i]; if( nEntry >= 0 && nEntry < sal_Int32(rWidget.m_aListEntries.size()) ) @@ -5441,7 +5441,7 @@ bool PDFWriterImpl::emitWidgetAnnotations() if( rWidget.m_aKids.size() ) { aLine.append( "/Kids[" ); - for( unsigned int i = 0; i < rWidget.m_aKids.size(); i++ ) + for( size_t i = 0; i < rWidget.m_aKids.size(); i++ ) { aLine.append( rWidget.m_aKids[i] ); aLine.append( " 0 R" ); @@ -8138,7 +8138,7 @@ bool PDFWriterImpl::emitTrailer() if( m_aAdditionalStreams.size() > 0 ) { aLine.append( "/AdditionalStreams [" ); - for( unsigned int i = 0; i < m_aAdditionalStreams.size(); i++ ) + for( size_t i = 0; i < m_aAdditionalStreams.size(); i++ ) { aLine.append( "/" ); appendName( m_aAdditionalStreams[i].m_aMimeType, aLine ); @@ -11028,7 +11028,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) default: for( int y = aSize.Height()-1; y >= 0; y-- ) { - for( int x = 0; x < aSize.Width(); x++ ) + for( long x = 0; x < aSize.Width(); x++ ) { BitmapColor aColor = pAccess->GetColor( y, x ); aCol[0] = aColor.GetRed(); @@ -11454,7 +11454,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) { const int nScanLineBytes = 1 + ( pAccess->GetBitCount() * ( pAccess->Width() - 1 ) / 8U ); - for( int i = 0; i < pAccess->Height(); i++ ) + for( long i = 0; i < pAccess->Height(); i++ ) { CHECK_RETURN( writeBuffer( pAccess->GetScanline( i ), nScanLineBytes ) ); } @@ -11463,9 +11463,9 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) { const int nScanLineBytes = pAccess->Width()*3; boost::shared_array<sal_uInt8> pCol( new sal_uInt8[ nScanLineBytes ] ); - for( int y = 0; y < pAccess->Height(); y++ ) + for( long y = 0; y < pAccess->Height(); y++ ) { - for( int x = 0; x < pAccess->Width(); x++ ) + for( long x = 0; x < pAccess->Width(); x++ ) { BitmapColor aColor = pAccess->GetColor( y, x ); pCol[3*x+0] = aColor.GetRed(); diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index d9352a79202c..c33ea387fcd3 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -1268,12 +1268,12 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) { if ( mnPngDepth == 8 ) // maybe the source is a 16 bit grayscale { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 ) ImplSetAlphaPixel( nY, nX, pTmp[ 0 ], pTmp[ 1 ] ); } else { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 ) ImplSetAlphaPixel( nY, nX, pTmp[ 0 ], pTmp[ 2 ] ); } } @@ -1281,12 +1281,12 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) { if ( mnPngDepth == 8 ) // maybe the source is a 16 bit grayscale { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp++ ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp++ ) ImplSetAlphaPixel( nY, nX, *pTmp, mpTransTab[ *pTmp ] ); } else { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 ) ImplSetAlphaPixel( nY, nX, *pTmp, mpTransTab[ *pTmp ] ); } } @@ -1302,13 +1302,13 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) } else { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd ) ImplSetPixel( nY, nX, *pTmp++ ); } } else { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 ) ImplSetPixel( nY, nX, *pTmp ); } } @@ -1365,7 +1365,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) sal_uInt8* pScanline(mpScanline); sal_uInt8* pScanlineAlpha(mpScanlineAlpha); - for (sal_Int32 nX(0); nX < maOrigSize.Width(); nX++, pTmp += 4) + for (long nX(0); nX < maOrigSize.Width(); nX++, pTmp += 4) { // prepare content line as BGR by reordering when copying // do not forget to invert alpha (source is alpha, target is opacity) @@ -1392,7 +1392,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) } else { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 ) { if(bCustomColorTable) { @@ -1422,7 +1422,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) else { // BMP_FORMAT_64BIT_TC_RGBA - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 8 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 8 ) { ImplSetAlphaPixel( nY, @@ -1441,7 +1441,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) // no support currently for DirectScanline, found no real usages in current PNGs, may be added on demand if ( mnPngDepth == 8 ) // maybe the source has 16 bit per sample { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 ) { sal_uInt8 nRed = pTmp[ 0 ]; sal_uInt8 nGreen = pTmp[ 1 ]; @@ -1458,7 +1458,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) else { // BMP_FORMAT_48BIT_TC_RGB - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 ) { sal_uInt8 nRed = pTmp[ 0 ]; sal_uInt8 nGreen = pTmp[ 2 ]; @@ -1498,7 +1498,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) OSL_ENSURE(mnAllocSizeScanline >= maOrigSize.Width() * 3, "Allocated Scanline too small (!)"); sal_uInt8* pScanline(mpScanline); - for (sal_Int32 nX(0); nX < maOrigSize.Width(); nX++, pTmp += 3) + for (long nX(0); nX < maOrigSize.Width(); nX++, pTmp += 3) { // prepare content line as BGR by reordering when copying if(bCustomColorTable) @@ -1521,7 +1521,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) } else { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 ) { if(bCustomColorTable) { @@ -1550,7 +1550,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) { // BMP_FORMAT_48BIT_TC_RGB // no support currently for DirectScanline, found no real usages in current PNGs, may be added on demand - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 ) { ImplSetPixel( nY, diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx index d3ee25fbeff9..01ff6fe5be9b 100644 --- a/vcl/source/gdi/pngwrite.cxx +++ b/vcl/source/gdi/pngwrite.cxx @@ -334,7 +334,7 @@ void PNGWriterImpl::ImplWritePalette() ImplOpenChunk(PNGCHUNK_PLTE); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( sal_uLong i = 0; i < nCount; i++ ) { const BitmapColor& rColor = mpAccess->GetPaletteColor(i); *pTmp++ = rColor.GetRed(); diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 16d3d9980af7..e5de8298cdf1 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -431,7 +431,7 @@ SalPrinterQueueInfo::~SalPrinterQueueInfo() ImplPrnQueueList::~ImplPrnQueueList() { ImplSVData* pSVData = ImplGetSVData(); - for( unsigned int i = 0; i < m_aQueueInfos.size(); i++ ) + for( size_t i = 0; i < m_aQueueInfos.size(); i++ ) { delete m_aQueueInfos[i].mpQueueInfo; pSVData->mpDefInst->DeletePrinterQueueInfo( m_aQueueInfos[i].mpSalQueueInfo ); @@ -908,7 +908,7 @@ SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const OUString& rPrinterName, return pInfo->mpSalQueueInfo; // then search case insensitive - for( unsigned int i = 0; i < pPrnList->m_aQueueInfos.size(); i++ ) + for( size_t i = 0; i < pPrnList->m_aQueueInfos.size(); i++ ) { if( pPrnList->m_aQueueInfos[i].mpSalQueueInfo->maPrinterName.equalsIgnoreAsciiCase( rPrinterName ) ) return pPrnList->m_aQueueInfos[i].mpSalQueueInfo; @@ -917,7 +917,7 @@ SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const OUString& rPrinterName, // then search for driver name if ( pDriver ) { - for( unsigned int i = 0; i < pPrnList->m_aQueueInfos.size(); i++ ) + for( size_t i = 0; i < pPrnList->m_aQueueInfos.size(); i++ ) { if( pPrnList->m_aQueueInfos[i].mpSalQueueInfo->maDriver == *pDriver ) return pPrnList->m_aQueueInfos[i].mpSalQueueInfo; diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 086739a62fff..1543d83d6e81 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -1774,7 +1774,7 @@ vcl::Region vcl::Region::GetRegionFromPolyPolygon( const tools::PolyPolygon& rPo int nPolygonRects = 0, nPolygonPolygons = 0; int nPolygons = rPolyPoly.Count(); - for( sal_uInt16 i = 0; i < nPolygons; i++ ) + for( int i = 0; i < nPolygons; i++ ) { const Polygon& rPoly = rPolyPoly[i]; @@ -1796,7 +1796,7 @@ vcl::Region vcl::Region::GetRegionFromPolyPolygon( const tools::PolyPolygon& rPo vcl::Region aResult; Rectangle aRect; - for( sal_uInt16 i = 0; i < nPolygons; i++ ) + for( int i = 0; i < nPolygons; i++ ) { const Polygon& rPoly = rPolyPoly[i]; diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index 3acb0c667a94..33cea5c7189b 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -231,11 +231,11 @@ BitmapEx OpenGLHelper::ConvertBGRABufferToBitmapEx(const sal_uInt8* const pBuffe AlphaMask::ScopedWriteAccess pAlphaWriteAccess( aAlpha ); size_t nCurPos = 0; - for( int y = 0; y < nHeight; ++y) + for( long y = 0; y < nHeight; ++y) { Scanline pScan = pWriteAccess->GetScanline(y); Scanline pAlphaScan = pAlphaWriteAccess->GetScanline(y); - for( int x = 0; x < nWidth; ++x ) + for( long x = 0; x < nWidth; ++x ) { *pScan++ = pBuffer[nCurPos]; *pScan++ = pBuffer[nCurPos+1]; diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 5c1749fefda8..15e59bf6cd83 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -689,7 +689,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, } } #ifdef DBG_UTIL - for ( sal_uInt16 nL = 0; nL < rLineInfo.Count(); nL++ ) + for ( sal_Int32 nL = 0; nL < rLineInfo.Count(); nL++ ) { ImplTextLineInfo* pLine = rLineInfo.GetLine( nL ); OUString aLine = rStr.copy( pLine->GetIndex(), pLine->GetLen() ); diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index ceaa757dda0c..fa18d3d01eb5 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -2421,7 +2421,7 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) { ImplSplitItems& pItems = mpSplitSet->mpItems; size_t nItems = pItems.size(); - for ( sal_uInt16 i = 0; i < nItems; i++ ) + for ( size_t i = 0; i < nItems; i++ ) { pItems[i]->mnSize = mpLastSizes[i*2]; pItems[i]->mnPixSize = mpLastSizes[i*2+1]; @@ -2807,7 +2807,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, // calculate area, which could be affected by splitting sal_uInt16 nMin = 0; sal_uInt16 nMax = nItems; - for (sal_uInt16 i = 0; i < nItems; ++i) + for (size_t i = 0; i < nItems; ++i) { if ( pItems[i]->mbFixed ) { @@ -3140,7 +3140,7 @@ sal_uInt16 SplitWindow::GetItemPos( sal_uInt16 nId, sal_uInt16 nSetId ) const if ( pSet ) { - for ( sal_uInt16 i = 0; i < pSet->mpItems.size(); i++ ) + for ( size_t i = 0; i < pSet->mpItems.size(); i++ ) { if ( pSet->mpItems[i]->mnId == nId ) { diff --git a/vcl/unx/generic/gdi/x11windowprovider.cxx b/vcl/unx/generic/gdi/x11windowprovider.cxx index 03a7adfe18de..ec1cb09a074b 100644 --- a/vcl/unx/generic/gdi/x11windowprovider.cxx +++ b/vcl/unx/generic/gdi/x11windowprovider.cxx @@ -32,7 +32,7 @@ Display *OpenX11Display(OString& rDisplay) sal_uInt32 nParams = osl_getCommandArgCount(); OUString aParam; - for (sal_uInt16 i=0; i<nParams; i++) + for (sal_uInt32 i=0; i<nParams; i++) { osl_getCommandArg(i, &aParam.pData); if ( aParam == "-display" ) |