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 /sot | |
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 'sot')
-rw-r--r-- | sot/source/sdstor/stgstrms.cxx | 6 | ||||
-rw-r--r-- | sot/source/unoolestorage/xolesimplestorage.cxx | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index cd99b76f7388..acc0417fefc4 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -611,7 +611,7 @@ sal_Int32 StgFATStrm::GetPage( short nOff, bool bMake, sal_uInt16 *pnMasterAlloc pMaster = rIo.Copy( nFAT, STG_FREE ); if ( pMaster.is() ) { - for( short k = 0; k < ( nPageSize >> 2 ); k++ ) + for( short k = 0; k < (short)( nPageSize >> 2 ); k++ ) rIo.SetToPage( pMaster, k, STG_FREE ); // Verkettung herstellen if( !pOldPage.is() ) @@ -763,7 +763,7 @@ bool StgFATStrm::SetSize( sal_Int32 nBytes ) rtl::Reference< StgPage > pPg = rIo.Copy( nNewPage, STG_FREE ); if ( !pPg.is() ) return false; - for( short j = 0; j < ( nPageSize >> 2 ); j++ ) + for( short j = 0; j < (short)( nPageSize >> 2 ); j++ ) rIo.SetToPage( pPg, j, STG_FREE ); // store the page number into the master FAT @@ -776,7 +776,7 @@ bool StgFATStrm::SetSize( sal_Int32 nBytes ) sal_uInt32 nMax = rIo.aHdr.GetMasters( ); sal_uInt32 nFAT = rIo.aHdr.GetFATChain(); if( nMasterAlloc ) - for( sal_uInt16 nCount = 0; nCount < nMax; nCount++ ) + for( sal_uInt32 nCount = 0; nCount < nMax; nCount++ ) { if( !Pos2Page( nFAT << 2 ) ) return false; diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx index fd4b822e9643..a1d4f6dc2263 100644 --- a/sot/source/unoolestorage/xolesimplestorage.cxx +++ b/sot/source/unoolestorage/xolesimplestorage.cxx @@ -560,7 +560,7 @@ uno::Sequence< OUString > SAL_CALL OLESimpleStorage::getElementNames() } uno::Sequence< OUString > aSeq( aList.size() ); - for ( sal_uInt32 nInd = 0; nInd < aList.size(); nInd++ ) + for ( size_t nInd = 0; nInd < aList.size(); nInd++ ) aSeq[nInd] = aList[nInd].GetName(); return aSeq; |