Fix some compiler warnings from tests

For iterators that return a value, don't use reference in ranged for,
and cast numeric literal to correct size type for QCOMPARE.

Change-Id: Idfd09dbc2ef3ab1bf025c7859ea6e2e9572bc9a1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-10-16 10:44:59 +02:00
parent c6b3680bcf
commit d72ff6ffd0
2 changed files with 3 additions and 3 deletions

View File

@ -790,7 +790,7 @@ void tst_QCborValue::arrayInitializerList()
// range for
int i = 0;
for (const QCborValue &v : qAsConst(a)) {
for (const QCborValue v : qAsConst(a)) {
QVERIFY(!v.isInvalid());
QCOMPARE(v.isUndefined(), i == 5); // 6th element is Undefined
++i;

View File

@ -426,9 +426,9 @@ void tst_QStringView::literals() const
}
// these are different results
QCOMPARE(size_t(QStringView(withnull).size()), 1);
QCOMPARE(size_t(QStringView(withnull).size()), size_t(1));
QCOMPARE(size_t(QStringView::fromArray(withnull).size()), sizeof(withnull)/sizeof(withnull[0]));
QCOMPARE(QStringView(withnull + 0).size(), 1);
QCOMPARE(QStringView(withnull + 0).size(), qsizetype(1));
}
void tst_QStringView::fromArray() const