summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-03-01 08:47:53 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-04-05 11:25:10 +0200
commitdfa894f25b3d46f2aa2bb57578f1bf9b548b6eff (patch)
tree3ba5ecaad30163f20967befe38ff8f0a0e4295f8 /sw
parent16fe1b047db11718de9a15f3b24a23fd51ef3a31 (diff)
Avoid two special values as "whole array" flag
Keep 0, which is used in all call places, and remove the unused (and data-type sensible) USHRT_MAX Change-Id: I5258ce0d684723e4cf90444314ef55cc2f826f9d
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/docary.hxx2
-rw-r--r--sw/source/core/doc/docredln.cxx9
2 files changed, 5 insertions, 6 deletions
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 676ac4e773b2..93590f6408a6 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -212,7 +212,7 @@ public:
sal_uInt16 FindPrevOfSeqNo( sal_uInt16 nSttPos ) const;
/** Search next or previous Redline with the same Seq. No.
Search can be restricted via Lookahead.
- Using 0 or USHRT_MAX makes search the whole array. */
+ Using 0 makes search the whole array. */
sal_uInt16 FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
sal_uInt16 nLookahead = 20 ) const;
sal_uInt16 FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 5c4f228d5c58..3d7c4f7d0417 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -496,9 +496,6 @@ void SwRedlineTbl::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL )
pSh->InvalidateWindows( SwRect( 0, 0, SAL_MAX_INT32, SAL_MAX_INT32 ) );
}
-/// Find the next or preceding Redline with the same seq.no.
-/// We can limit the search using look ahead.
-/// 0 or USHRT_MAX searches the whole array.
sal_uInt16 SwRedlineTbl::FindNextOfSeqNo( sal_uInt16 nSttPos ) const
{
return static_cast<size_t>(nSttPos) + 1 < size()
@@ -512,6 +509,8 @@ sal_uInt16 SwRedlineTbl::FindPrevOfSeqNo( sal_uInt16 nSttPos ) const
: USHRT_MAX;
}
+/// Find the next or preceding Redline with the same seq.no.
+/// We can limit the search using look ahead (0 searches the whole array).
sal_uInt16 SwRedlineTbl::FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
sal_uInt16 nLookahead ) const
{
@@ -519,7 +518,7 @@ sal_uInt16 SwRedlineTbl::FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
if( nSeqNo && nSttPos < size() )
{
size_t nEnd = size();
- if( nLookahead && USHRT_MAX != nLookahead )
+ if( nLookahead )
{
const size_t nTmp = static_cast<size_t>(nSttPos)+ static_cast<size_t>(nLookahead);
if (nTmp < nEnd)
@@ -545,7 +544,7 @@ sal_uInt16 SwRedlineTbl::FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
if( nSeqNo && nSttPos < size() )
{
const size_t nEnd = 0;
- if( nLookahead && USHRT_MAX != nLookahead && nSttPos > nLookahead )
+ if( nLookahead && nSttPos > nLookahead )
nEnd = nSttPos - nLookahead;
++nSttPos;