diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-08-26 21:38:32 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-28 21:45:57 +0000 |
commit | 2d1a50228571a82ab7a098a64ef04b4ccfe7ee15 (patch) | |
tree | 4eee70b34996bc560660e881a6a1db4d28fb91d4 /src | |
parent | f497bd50456efb7adbcb4be88c0ba2310445d166 (diff) |
Fix most issues with Map.prototype.forEach
Change-Id: I730f00c6fc2a5f2275b92b09994f6e27dc6a3da4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4estable.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4mapobject.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4estable.cpp b/src/qml/jsruntime/qv4estable.cpp index 4b0eddb989..aa39971dc6 100644 --- a/src/qml/jsruntime/qv4estable.cpp +++ b/src/qml/jsruntime/qv4estable.cpp @@ -157,8 +157,8 @@ bool ESTable::remove(const Value &key) } if (found == true) { - memmove(m_keys + idx, m_keys + idx + 1, m_size - idx); - memmove(m_values + idx, m_values + idx + 1, m_size - idx); + memmove(m_keys + idx, m_keys + idx + 1, (m_size - idx)*sizeof(Value)); + memmove(m_values + idx, m_values + idx + 1, (m_size - idx)*sizeof(Value)); m_size--; } return found; diff --git a/src/qml/jsruntime/qv4mapobject.cpp b/src/qml/jsruntime/qv4mapobject.cpp index 2c7978a14f..c598814fb6 100644 --- a/src/qml/jsruntime/qv4mapobject.cpp +++ b/src/qml/jsruntime/qv4mapobject.cpp @@ -303,10 +303,10 @@ ReturnedValue MapPrototype::method_forEach(const FunctionObject *b, const Value thisArg = ScopedValue(scope, argv[1]); Value *arguments = scope.alloc(3); + arguments[2] = that; for (uint i = 0; i < that->d()->esTable->size(); ++i) { - that->d()->esTable->iterate(i, &arguments[0], &arguments[1]); // fill in key (0), value (1) + that->d()->esTable->iterate(i, &arguments[1], &arguments[0]); // fill in key (0), value (1) - arguments[2] = that; callbackfn->call(thisArg, arguments, 3); CHECK_EXCEPTION(); } |