diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-16 12:19:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-17 13:45:21 +0200 |
commit | 0662f319324e55a80bb789e960a752c172feb530 (patch) | |
tree | af437984077da448be8c7ef499740601ebd385e3 /starmath/inc | |
parent | 49d08ac52b06b2f690ebcb1fd70bf0dc7bcd16e1 (diff) |
loplugin:useuniqueptr pass SmNodeList around by std::unique_ptr
Change-Id: I263a7afd23a38f68ee54ecb11f00bcfbdda30c64
Reviewed-on: https://gerrit.libreoffice.org/59230
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath/inc')
-rw-r--r-- | starmath/inc/cursor.hxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index 476f021670e0..4c3e5b3eb0cd 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -225,14 +225,14 @@ private: * that includes pLine! * This method also deletes SmErrorNode's as they're just meta info in the line. */ - static SmNodeList* LineToList(SmStructureNode* pLine, SmNodeList* pList); + static void LineToList(SmStructureNode* pLine, SmNodeList& rList); /** Auxiliary function for calling LineToList on a node * * This method sets pNode = NULL and remove it from its parent. * (Assuming it has a parent, and is a child of it). */ - static SmNodeList* NodeToList(SmNode*& rpNode, SmNodeList* pList = new SmNodeList){ + static void NodeToList(SmNode*& rpNode, SmNodeList& rList){ //Remove from parent and NULL rpNode SmNode* pNode = rpNode; if(rpNode && rpNode->GetParent()){ //Don't remove this, correctness relies on it @@ -242,11 +242,12 @@ private: } rpNode = nullptr; //Create line from node - if(pNode && IsLineCompositionNode(pNode)) - return LineToList(static_cast<SmStructureNode*>(pNode), pList); + if(pNode && IsLineCompositionNode(pNode)){ + LineToList(static_cast<SmStructureNode*>(pNode), rList); + return; + } if(pNode) - pList->push_front(pNode); - return pList; + rList.push_front(pNode); } /** Clone a visual line to a clipboard @@ -342,7 +343,7 @@ private: * @param pStartLine Line to take first position in, if PosAfterEdit cannot be found, * leave it NULL for pLineList. */ - void FinishEdit(SmNodeList* pLineList, + void FinishEdit(std::unique_ptr<SmNodeList> pLineList, SmStructureNode* pParent, int nParentIndex, SmCaretPos PosAfterEdit, |