summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-04-03 17:46:58 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-04-03 17:46:58 +0200
commit5793364b830c88611ec62650e9820c0712d3b956 (patch)
tree7281348277760eaa665f41b14629d7a178960783
parenta8caa0ef1c0b5926caa9dfc4752c6d355dea6765 (diff)
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
-rw-r--r--sw/source/core/layout/laycache.cxx7
-rw-r--r--sw/source/core/layout/layhelp.hxx2
2 files changed, 5 insertions, 4 deletions
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 );