aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4dataview.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-15 21:54:12 +0100
committerLars Knoll <lars.knoll@digia.com>2015-01-23 12:30:38 +0100
commitef6b4938b9ec309d5faf0c966cb2b58f3de2ca77 (patch)
tree3d946ad66defb1ec5c60a50e16b6e7883ec33862 /src/qml/jsruntime/qv4dataview.cpp
parent3dbf4e9a6979802fff55e2f5e6aa54a14280e128 (diff)
Cleanups
Simplify some code in BooleanObject Simplify access to call arguments and thisObject Change-Id: I2f8e844019bc587385608beb02f05b15f827535c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4dataview.cpp')
-rw-r--r--src/qml/jsruntime/qv4dataview.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp
index 55a41a7c6c..09d4db59af 100644
--- a/src/qml/jsruntime/qv4dataview.cpp
+++ b/src/qml/jsruntime/qv4dataview.cpp
@@ -123,7 +123,7 @@ void DataViewPrototype::init(ExecutionEngine *engine, Object *ctor)
ReturnedValue DataViewPrototype::method_get_buffer(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
+ Scoped<DataView> v(scope, ctx->thisObject());
if (!v)
return scope.engine->throwTypeError();
@@ -133,7 +133,7 @@ ReturnedValue DataViewPrototype::method_get_buffer(CallContext *ctx)
ReturnedValue DataViewPrototype::method_get_byteLength(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
+ Scoped<DataView> v(scope, ctx->thisObject());
if (!v)
return scope.engine->throwTypeError();
@@ -143,7 +143,7 @@ ReturnedValue DataViewPrototype::method_get_byteLength(CallContext *ctx)
ReturnedValue DataViewPrototype::method_get_byteOffset(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
+ Scoped<DataView> v(scope, ctx->thisObject());
if (!v)
return scope.engine->throwTypeError();
@@ -154,10 +154,10 @@ template <typename T>
ReturnedValue DataViewPrototype::method_getChar(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
- if (!v || ctx->d()->callData->argc < 1)
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
return scope.engine->throwTypeError();
- double l = ctx->d()->callData->args[0].toNumber();
+ double l = ctx->args()[0].toNumber();
uint idx = (uint)l;
if (l != idx || idx + sizeof(T) > v->d()->byteLength)
return scope.engine->throwTypeError();
@@ -172,16 +172,16 @@ template <typename T>
ReturnedValue DataViewPrototype::method_get(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
- if (!v || ctx->d()->callData->argc < 1)
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
return scope.engine->throwTypeError();
- double l = ctx->d()->callData->args[0].toNumber();
+ double l = ctx->args()[0].toNumber();
uint idx = (uint)l;
if (l != idx || idx + sizeof(T) > v->d()->byteLength)
return scope.engine->throwTypeError();
idx += v->d()->byteOffset;
- bool littleEndian = ctx->d()->callData->argc < 2 ? false : ctx->d()->callData->args[1].toBoolean();
+ bool littleEndian = ctx->argc() < 2 ? false : ctx->args()[1].toBoolean();
T t = littleEndian
? qFromLittleEndian<T>((uchar *)v->d()->buffer->data->data() + idx)
@@ -194,16 +194,16 @@ template <typename T>
ReturnedValue DataViewPrototype::method_getFloat(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
- if (!v || ctx->d()->callData->argc < 1)
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
return scope.engine->throwTypeError();
- double l = ctx->d()->callData->args[0].toNumber();
+ double l = ctx->args()[0].toNumber();
uint idx = (uint)l;
if (l != idx || idx + sizeof(T) > v->d()->byteLength)
return scope.engine->throwTypeError();
idx += v->d()->byteOffset;
- bool littleEndian = ctx->d()->callData->argc < 2 ? false : ctx->d()->callData->args[1].toBoolean();
+ bool littleEndian = ctx->argc() < 2 ? false : ctx->args()[1].toBoolean();
if (sizeof(T) == 4) {
// float
@@ -232,16 +232,16 @@ template <typename T>
ReturnedValue DataViewPrototype::method_setChar(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
- if (!v || ctx->d()->callData->argc < 1)
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
return scope.engine->throwTypeError();
- double l = ctx->d()->callData->args[0].toNumber();
+ double l = ctx->args()[0].toNumber();
uint idx = (uint)l;
if (l != idx || idx + sizeof(T) > v->d()->byteLength)
return scope.engine->throwTypeError();
idx += v->d()->byteOffset;
- int val = ctx->d()->callData->argc >= 2 ? ctx->d()->callData->args[1].toInt32() : 0;
+ int val = ctx->argc() >= 2 ? ctx->args()[1].toInt32() : 0;
v->d()->buffer->data->data()[idx] = (char)val;
return Encode::undefined();
@@ -251,18 +251,18 @@ template <typename T>
ReturnedValue DataViewPrototype::method_set(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
- if (!v || ctx->d()->callData->argc < 1)
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
return scope.engine->throwTypeError();
- double l = ctx->d()->callData->args[0].toNumber();
+ double l = ctx->args()[0].toNumber();
uint idx = (uint)l;
if (l != idx || idx + sizeof(T) > v->d()->byteLength)
return scope.engine->throwTypeError();
idx += v->d()->byteOffset;
- int val = ctx->d()->callData->argc >= 2 ? ctx->d()->callData->args[1].toInt32() : 0;
+ int val = ctx->argc() >= 2 ? ctx->args()[1].toInt32() : 0;
- bool littleEndian = ctx->d()->callData->argc < 3 ? false : ctx->d()->callData->args[2].toBoolean();
+ bool littleEndian = ctx->argc() < 3 ? false : ctx->args()[2].toBoolean();
if (littleEndian)
qToLittleEndian<T>(val, (uchar *)v->d()->buffer->data->data() + idx);
@@ -276,17 +276,17 @@ template <typename T>
ReturnedValue DataViewPrototype::method_setFloat(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DataView> v(scope, ctx->d()->callData->thisObject);
- if (!v || ctx->d()->callData->argc < 1)
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
return scope.engine->throwTypeError();
- double l = ctx->d()->callData->args[0].toNumber();
+ double l = ctx->args()[0].toNumber();
uint idx = (uint)l;
if (l != idx || idx + sizeof(T) > v->d()->byteLength)
return scope.engine->throwTypeError();
idx += v->d()->byteOffset;
- double val = ctx->d()->callData->argc >= 2 ? ctx->d()->callData->args[1].toNumber() : qSNaN();
- bool littleEndian = ctx->d()->callData->argc < 3 ? false : ctx->d()->callData->args[2].toBoolean();
+ double val = ctx->argc() >= 2 ? ctx->args()[1].toNumber() : qSNaN();
+ bool littleEndian = ctx->argc() < 3 ? false : ctx->args()[2].toBoolean();
if (sizeof(T) == 4) {
// float