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/source/gdi/image.cxx | |
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/source/gdi/image.cxx')
-rw-r--r-- | vcl/source/gdi/image.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
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()) |