diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2015-10-02 22:12:32 +0900 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-10-02 19:09:51 +0000 |
commit | 3128b9c6f6c1304b38d3ee8d04336feab2589172 (patch) | |
tree | 4668e139a75f9f7969268a72c7f1ae58dd2a740d /starmath/source | |
parent | 0191db4a009bb9c3839a5d209f63119859a5e9cb (diff) |
starmath: it is just a stack that is needed here
Change-Id: I5b929a462f8084105ba6254e53e9d5bfa0a96c79
Reviewed-on: https://gerrit.libreoffice.org/19096
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'starmath/source')
-rw-r--r-- | starmath/source/parse.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index a4087e1240e9..e3306de59dab 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); } |