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 /svl | |
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 'svl')
-rw-r--r-- | svl/source/items/aeitem.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/ilstitem.cxx | 2 | ||||
-rw-r--r-- | svl/source/items/itempool.cxx | 2 | ||||
-rw-r--r-- | svl/source/notify/lstner.cxx | 4 |
4 files changed, 5 insertions, 5 deletions
diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx index 09356f2041d4..b5896c5af304 100644 --- a/svl/source/items/aeitem.cxx +++ b/svl/source/items/aeitem.cxx @@ -111,7 +111,7 @@ SfxAllEnumItem::SfxAllEnumItem(const SfxAllEnumItem &rCopy): pValues = new SfxAllEnumValueArr; - for ( sal_uInt16 nPos = 0; nPos < rCopy.pValues->size(); ++nPos ) + for ( size_t nPos = 0; nPos < rCopy.pValues->size(); ++nPos ) { SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl; pVal->nValue = (*rCopy.pValues)[nPos].nValue; diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx index de869ae63416..140e3b857314 100644 --- a/svl/source/items/ilstitem.cxx +++ b/svl/source/items/ilstitem.cxx @@ -34,7 +34,7 @@ SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const ::std::vector < : SfxPoolItem( which ) { m_aList.realloc( rList.size() ); - for ( sal_uInt16 n=0; n<rList.size(); ++n ) + for ( size_t n=0; n<rList.size(); ++n ) m_aList[n] = rList[n]; } diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 8f4a860af519..019ab6f7f249 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -778,7 +778,7 @@ void SfxPoolItemArray_Impl::ReHash() maFree.clear(); maHash.clear(); - for (sal_uInt32 nIdx = 0; nIdx < size(); ++nIdx) + for (size_t nIdx = 0; nIdx < size(); ++nIdx) { SfxPoolItem *pItem = (*this)[nIdx]; if (!pItem) diff --git a/svl/source/notify/lstner.cxx b/svl/source/notify/lstner.cxx index 4c3dc073f3ab..b7b338767a5e 100644 --- a/svl/source/notify/lstner.cxx +++ b/svl/source/notify/lstner.cxx @@ -45,7 +45,7 @@ SfxListener::SfxListener() : mpImpl(new Impl) SfxListener::SfxListener( const SfxListener &rListener ) : mpImpl(new Impl) { - for ( sal_uInt16 n = 0; n < rListener.mpImpl->maBCs.size(); ++n ) + for ( size_t n = 0; n < rListener.mpImpl->maBCs.size(); ++n ) StartListening( *rListener.mpImpl->maBCs[n] ); } @@ -54,7 +54,7 @@ SfxListener::SfxListener( const SfxListener &rListener ) : mpImpl(new Impl) SfxListener::~SfxListener() { // unregister at all remaining broadcasters - for ( sal_uInt16 nPos = 0; nPos < mpImpl->maBCs.size(); ++nPos ) + for ( size_t nPos = 0; nPos < mpImpl->maBCs.size(); ++nPos ) { SfxBroadcaster *pBC = mpImpl->maBCs[nPos]; pBC->RemoveListener(*this); |