summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2018-04-30 13:59:34 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-05-03 00:27:49 +0200
commit5175e38d823ff11025d8f1df8f4f6ad9ed6b03e2 (patch)
treebd38f94d94651c287f06b6c77660b70cb0b492df /sw
parentd57033ddf8eaa2f6992ac7d89c33dc47c7293492 (diff)
Fix: nNodeCnt could be set to negative value
Change-Id: I82e9b150e97e733c4063f7498dc026e0c9f903c0 Reviewed-on: https://gerrit.libreoffice.org/53660 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/53667 Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/docnode/nodes.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 0d1fba03e848..e23f6b549847 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1732,7 +1732,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
SwNodeIndex aOrigInsPos( rIndex, -1 ); // original insertion position
int nLevel = 0; // level counter
- for( sal_uLong nNodeCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex();
+ for( long nNodeCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex();
nNodeCnt > 0; --nNodeCnt )
{
pCurrentNode = &aRg.aStart.GetNode();
@@ -1744,7 +1744,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
pDoc->GetNodes().GetEndOfInserts().StartOfSectionIndex()
< aInsPos.GetIndex() )
{
- sal_uLong nDistance =
+ const long nDistance =
( pCurrentNode->EndOfSectionIndex() -
aRg.aStart.GetIndex() );
if (nDistance < nNodeCnt)
@@ -1785,7 +1785,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
SwNodeIndex nStt( aInsPos, -1 );
SwTableNode* pTableNd = static_cast<SwTableNode*>(pCurrentNode)->
MakeCopy( pDoc, aInsPos );
- sal_uLong nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
+ const long nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
if (nDistance < nNodeCnt)
nNodeCnt -= nDistance;
else
@@ -1813,7 +1813,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
SwSectionNode* pSectNd = static_cast<SwSectionNode*>(pCurrentNode)->
MakeCopy( pDoc, aInsPos );
- sal_uLong nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
+ const long nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
if (nDistance < nNodeCnt)
nNodeCnt -= nDistance;
else