aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-03-18 11:10:28 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-25 10:01:29 +0100
commit2177d71ddc340a2062f10f93b8c8b3398d02b64f (patch)
treede1a0d5d2fc3f9cb1dd1eedc3abdbb781a00f423 /src/qml/jsruntime
parent5920c40e7fc0137e1de41621c87aeea7f67925c6 (diff)
Small fixes
Don't cast from ushort to uchar and back, and remove a condition that's always true. Allocate some more memory for matching. Change-Id: I8167b6e4b4989365ca0ea8e17f4bdb15c0d8e27d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index f26c77e5bf..7c38ae4f01 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -450,7 +450,7 @@ static void appendReplacementString(QString *result, const QString &input, const
uint substStart = JSC::Yarr::offsetNoMatch;
uint substEnd = JSC::Yarr::offsetNoMatch;
if (ch == '$') {
- *result += QLatin1Char(ch);
+ *result += QChar(ch);
continue;
} else if (ch == '&') {
substStart = matchOffsets[0];
@@ -463,7 +463,8 @@ static void appendReplacementString(QString *result, const QString &input, const
substEnd = input.length();
} else if (ch >= '1' && ch <= '9') {
uint capture = ch - '0';
- if (capture > 0 && capture < static_cast<uint>(captureCount)) {
+ Q_ASSERT(capture > 0);
+ if (capture < static_cast<uint>(captureCount)) {
substStart = matchOffsets[capture * 2];
substEnd = matchOffsets[capture * 2 + 1];
}
@@ -498,8 +499,8 @@ ReturnedValue StringPrototype::method_replace(CallContext *ctx)
int numCaptures = 0;
int numStringMatches = 0;
- uint allocatedMatchOffsets = 32;
- uint _matchOffsets[32];
+ uint allocatedMatchOffsets = 64;
+ uint _matchOffsets[64];
uint *matchOffsets = _matchOffsets;
uint nMatchOffsets = 0;