Kaydet (Commit) 0662f319 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr pass SmNodeList around by std::unique_ptr

Change-Id: I263a7afd23a38f68ee54ecb11f00bcfbdda30c64
Reviewed-on: https://gerrit.libreoffice.org/59230
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 49d08ac5
...@@ -225,14 +225,14 @@ private: ...@@ -225,14 +225,14 @@ private:
* that includes pLine! * that includes pLine!
* This method also deletes SmErrorNode's as they're just meta info in the line. * 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 /** Auxiliary function for calling LineToList on a node
* *
* This method sets pNode = NULL and remove it from its parent. * This method sets pNode = NULL and remove it from its parent.
* (Assuming it has a parent, and is a child of it). * (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 //Remove from parent and NULL rpNode
SmNode* pNode = rpNode; SmNode* pNode = rpNode;
if(rpNode && rpNode->GetParent()){ //Don't remove this, correctness relies on it if(rpNode && rpNode->GetParent()){ //Don't remove this, correctness relies on it
...@@ -242,11 +242,12 @@ private: ...@@ -242,11 +242,12 @@ private:
} }
rpNode = nullptr; rpNode = nullptr;
//Create line from node //Create line from node
if(pNode && IsLineCompositionNode(pNode)) if(pNode && IsLineCompositionNode(pNode)){
return LineToList(static_cast<SmStructureNode*>(pNode), pList); LineToList(static_cast<SmStructureNode*>(pNode), rList);
return;
}
if(pNode) if(pNode)
pList->push_front(pNode); rList.push_front(pNode);
return pList;
} }
/** Clone a visual line to a clipboard /** Clone a visual line to a clipboard
...@@ -342,7 +343,7 @@ private: ...@@ -342,7 +343,7 @@ private:
* @param pStartLine Line to take first position in, if PosAfterEdit cannot be found, * @param pStartLine Line to take first position in, if PosAfterEdit cannot be found,
* leave it NULL for pLineList. * leave it NULL for pLineList.
*/ */
void FinishEdit(SmNodeList* pLineList, void FinishEdit(std::unique_ptr<SmNodeList> pLineList,
SmStructureNode* pParent, SmStructureNode* pParent,
int nParentIndex, int nParentIndex,
SmCaretPos PosAfterEdit, SmCaretPos PosAfterEdit,
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment