starmath/source/mathmlimport.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
New commits: commit 4963ea48961c7c4dc941c89afe56a1f84b31e66e Author: Caolán McNamara <[email protected]> Date: Fri Dec 1 17:33:20 2017 +0000 ofz#4531 Bad-cast Change-Id: I152c2e7fa09fc637b176482de9718cf03880c23e Reviewed-on: https://gerrit.libreoffice.org/45876 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Michael Stahl <[email protected]> diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index e1537bf62d75..e252ee166a2b 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -2637,10 +2637,9 @@ void SmXMLTableContext_Impl::EndElement() auto nRows = rNodeStack.size()-nElementCount; sal_uInt16 nCols = 0; - SmStructureNode *pArray; for (auto i=nRows;i > 0;i--) { - pArray = static_cast<SmStructureNode *>(rNodeStack.front().release()); + SmNode* pArray = rNodeStack.front().release(); rNodeStack.pop_front(); if (pArray->GetNumSubNodes() == 0) { @@ -2656,22 +2655,24 @@ void SmXMLTableContext_Impl::EndElement() aRelationArray.resize(1); aRelationArray[0] = pArray; SmToken aDummy; - pArray = new SmExpressionNode(aDummy); - pArray->SetSubNodes(aRelationArray); + SmExpressionNode* pExprNode = new SmExpressionNode(aDummy); + pExprNode->SetSubNodes(aRelationArray); + pArray = pExprNode; } if (pArray->GetNumSubNodes() > nCols) nCols = pArray->GetNumSubNodes(); - aReverseStack.push_front(std::unique_ptr<SmStructureNode>(pArray)); + aReverseStack.push_front(std::unique_ptr<SmNode>(pArray)); } aExpressionArray.resize(nCols*nRows); size_t j=0; while ( !aReverseStack.empty() ) { - pArray = static_cast<SmStructureNode *>(aReverseStack.front().release()); + std::unique_ptr<SmStructureNode> xArray(static_cast<SmStructureNode*>(aReverseStack.front().release())); aReverseStack.pop_front(); - for (sal_uInt16 i=0;i<pArray->GetNumSubNodes();i++) - aExpressionArray[j++] = pArray->GetSubNode(i); + for (sal_uInt16 i = 0; i < xArray->GetNumSubNodes(); ++i) + aExpressionArray[j++] = xArray->GetSubNode(i); + xArray->SetSubNodes(SmNodeArray()); } SmToken aToken;
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
