aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-07-07 12:24:25 +0200
committerLars Knoll <lars.knoll@qt.io>2020-07-09 20:59:58 +0200
commitaef0aac581fbbead07be939873e34045137b94ff (patch)
tree8c3ba5f67027a1c7fef1ce3e6bbfbc3379558af3
parent03d039fcf255392d52b0fd4b6c47cedf546aa82f (diff)
Compile against latest qtbase
Adjust to the lastest changes in QList and QString. Change-Id: I216b2746a3305222a21c5aead3aec6106ac1f035 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--src/particles/qquickmaskextruder.cpp2
-rw-r--r--src/qml/jsruntime/qv4arraybuffer.cpp6
-rw-r--r--src/qml/jsruntime/qv4urlobject.cpp2
-rw-r--r--src/qml/qml/ftw/qstringhash_p.h17
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp2
-rw-r--r--src/qmlmodels/qqmllistmodel.cpp3
-rw-r--r--tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp2
-rw-r--r--tests/auto/quick/qquicklistview/randomsortmodel.cpp4
-rw-r--r--tools/qmllint/checkidentifiers.cpp2
9 files changed, 23 insertions, 17 deletions
diff --git a/src/particles/qquickmaskextruder.cpp b/src/particles/qquickmaskextruder.cpp
index 61f9092f0a..f1726a51d4 100644
--- a/src/particles/qquickmaskextruder.cpp
+++ b/src/particles/qquickmaskextruder.cpp
@@ -107,7 +107,7 @@ QPointF QQuickMaskExtruder::extrude(const QRectF &r)
ensureInitialized(r);
if (!m_mask.count() || m_img.isNull())
return r.topLeft();
- const QPointF p = m_mask[QRandomGenerator::global()->bounded(m_mask.count())];
+ const QPointF p = m_mask[QRandomGenerator::global()->bounded(int(m_mask.count()))];
//### Should random sub-pixel positioning be added?
return p + r.topLeft();
}
diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp
index a2fac21b29..3b361bcaf5 100644
--- a/src/qml/jsruntime/qv4arraybuffer.cpp
+++ b/src/qml/jsruntime/qv4arraybuffer.cpp
@@ -135,7 +135,7 @@ void Heap::SharedArrayBuffer::init(size_t length)
internalClass->engine->throwRangeError(QStringLiteral("ArrayBuffer: out of memory"));
return;
}
- auto data = new (&d) QArrayDataPointer<char>{ pair.first, pair.second, uint(length) };
+ auto data = new (&d) QArrayDataPointer<char>{ pair.first, pair.second, qsizetype(length) };
// can't use appendInitialize() because we want to set the terminating '\0'
memset(data->data(), 0, length + 1);
@@ -187,7 +187,7 @@ ReturnedValue SharedArrayBufferPrototype::method_get_byteLength(const FunctionOb
if (!a || a->isDetachedBuffer() || !a->isSharedArrayBuffer())
return b->engine()->throwTypeError();
- return Encode(a->d()->data()->size);
+ return Encode(int(a->d()->data()->size));
}
ReturnedValue SharedArrayBufferPrototype::method_slice(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
@@ -252,7 +252,7 @@ ReturnedValue ArrayBufferPrototype::method_get_byteLength(const FunctionObject *
if (!a || a->isDetachedBuffer() || a->isSharedArrayBuffer())
return f->engine()->throwTypeError();
- return Encode(a->d()->data()->size);
+ return Encode(int(a->d()->data()->size));
}
ReturnedValue ArrayBufferPrototype::method_slice(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
diff --git a/src/qml/jsruntime/qv4urlobject.cpp b/src/qml/jsruntime/qv4urlobject.cpp
index 6f9a9ecb69..937cd6e3a2 100644
--- a/src/qml/jsruntime/qv4urlobject.cpp
+++ b/src/qml/jsruntime/qv4urlobject.cpp
@@ -1270,7 +1270,7 @@ ReturnedValue UrlSearchParamsPrototype::method_set(const FunctionObject *b, cons
bool matched = false;
- for (auto *it = params.begin(); it != params.end();) {
+ for (auto it = params.begin(); it != params.end();) {
QStringList &param = *it;
if (param[0] == name) {
if (!matched) {
diff --git a/src/qml/qml/ftw/qstringhash_p.h b/src/qml/qml/ftw/qstringhash_p.h
index 7a2184d63f..c4411b4814 100644
--- a/src/qml/qml/ftw/qstringhash_p.h
+++ b/src/qml/qml/ftw/qstringhash_p.h
@@ -78,7 +78,8 @@ public:
, arrayData(mutableStringData(key).d_ptr())
, strData(mutableStringData(key).data())
{
- arrayData->ref();
+ if (arrayData)
+ arrayData->ref();
setQString(true);
}
@@ -93,7 +94,8 @@ public:
setQString(o.isQString());
if (isQString()) {
strData = o.strData;
- arrayData->ref();
+ if (arrayData)
+ arrayData->ref();
} else {
ckey = o.ckey;
}
@@ -101,7 +103,7 @@ public:
~QStringHashNode()
{
- if (isQString() && !arrayData->deref())
+ if (isQString() && arrayData && !arrayData->deref())
QTypedArrayData<char16_t>::deallocate(arrayData);
}
@@ -125,7 +127,8 @@ public:
inline QHashedString key() const
{
if (isQString()) {
- arrayData->ref();
+ if (arrayData)
+ arrayData->ref();
return QHashedString(QString(QStringPrivate(arrayData, strData, length)), hash);
}
@@ -528,7 +531,8 @@ void QStringHash<T>::initializeNode(Node *node, const QHashedString &key)
node->hash = key.hash();
node->arrayData = mutableStringData(key).d_ptr();
node->strData = mutableStringData(key).data();
- node->arrayData->ref();
+ if (node->arrayData)
+ node->arrayData->ref();
node->setQString(true);
}
@@ -568,7 +572,8 @@ typename QStringHash<T>::Node *QStringHash<T>::takeNode(const Node &o)
if (o.isQString()) {
rv->strData = o.strData;
rv->setQString(true);
- rv->arrayData->ref();
+ if (rv->arrayData)
+ rv->arrayData->ref();
} else {
rv->ckey = o.ckey;
}
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 9b06bd77ca..aeb57a7768 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -702,7 +702,7 @@ ReturnedValue CharacterData::method_length(const FunctionObject *b, const Value
if (!r)
RETURN_UNDEFINED();
- return Encode(r->d()->d->data.length());
+ return Encode(int(r->d()->d->data.length()));
}
ReturnedValue CharacterData::prototype(ExecutionEngine *v4)
diff --git a/src/qmlmodels/qqmllistmodel.cpp b/src/qmlmodels/qqmllistmodel.cpp
index d51b9c1c1e..39fdb1c582 100644
--- a/src/qmlmodels/qqmllistmodel.cpp
+++ b/src/qmlmodels/qqmllistmodel.cpp
@@ -284,7 +284,8 @@ void StringOrTranslation::setString(const QString &s)
arrayData = dataPointer->d_ptr();
stringData = dataPointer->data();
stringSize = mutableString.length();
- arrayData->ref();
+ if (arrayData)
+ arrayData->ref();
}
void StringOrTranslation::setTranslation(const QV4::CompiledData::Binding *binding)
diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
index aaad5a2b89..41a8b4d057 100644
--- a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
+++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
@@ -282,7 +282,7 @@ void tst_qquickanimatedsprite::test_largeAnimation()
sprite->setRunning(true);
QTRY_VERIFY_WITH_TIMEOUT(!sprite->running(), 100000 /* make sure we wait until its done*/ );
if (frameSync)
- QVERIFY(isWithinRange(3*40, frameChangedSpy.count(), 3*40 + 1));
+ QVERIFY(isWithinRange(3*40, int(frameChangedSpy.count()), 3*40 + 1));
int prevFrame = -1;
int loopCounter = 0;
int maxFrame = 0;
diff --git a/tests/auto/quick/qquicklistview/randomsortmodel.cpp b/tests/auto/quick/qquicklistview/randomsortmodel.cpp
index 7375fe0dbe..65d7fdb6e8 100644
--- a/tests/auto/quick/qquicklistview/randomsortmodel.cpp
+++ b/tests/auto/quick/qquicklistview/randomsortmodel.cpp
@@ -74,14 +74,14 @@ QVariant RandomSortModel::data(const QModelIndex& index, int role) const
void RandomSortModel::randomize()
{
- const int row = QRandomGenerator::global()->bounded(mData.count());
+ const int row = QRandomGenerator::global()->bounded(int(mData.count()));
int random;
bool exists = false;
// Make sure we won't end up with two items with the same weight, as that
// would make unit-testing much harder
do {
exists = false;
- random = QRandomGenerator::global()->bounded(mData.count() * 10);
+ random = QRandomGenerator::global()->bounded(int(mData.count() * 10));
QList<QPair<QString, int> >::ConstIterator iter, end;
for (iter = mData.constBegin(), end = mData.constEnd(); iter != end; ++iter) {
if ((*iter).second == random) {
diff --git a/tools/qmllint/checkidentifiers.cpp b/tools/qmllint/checkidentifiers.cpp
index 09678c2e6a..6f28709a87 100644
--- a/tools/qmllint/checkidentifiers.cpp
+++ b/tools/qmllint/checkidentifiers.cpp
@@ -37,7 +37,7 @@ class IssueLocationWithContext
{
public:
IssueLocationWithContext(const QString &code, const QQmlJS::SourceLocation &location) {
- int before = std::max(0,code.lastIndexOf(QLatin1Char('\n'), location.offset));
+ int before = qMax(0,code.lastIndexOf(QLatin1Char('\n'), location.offset));
m_beforeText = QStringView{code}.mid(before + 1, int(location.offset - (before + 1)));
m_issueText = QStringView{code}.mid(location.offset, location.length);
int after = code.indexOf(QLatin1Char('\n'), int(location.offset + location.length));