summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-03-25 10:55:44 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-03-25 16:21:34 +0000
commit2258f33a5fd95a5e25f5bb232994ab147d09bfb9 (patch)
tree32f39a1ebbd79bb74e6dac67cb018c7a3c313a5e /sw
parent5d8e6901ec14edd9da10d9dee63b2ef2ab058692 (diff)
Make loplugin:loopvartoosmall find more suspicious cases
...where the "controlling expression" of any sort of loop contains a sub- expression of the form var < val where the type of var is smaller than that of val. Theoretically, this could turn up lots of false positives, but practically it didn't run into any. Most findings have been cleaned up over the last weeks. There's just a handful remaining places that are hard to clean up, so I flagged them here with (deliberately awkward) sal::static_int_cast for later clean-up. Change-Id: I0f735d46dda15b9b336150095df65cf247e9d6d3 Reviewed-on: https://gerrit.libreoffice.org/35682 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/frmedt/fetab.cxx2
-rw-r--r--sw/source/core/text/itrpaint.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx2
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx2
4 files changed, 4 insertions, 4 deletions
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index e9d927b9e84d..0cb6f864076a 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1044,7 +1044,7 @@ static sal_uInt16 lcl_GetRowNumber( const SwPosition& rPos )
const SwTableLine* pTabLine = static_cast<const SwRowFrame*>(pRow)->GetTabLine();
sal_uInt16 nRet = USHRT_MAX;
sal_uInt16 nI = 0;
- while ( nI < pTabFrame->GetTable()->GetTabLines().size() )
+ while ( sal::static_int_cast<SwTableLines::size_type>(nI) < pTabFrame->GetTable()->GetTabLines().size() )
{
if ( pTabFrame->GetTable()->GetTabLines()[ nI ] == pTabLine )
{
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 462ee043c8c1..117317b8047c 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -579,7 +579,7 @@ void SwTextPainter::CheckSpecialUnderline( const SwLinePortion* pPor,
sal_uInt16 nMaxBaseLineOfst = 0;
int nNumberOfPortions = 0;
- while( nTmpIdx <= nUnderEnd && pPor )
+ while( sal::static_int_cast<long>(nTmpIdx) <= nUnderEnd && pPor )
{
if ( pPor->IsFlyPortion() || pPor->IsFlyCntPortion() ||
pPor->IsBreakPortion() || pPor->IsMarginPortion() ||
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 209ca6771078..f12707b2142b 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -1655,7 +1655,7 @@ void WW8FlyPara::ReadFull(sal_uInt8 nOrigSp29, SwWW8ImplReader* pIo)
WW8FlyPara *pNowStyleApo=nullptr;
sal_uInt16 nColl = pPap->GetIstd();
ww::sti eSti = eVer < ww::eWW6 ? ww::GetCanonicalStiFromStc( static_cast< sal_uInt8 >(nColl) ) : static_cast<ww::sti>(nColl);
- while (eSti != ww::stiNil && nColl < pIo->m_vColl.size() && nullptr == (pNowStyleApo = pIo->m_vColl[nColl].m_xWWFly.get()))
+ while (eSti != ww::stiNil && sal::static_int_cast<size_t>(nColl) < pIo->m_vColl.size() && nullptr == (pNowStyleApo = pIo->m_vColl[nColl].m_xWWFly.get()))
{
nColl = pIo->m_vColl[nColl].m_nBase;
eSti = eVer < ww::eWW6 ? ww::GetCanonicalStiFromStc( static_cast< sal_uInt8 >(nColl) ) : static_cast<ww::sti>(nColl);
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index ae3e44223ab8..3364acdf3f58 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -4123,7 +4123,7 @@ OUString WW8PLCFx_Book::GetBookmark(long nStart,long nEnd, sal_uInt16 &nIndex)
if (pBook[0] && pBook[1])
{
WW8_CP nStartAkt, nEndAkt;
- while (i < aBookNames.size())
+ while (sal::static_int_cast<decltype(aBookNames)::size_type>(i) < aBookNames.size())
{
void* p;
sal_uInt16 nEndIdx;