summaryrefslogtreecommitdiff
path: root/starmath/source/cursor.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-12-21 09:57:46 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-12-21 13:53:17 +0100
commit585328a7136aaa4b98b9cac0355a2cd7e9078dec (patch)
tree28fd94cd6ecaf484de8deec5cb404149666e1654 /starmath/source/cursor.cxx
parent10e73684468a811acae56dfeafc8ecb5876a7960 (diff)
ofz#4703 Direct-leak
Change-Id: I5f3385d87aa5a48a8df3b6774dd1166cec60ebf8 Reviewed-on: https://gerrit.libreoffice.org/46893 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'starmath/source/cursor.cxx')
-rw-r--r--starmath/source/cursor.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 1ffd1c783a55..84c364bc17d6 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -181,11 +181,13 @@ void SmCursor::DeletePrev(OutputDevice* pDev){
SmNode* pLine = FindTopMostNodeInLine(mpPosition->CaretPos.pSelectedNode);
SmStructureNode* pLineParent = pLine->GetParent();
- int nLineOffset = pLineParent->IndexOfSubNode(pLine);
- assert(nLineOffset >= 0);
+ int nLineOffsetIdx = pLineParent->IndexOfSubNode(pLine);
+ assert(nLineOffsetIdx >= 0);
//If we're in front of a node who's parent is a TABLE
- if(pLineParent->GetType() == SmNodeType::Table && mpPosition->CaretPos.nIndex == 0 && nLineOffset > 0){
+ if (pLineParent->GetType() == SmNodeType::Table && mpPosition->CaretPos.nIndex == 0 && nLineOffsetIdx > 0)
+ {
+ size_t nLineOffset = nLineOffsetIdx;
//Now we can merge with nLineOffset - 1
BeginEdit();
//Line to merge things into, so we can delete pLine
@@ -210,7 +212,8 @@ void SmCursor::DeletePrev(OutputDevice* pDev){
pLineParent->SetSubNode(nLineOffset-1, pLine);
//Delete the removed line slot
SmNodeArray lines(pLineParent->GetNumSubNodes()-1);
- for(int i = 0; i < pLineParent->GetNumSubNodes(); i++){
+ for (size_t i = 0; i < pLineParent->GetNumSubNodes(); ++i)
+ {
if(i < nLineOffset)
lines[i] = pLineParent->GetSubNode(i);
else if(i > nLineOffset)
@@ -1353,7 +1356,7 @@ bool SmCursor::IsAtTailOfBracket(SmBracketType eBracketType, SmBraceNode** ppBra
int index = pParentNode->IndexOfSubNode(pNode);
assert(index >= 0);
- if (index + 1 != pParentNode->GetNumSubNodes()) {
+ if (static_cast<size_t>(index + 1) != pParentNode->GetNumSubNodes()) {
// The cursor is not at the tail at one of ancestor nodes.
return false;
}