diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2020-01-16 16:25:06 +0100 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2020-01-16 16:25:06 +0100 |
commit | 1d333d3375874efb8d37df37dc5ef561573794ad (patch) | |
tree | 2d8c995f64c05c84c1fcceb2c5cb40fcae69855f /src/qml/compiler/qv4compiler.cpp | |
parent | b106d86c433706928b0b0c206a0d9f831681e1bf (diff) | |
parent | e79a2658cde899d6ee11ec3c0d0a3768eb2c864b (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: I0c5b939c70bdb91ccdf7068784308416dcaa5736
Diffstat (limited to 'src/qml/compiler/qv4compiler.cpp')
-rw-r--r-- | src/qml/compiler/qv4compiler.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp index acc4b02e96..0c0a005689 100644 --- a/src/qml/compiler/qv4compiler.cpp +++ b/src/qml/compiler/qv4compiler.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtQml module of the Qt Toolkit. @@ -47,6 +48,7 @@ #include <private/qml_compile_hash_p.h> #include <private/qqmlirbuilder_p.h> #include <QCryptographicHash> +#include <QtEndian> // Efficient implementation that takes advantage of powers of two. static inline size_t roundUpToMultipleOf(size_t divisor, size_t x) @@ -108,19 +110,11 @@ void QV4::Compiler::StringTableGenerator::serialize(CompiledData::Unit *unit) QV4::CompiledData::String *s = reinterpret_cast<QV4::CompiledData::String *>(stringData); Q_ASSERT(reinterpret_cast<uintptr_t>(s) % alignof(QV4::CompiledData::String) == 0); - s->refcount = -1; + Q_ASSERT(qstr.length() >= 0); s->size = qstr.length(); - s->allocAndCapacityReservedFlag = 0; - s->offsetOn32Bit = sizeof(QV4::CompiledData::String); - s->offsetOn64Bit = sizeof(QV4::CompiledData::String); ushort *uc = reinterpret_cast<ushort *>(reinterpret_cast<char *>(s) + sizeof(*s)); -#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN - memcpy(uc, qstr.constData(), s->size * sizeof(ushort)); -#else - for (int i = 0; i < s->size; ++i) - uc[i] = qToLittleEndian<ushort>(qstr.at(i).unicode()); -#endif + qToLittleEndian<ushort>(qstr.constData(), s->size, uc); uc[s->size] = 0; stringData += QV4::CompiledData::String::calculateSize(qstr); |