From a2d115fbaffee282a1d32ed92c6700e6c3dd811b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 12 Sep 2013 22:37:41 +0200 Subject: Convert most remaining return values from Value to ReturnedValue Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann --- src/imports/localstorage/plugin.cpp | 18 ++++++++++-------- src/imports/xmllistmodel/qqmlxmllistmodel.cpp | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src/imports') diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index 83d73c5bc9..14c49a08e1 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -204,7 +204,7 @@ static ReturnedValue qmlsqldatabase_rows_index(QQmlSqlDatabaseWrapper *r, Execut if (v.isNull()) { row->put(v4->newIdentifier(record.fieldName(ii)), Value::nullValue()); } else { - row->put(v4->newIdentifier(record.fieldName(ii)), v8->fromVariant(v)); + row->put(v4->newIdentifier(record.fieldName(ii)), Value::fromReturnedValue(v8->fromVariant(v))); } } if (hasProperty) @@ -257,7 +257,8 @@ static ReturnedValue qmlsqldatabase_executeSql(SimpleCallContext *ctx) QSqlQuery query(db); bool err = false; - Value result = Value::undefinedValue(); + Scope scope(QV8Engine::getV4(engine)); + ScopedValue result(scope, Value::undefinedValue()); if (query.prepare(sql)) { if (ctx->argumentCount > 1) { @@ -268,17 +269,18 @@ static ReturnedValue qmlsqldatabase_executeSql(SimpleCallContext *ctx) query.bindValue(ii, engine->toVariant(QV4::Value::fromReturnedValue(array->getIndexed(ii)), -1)); } else if (Object *object = values.asObject()) { ObjectIterator it(object, ObjectIterator::WithProtoChain|ObjectIterator::EnumerableOnly); + ScopedValue key(scope); while (1) { Value value; - Value key = it.nextPropertyName(&value); - if (key.isNull()) + key = it.nextPropertyName(&value); + if (key->isNull()) break; QVariant v = engine->toVariant(value, -1); - if (key.isString()) { - query.bindValue(key.stringValue()->toQString(), v); + if (key->isString()) { + query.bindValue(key->stringValue()->toQString(), v); } else { - assert(key.isInteger()); - query.bindValue(key.integerValue(), v); + assert(key->isInteger()); + query.bindValue(key->integerValue(), v); } } } else { diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp index c12bfee924..9f6437625d 100644 --- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp +++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp @@ -926,7 +926,7 @@ QQmlV4Handle QQuickXmlListModel::get(int index) const Object *o = v4engine->newObject(); for (int ii = 0; ii < d->roleObjects.count(); ++ii) { Property *p = o->insertMember(v4engine->newIdentifier(d->roleObjects[ii]->name()), PropertyAttributes()); - p->value = v8engine->fromVariant(d->data.value(ii).value(index)); + p->value = Value::fromReturnedValue(v8engine->fromVariant(d->data.value(ii).value(index))); } return QQmlV4Handle(Value::fromObject(o)); -- cgit v1.2.3