[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - vcl/generic
Caolán McNamara
caolanm at redhat.com
Sun Nov 30 12:29:47 PST 2014
vcl/generic/glyphs/scrptrun.cxx | 6 +++++-
vcl/generic/glyphs/scrptrun.h | 4 +++-
2 files changed, 8 insertions(+), 2 deletions(-)
New commits:
commit f4d977595492573abff4b491b26f1a4f2a57c4f8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Nov 29 16:44:12 2014 +0000
give us a parenStack which can grow to fit any input
Change-Id: Ic464184fe367da33bf8c4790b82656b140e3cbd0
(cherry picked from commit cced2f6b866877c39afe86f4af18622cb4022bef)
diff --git a/vcl/generic/glyphs/scrptrun.cxx b/vcl/generic/glyphs/scrptrun.cxx
index 965fbf1..cd7ce41 100644
--- a/vcl/generic/glyphs/scrptrun.cxx
+++ b/vcl/generic/glyphs/scrptrun.cxx
@@ -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;
diff --git a/vcl/generic/glyphs/scrptrun.h b/vcl/generic/glyphs/scrptrun.h
index 56ea88c..3dea2e4 100644
--- a/vcl/generic/glyphs/scrptrun.h
+++ b/vcl/generic/glyphs/scrptrun.h
@@ -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)
More information about the Libreoffice-commits
mailing list