diff options
Diffstat (limited to 'src/qml/jsruntime/qv4regexpobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4regexpobject.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index 9df286065d..39a2e96b45 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -181,17 +181,19 @@ ReturnedValue RegExpObject::builtinExec(ExecutionEngine *engine, const String *s } Q_ALLOCA_VAR(uint, matchOffsets, value()->captureCount() * 2 * sizeof(uint)); - const int result = Scoped<RegExp>(scope, value())->match(s, offset, matchOffsets); + const uint result = Scoped<RegExp>(scope, value())->match(s, offset, matchOffsets); RegExpCtor *regExpCtor = static_cast<RegExpCtor *>(scope.engine->regExpCtor()); regExpCtor->d()->clearLastMatch(); - if (result == -1) { + if (result == JSC::Yarr::offsetNoMatch) { if (global() || sticky()) setLastIndex(0); RETURN_RESULT(Encode::null()); } + Q_ASSERT(result <= uint(std::numeric_limits<int>::max())); + // fill in result data ScopedArrayObject array(scope, scope.engine->newArrayObject(scope.engine->internalClasses(EngineBase::Class_RegExpExecArray))); int len = value()->captureCount(); @@ -207,7 +209,7 @@ ReturnedValue RegExpObject::builtinExec(ExecutionEngine *engine, const String *s array->arrayPut(i, v); } array->setArrayLengthUnchecked(len); - array->setProperty(Index_ArrayIndex, Value::fromInt32(result)); + array->setProperty(Index_ArrayIndex, Value::fromInt32(int(result))); array->setProperty(Index_ArrayInput, *str); RegExpCtor::Data *dd = regExpCtor->d(); |