aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4arrayobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-25 15:24:50 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-28 13:33:39 +0200
commit150731fc68bcf823bec40729285813d902990cb7 (patch)
tree7af619f4bc8fac030bc162ce6ead2e2a7be86783 /src/qml/jsruntime/qv4arrayobject.cpp
parentc79cc3f30d395c94d4f14b978903d7db4ad871dc (diff)
Remove more direct QV4::Value usage
Remove Value::fromString(String *), and make Encode safe against encoding raw Managed * pointers. Change-Id: Ibca4668e1cbeaf85c78169d14386281659d33ef6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4arrayobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index 0aa7e93804..02b83428fa 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -349,7 +349,7 @@ ReturnedValue ArrayPrototype::method_shift(SimpleCallContext *ctx)
if (pidx < UINT_MAX && (!instance->arrayAttributes || !instance->arrayAttributes[0].isGeneric()))
front = instance->arrayData + pidx;
- Value result = front ? Value::fromReturnedValue(instance->getValue(front, instance->arrayAttributes ? instance->arrayAttributes[pidx] : Attr_Data)) : Primitive::undefinedValue();
+ ScopedValue result(scope, front ? instance->getValue(front, instance->arrayAttributes ? instance->arrayAttributes[pidx] : Attr_Data) : Encode::undefined());
if (!instance->protoHasArray() && instance->arrayDataLen <= len) {
if (!instance->sparseArray) {
@@ -456,7 +456,7 @@ ReturnedValue ArrayPrototype::method_splice(SimpleCallContext *ctx)
newArray->arrayReserve(deleteCount);
for (uint i = 0; i < deleteCount; ++i) {
- newArray->arrayData[i].value = Value::fromReturnedValue(instance->getIndexed(start + i));
+ newArray->arrayData[i].value = instance->getIndexed(start + i);
newArray->arrayDataLen = i + 1;
}
newArray->setArrayLengthUnchecked(deleteCount);
@@ -675,6 +675,7 @@ ReturnedValue ArrayPrototype::method_some(SimpleCallContext *ctx)
callData->args[2] = instance;
ScopedValue v(scope);
+ ScopedValue r(scope);
for (uint k = 0; k < len; ++k) {
bool exists;
v = instance->getIndexed(k, &exists);
@@ -683,8 +684,8 @@ ReturnedValue ArrayPrototype::method_some(SimpleCallContext *ctx)
callData->args[0] = v;
callData->args[1] = Primitive::fromDouble(k);
- Value r = Value::fromReturnedValue(callback->call(callData));
- if (r.toBoolean())
+ r = callback->call(callData);
+ if (r->toBoolean())
return Encode(true);
}
return Encode(false);