[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - vcl/generic
Caolán McNamara
caolanm at redhat.com
Tue Dec 2 04:41:54 PST 2014
vcl/generic/glyphs/scrptrun.cxx | 6 +++++-
vcl/generic/glyphs/scrptrun.h | 4 +++-
2 files changed, 8 insertions(+), 2 deletions(-)
New commits:
commit a4025724d5885c3f9032247d82930711ce56ccd0
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)
Reviewed-on: https://gerrit.libreoffice.org/13217
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/vcl/generic/glyphs/scrptrun.cxx b/vcl/generic/glyphs/scrptrun.cxx
index f72d296..6df7659 100644
--- a/vcl/generic/glyphs/scrptrun.cxx
+++ b/vcl/generic/glyphs/scrptrun.cxx
@@ -173,7 +173,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 6e9bbd6..1c4d0fa 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>
struct ScriptRecord
{
@@ -110,7 +111,7 @@ private:
int32_t scriptEnd;
UScriptCode scriptCode;
- ParenStackEntry parenStack[128];
+ std::vector<ParenStackEntry> parenStack;
int32_t parenSP;
static int8_t highBit(int32_t value);
@@ -164,6 +165,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