starmath/source/parse.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
New commits: commit 3128b9c6f6c1304b38d3ee8d04336feab2589172 Author: Takeshi Abe <t...@fixedpoint.jp> Date: Fri Oct 2 22:12:32 2015 +0900 starmath: it is just a stack that is needed here Change-Id: I5b929a462f8084105ba6254e53e9d5bfa0a96c79 Reviewed-on: https://gerrit.libreoffice.org/19096 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Michael Stahl <mst...@redhat.com> diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index a4087e1..e3306de 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -29,6 +29,7 @@ #include "smdll.hxx" #include "smmod.hxx" #include "cfgitem.hxx" +#include <stack> using namespace ::com::sun::star; using namespace ::com::sun::star::i18n; @@ -1527,13 +1528,11 @@ void SmParser::DoTerm(bool bGroupNumberIdent) else if ( TokenInGroup(TGATTRIBUT) || TokenInGroup(TGFONTATTR)) { - std::vector< SmStructureNode * > aArray; + std::stack<SmStructureNode *> aStack; bool bIsAttr; - sal_uInt16 n = 0; while ( (bIsAttr = TokenInGroup(TGATTRIBUT)) || TokenInGroup(TGFONTATTR)) - { aArray.resize(n + 1); - + { if (bIsAttr) DoAttribut(); else @@ -1544,17 +1543,18 @@ void SmParser::DoTerm(bool bGroupNumberIdent) // check if casting in following line is ok OSL_ENSURE(pTmp && !pTmp->IsVisible(), "Sm : Ooops..."); - aArray[n] = static_cast<SmStructureNode *>(pTmp); - n++; + aStack.push(static_cast<SmStructureNode *>(pTmp)); } DoPower(); SmNode *pFirstNode = popOrZero(m_aNodeStack); - while (n > 0) - { aArray[n - 1]->SetSubNodes(0, pFirstNode); - pFirstNode = aArray[n - 1]; - n--; + while (!aStack.empty()) + { + SmStructureNode *pNode = aStack.top(); + aStack.pop(); + pNode->SetSubNodes(0, pFirstNode); + pFirstNode = pNode; } m_aNodeStack.push_front(pFirstNode); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits