diff options
Diffstat (limited to 'src/imports/localstorage/plugin.cpp')
-rw-r--r-- | src/imports/localstorage/plugin.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index b0ba3f9228..22a3eed39d 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -126,7 +126,7 @@ public: ~QQmlSqlDatabaseWrapper() { } - static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty); + static ReturnedValue getIndexed(const Managed *m, uint index, bool *hasProperty); }; } @@ -214,7 +214,7 @@ static QString qmlsqldatabase_databaseFile(const QString& connectionName, QV4::E return qmlsqldatabase_databasesPath(engine) + QDir::separator() + connectionName; } -static ReturnedValue qmlsqldatabase_rows_index(QQmlSqlDatabaseWrapper *r, ExecutionEngine *v4, quint32 index, bool *hasProperty = 0) +static ReturnedValue qmlsqldatabase_rows_index(const QQmlSqlDatabaseWrapper *r, ExecutionEngine *v4, quint32 index, bool *hasProperty = 0) { Scope scope(v4); @@ -238,15 +238,14 @@ static ReturnedValue qmlsqldatabase_rows_index(QQmlSqlDatabaseWrapper *r, Execut } } -ReturnedValue QQmlSqlDatabaseWrapper::getIndexed(Managed *m, uint index, bool *hasProperty) +ReturnedValue QQmlSqlDatabaseWrapper::getIndexed(const Managed *m, uint index, bool *hasProperty) { - QV4::Scope scope(static_cast<QQmlSqlDatabaseWrapper *>(m)->engine()); Q_ASSERT(m->as<QQmlSqlDatabaseWrapper>()); - QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, static_cast<QQmlSqlDatabaseWrapper *>(m)); + const QQmlSqlDatabaseWrapper *r = static_cast<const QQmlSqlDatabaseWrapper *>(m); if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows) return Object::getIndexed(m, index, hasProperty); - return qmlsqldatabase_rows_index(r, scope.engine, index, hasProperty); + return qmlsqldatabase_rows_index(r, r->engine(), index, hasProperty); } static ReturnedValue qmlsqldatabase_rows_item(CallContext *ctx) @@ -285,13 +284,13 @@ static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx) if (query.prepare(sql)) { if (ctx->argc() > 1) { ScopedValue values(scope, ctx->args()[1]); - if (values->asArrayObject()) { + if (values->as<ArrayObject>()) { ScopedArrayObject array(scope, values); quint32 size = array->getLength(); QV4::ScopedValue v(scope); for (quint32 ii = 0; ii < size; ++ii) query.bindValue(ii, scope.engine->toVariant((v = array->getIndexed(ii)), -1)); - } else if (values->asObject()) { + } else if (values->as<Object>()) { ScopedObject object(scope, values); ObjectIterator it(scope, object, ObjectIterator::WithProtoChain|ObjectIterator::EnumerableOnly); ScopedValue key(scope); @@ -304,7 +303,7 @@ static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx) if (key->isString()) { query.bindValue(key->stringValue()->toQString(), v); } else { - assert(key->isInteger()); + Q_ASSERT(key->isInteger()); query.bindValue(key->integerValue(), v); } } @@ -401,7 +400,7 @@ static ReturnedValue qmlsqldatabase_changeVersion(CallContext *ctx) db.transaction(); ScopedCallData callData(scope, 1); - callData->thisObject = scope.engine->globalObject(); + callData->thisObject = scope.engine->globalObject; callData->args[0] = w; TransactionRollback rollbackOnException(&db, &w->d()->inTransaction); @@ -433,7 +432,7 @@ static ReturnedValue qmlsqldatabase_transaction_shared(CallContext *ctx, bool re if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Database) V4THROW_REFERENCE("Not a SQLDatabase object"); - FunctionObject *callback = ctx->argc() ? ctx->args()[0].asFunctionObject() : 0; + const FunctionObject *callback = ctx->argc() ? ctx->args()[0].as<FunctionObject>() : 0; if (!callback) V4THROW_SQL(SQLEXCEPTION_UNKNOWN_ERR, QQmlEngine::tr("transaction: missing callback")); @@ -450,7 +449,7 @@ static ReturnedValue qmlsqldatabase_transaction_shared(CallContext *ctx, bool re db.transaction(); if (callback) { ScopedCallData callData(scope, 1); - callData->thisObject = scope.engine->globalObject(); + callData->thisObject = scope.engine->globalObject; callData->args[0] = w; TransactionRollback rollbackOnException(&db, &w->d()->inTransaction); callback->call(callData); @@ -673,7 +672,7 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args) QString dbversion = (v = (*args)[1])->toQStringNoThrow(); QString dbdescription = (v = (*args)[2])->toQStringNoThrow(); int dbestimatedsize = (v = (*args)[3])->toInt32(); - FunctionObject *dbcreationCallback = (v = (*args)[4])->asFunctionObject(); + FunctionObject *dbcreationCallback = (v = (*args)[4])->as<FunctionObject>(); QCryptographicHash md5(QCryptographicHash::Md5); md5.addData(dbname.toUtf8()); @@ -724,7 +723,7 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args) if (created && dbcreationCallback) { Scope scope(ctx); ScopedCallData callData(scope, 1); - callData->thisObject = scope.engine->globalObject(); + callData->thisObject = scope.engine->globalObject; callData->args[0] = db; dbcreationCallback->call(callData); } |