Kaydet (Commit) 484591a0 authored tarafından Noel Grandin's avatar Noel Grandin

use unique_ptr in SmXMLExport

Change-Id: I081ef638f35fb47f1ca2705eff53fc27f1900008
Reviewed-on: https://gerrit.libreoffice.org/66572
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst ac513ca0
...@@ -861,7 +861,7 @@ void SmXMLExport::ExportSubSupScript(const SmNode *pNode, int nLevel) ...@@ -861,7 +861,7 @@ void SmXMLExport::ExportSubSupScript(const SmNode *pNode, int nLevel)
const SmNode *pCSup = nullptr; const SmNode *pCSup = nullptr;
const SmNode *pLSub = nullptr; const SmNode *pLSub = nullptr;
const SmNode *pLSup = nullptr; const SmNode *pLSup = nullptr;
SvXMLElementExport *pThing2 = nullptr; std::unique_ptr<SvXMLElementExport> pThing2;
//if we have prescripts at all then we must use the tensor notation //if we have prescripts at all then we must use the tensor notation
...@@ -879,18 +879,18 @@ void SmXMLExport::ExportSubSupScript(const SmNode *pNode, int nLevel) ...@@ -879,18 +879,18 @@ void SmXMLExport::ExportSubSupScript(const SmNode *pNode, int nLevel)
if (nullptr != (pCSub = pNode->GetSubNode(CSUB+1)) if (nullptr != (pCSub = pNode->GetSubNode(CSUB+1))
&& nullptr != (pCSup = pNode->GetSubNode(CSUP+1))) && nullptr != (pCSup = pNode->GetSubNode(CSUP+1)))
{ {
pThing2 = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, pThing2.reset(new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
XML_MUNDEROVER, true, true); XML_MUNDEROVER, true, true));
} }
else if (nullptr != (pCSub = pNode->GetSubNode(CSUB+1))) else if (nullptr != (pCSub = pNode->GetSubNode(CSUB+1)))
{ {
pThing2 = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, pThing2.reset(new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
XML_MUNDER, true, true); XML_MUNDER, true, true));
} }
else if (nullptr != (pCSup = pNode->GetSubNode(CSUP+1))) else if (nullptr != (pCSup = pNode->GetSubNode(CSUP+1)))
{ {
pThing2 = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, pThing2.reset(new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
XML_MOVER, true, true); XML_MOVER, true, true));
} }
ExportNodes(pNode->GetSubNode(0), nLevel+1); //Main Term ExportNodes(pNode->GetSubNode(0), nLevel+1); //Main Term
...@@ -899,7 +899,7 @@ void SmXMLExport::ExportSubSupScript(const SmNode *pNode, int nLevel) ...@@ -899,7 +899,7 @@ void SmXMLExport::ExportSubSupScript(const SmNode *pNode, int nLevel)
ExportNodes(pCSub, nLevel+1); ExportNodes(pCSub, nLevel+1);
if (pCSup) if (pCSup)
ExportNodes(pCSup, nLevel+1); ExportNodes(pCSup, nLevel+1);
delete pThing2; pThing2.reset();
pSub = pNode->GetSubNode(RSUB+1); pSub = pNode->GetSubNode(RSUB+1);
pSup = pNode->GetSubNode(RSUP+1); pSup = pNode->GetSubNode(RSUP+1);
...@@ -944,39 +944,39 @@ void SmXMLExport::ExportSubSupScript(const SmNode *pNode, int nLevel) ...@@ -944,39 +944,39 @@ void SmXMLExport::ExportSubSupScript(const SmNode *pNode, int nLevel)
} }
else else
{ {
SvXMLElementExport *pThing = nullptr; std::unique_ptr<SvXMLElementExport> pThing;
if (nullptr != (pSub = pNode->GetSubNode(RSUB+1)) && if (nullptr != (pSub = pNode->GetSubNode(RSUB+1)) &&
nullptr != (pSup = pNode->GetSubNode(RSUP+1))) nullptr != (pSup = pNode->GetSubNode(RSUP+1)))
{ {
pThing = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, pThing.reset(new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
XML_MSUBSUP, true, true); XML_MSUBSUP, true, true));
} }
else if (nullptr != (pSub = pNode->GetSubNode(RSUB+1))) else if (nullptr != (pSub = pNode->GetSubNode(RSUB+1)))
{ {
pThing = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MSUB, pThing.reset(new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MSUB,
true, true); true, true));
} }
else if (nullptr != (pSup = pNode->GetSubNode(RSUP+1))) else if (nullptr != (pSup = pNode->GetSubNode(RSUP+1)))
{ {
pThing = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MSUP, pThing.reset(new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MSUP,
true, true); true, true));
} }
if (nullptr != (pCSub = pNode->GetSubNode(CSUB+1)) if (nullptr != (pCSub = pNode->GetSubNode(CSUB+1))
&& nullptr != (pCSup=pNode->GetSubNode(CSUP+1))) && nullptr != (pCSup=pNode->GetSubNode(CSUP+1)))
{ {
pThing2 = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, pThing2.reset(new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
XML_MUNDEROVER, true, true); XML_MUNDEROVER, true, true));
} }
else if (nullptr != (pCSub = pNode->GetSubNode(CSUB+1))) else if (nullptr != (pCSub = pNode->GetSubNode(CSUB+1)))
{ {
pThing2 = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, pThing2.reset(new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
XML_MUNDER, true, true); XML_MUNDER, true, true));
} }
else if (nullptr != (pCSup = pNode->GetSubNode(CSUP+1))) else if (nullptr != (pCSup = pNode->GetSubNode(CSUP+1)))
{ {
pThing2 = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, pThing2.reset(new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
XML_MOVER, true, true); XML_MOVER, true, true));
} }
ExportNodes(pNode->GetSubNode(0), nLevel+1); //Main Term ExportNodes(pNode->GetSubNode(0), nLevel+1); //Main Term
...@@ -984,13 +984,13 @@ void SmXMLExport::ExportSubSupScript(const SmNode *pNode, int nLevel) ...@@ -984,13 +984,13 @@ void SmXMLExport::ExportSubSupScript(const SmNode *pNode, int nLevel)
ExportNodes(pCSub, nLevel+1); ExportNodes(pCSub, nLevel+1);
if (pCSup) if (pCSup)
ExportNodes(pCSup, nLevel+1); ExportNodes(pCSup, nLevel+1);
delete pThing2; pThing2.reset();
if (pSub) if (pSub)
ExportNodes(pSub, nLevel+1); ExportNodes(pSub, nLevel+1);
if (pSup) if (pSup)
ExportNodes(pSup, nLevel+1); ExportNodes(pSup, nLevel+1);
delete pThing; pThing.reset();
} }
} }
......
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