Make tst_qmldiskcache::regenerateAfterChange() pass on big endian systems

We cannot use reinterpret_cast here, because testUnit->constants()
returns a pointer to quint64_le data, which needs to be converted to
native endianness first.

Here I used the QV4::Value converter that accepts quint64, so this
conversion now happens implicitly.

Change-Id: Iff6e3e4554af8890e61cb06e6fd79339c7a14653
Pick-to: 6.0 6.1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Dmitry Shachnev 2021-02-09 21:29:49 +03:00
parent 707f7603fb
commit dab0d62b65
1 changed files with 2 additions and 3 deletions

View File

@ -376,9 +376,8 @@ void tst_qmldiskcache::regenerateAfterChange()
QCOMPARE(quint32(obj->nBindings), quint32(2));
QCOMPARE(quint32(obj->bindingTable()->type), quint32(QV4::CompiledData::Binding::Type_Number));
QCOMPARE(reinterpret_cast<const QV4::Value *>(testUnit->constants())
[obj->bindingTable()->value.constantValueIndex].doubleValue(),
double(42));
const QV4::Value value(testUnit->constants()[obj->bindingTable()->value.constantValueIndex]);
QCOMPARE(value.doubleValue(), double(42));
QCOMPARE(quint32(testUnit->functionTableSize), quint32(1));