Kaydet (Commit) cced2f6b authored tarafından Caolán McNamara's avatar Caolán McNamara

give us a parenStack which can grow to fit any input

Change-Id: Ic464184fe367da33bf8c4790b82656b140e3cbd0
üst 093ed858
......@@ -175,7 +175,11 @@ UBool ScriptRun::next()
// characters above it on the stack will be poped.
if (pairIndex >= 0) {
if ((pairIndex & 1) == 0) {
parenStack[++parenSP].pairIndex = pairIndex;
++parenSP;
int32_t nVecSize = parenStack.size();
if (parenSP == nVecSize)
parenStack.resize(nVecSize + 128);
parenStack[parenSP].pairIndex = pairIndex;
parenStack[parenSP].scriptCode = scriptCode;
} else if (parenSP >= 0) {
int32_t pi = pairIndex & ~1;
......
......@@ -43,6 +43,7 @@
#include "unicode/utypes.h"
#include "unicode/uobject.h"
#include "unicode/uscript.h"
#include <vector>
namespace vcl {
......@@ -112,7 +113,7 @@ private:
int32_t scriptEnd;
UScriptCode scriptCode;
ParenStackEntry parenStack[128];
std::vector<ParenStackEntry> parenStack;
int32_t parenSP;
static int8_t highBit(int32_t value);
......@@ -166,6 +167,7 @@ inline void ScriptRun::reset()
scriptEnd = charStart;
scriptCode = USCRIPT_INVALID_CODE;
parenSP = -1;
parenStack.resize(128);
}
inline void ScriptRun::reset(int32_t start, int32_t length)
......
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