[Libreoffice-commits] core.git: sw/source
Stephan Bergmann
sbergman at redhat.com
Mon Apr 3 15:50:16 UTC 2017
sw/source/core/layout/laycache.cxx | 7 ++++---
sw/source/core/layout/layhelp.hxx | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
New commits:
commit 5793364b830c88611ec62650e9820c0712d3b956
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Apr 3 17:46:58 2017 +0200
More integer clean-up
...after dbaab58c1442e7f62ef0732376fe5a49840e9fd6 "loplugin:loopvartoosmall".
Looks like SwLayHelper::nIndex only needs to be initialized to a very large
value (so that 'nIndex < pImpl->size()' will be false), not USHRT_MAX exactly.
Change-Id: I209faa00894783c468db1440f5663ea9e8ad3e19
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index 6b7d34b065a3..5903b7d4a4d0 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -42,6 +42,7 @@
#include <flyfrm.hxx>
#include <sortedobjs.hxx>
+#include <limits>
#include <set>
using namespace ::com::sun::star;
@@ -320,7 +321,7 @@ bool SwLayoutCache::CompareLayout( const SwDoc& rDoc ) const
const SwRootFrame *pRootFrame = rDoc.getIDocumentLayoutAccess().GetCurrentLayout();
if( pRootFrame )
{
- sal_uInt16 nIndex = 0;
+ size_t nIndex = 0;
sal_uLong nStartOfContent = rDoc.GetNodes().GetEndOfContent().
StartOfSectionNode()->GetIndex();
const SwPageFrame* pPage = static_cast<const SwPageFrame*>(pRootFrame->Lower());
@@ -534,13 +535,13 @@ SwLayHelper::SwLayHelper( SwDoc *pD, SwFrame* &rpF, SwFrame* &rpP, SwPageFrame*
{
pDoc->GetLayoutCache()->UnlockImpl();
pImpl = nullptr;
- nIndex = USHRT_MAX;
+ nIndex = std::numeric_limits<size_t>::max();
nStartOfContent = USHRT_MAX;
}
}
else
{
- nIndex = USHRT_MAX;
+ nIndex = std::numeric_limits<size_t>::max();
nStartOfContent = ULONG_MAX;
}
}
diff --git a/sw/source/core/layout/layhelp.hxx b/sw/source/core/layout/layhelp.hxx
index 3da3a10bce10..2dc49463a792 100644
--- a/sw/source/core/layout/layhelp.hxx
+++ b/sw/source/core/layout/layhelp.hxx
@@ -109,7 +109,7 @@ class SwLayHelper
sal_uLong nMaxParaPerPage;
sal_uLong nParagraphCnt;
sal_uLong nStartOfContent;
- sal_uInt16 nIndex; // the index in the page break array
+ size_t nIndex; // the index in the page break array
size_t nFlyIdx; // the index in the fly cache array
bool bFirst : 1;
void CheckFlyCache_( SwPageFrame* pPage );
More information about the Libreoffice-commits
mailing list