avoid compile warning when using clang++ with -Wshorten-64-to-32

Change-Id: I78a6cd84ac5b8c250d9569d864a7e38269b85e10
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Martin Koller 2020-03-07 21:57:57 +01:00
parent 033d01bd6e
commit ce672e1c9b
5 changed files with 7 additions and 7 deletions

View File

@ -230,7 +230,7 @@ headersclean:!internal_module {
hcleanFLAGS += -Wcast-align hcleanFLAGS += -Wcast-align
clang_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION} clang_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION}
versionAtLeast(clang_ver, 3.8): hcleanFLAGS += -Wdouble-promotion versionAtLeast(clang_ver, 3.8): hcleanFLAGS += -Wdouble-promotion -Wshorten-64-to-32
!clang { !clang {
# options accepted only by GCC # options accepted only by GCC

View File

@ -76,14 +76,14 @@ Q_REQUIRED_RESULT static bool qWaitFor(Functor predicate, int timeout = 5000)
QCoreApplication::processEvents(QEventLoop::AllEvents); QCoreApplication::processEvents(QEventLoop::AllEvents);
QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
remaining = deadline.remainingTime(); remaining = int(deadline.remainingTime());
if (remaining > 0) if (remaining > 0)
QTestPrivate::qSleep(qMin(10, remaining)); QTestPrivate::qSleep(qMin(10, remaining));
if (predicate()) if (predicate())
return true; return true;
remaining = deadline.remainingTime(); remaining = int(deadline.remainingTime());
} while (remaining > 0); } while (remaining > 0);
return predicate(); // Last chance return predicate(); // Last chance

View File

@ -120,7 +120,7 @@ private:
if (!QConcatenable< QStringBuilder<A, B> >::ExactSize && int(len) != d - start) { if (!QConcatenable< QStringBuilder<A, B> >::ExactSize && int(len) != d - start) {
// this resize is necessary since we allocate a bit too much // this resize is necessary since we allocate a bit too much
// when dealing with variable sized 8-bit encodings // when dealing with variable sized 8-bit encodings
s.resize(d - start); s.resize(int(d - start));
} }
return s; return s;
} }

View File

@ -671,7 +671,7 @@ int indexOf(const QVector<T> &vector, const U &u, int from)
auto e = vector.end(); auto e = vector.end();
while (++n != e) while (++n != e)
if (*n == u) if (*n == u)
return n - vector.begin(); return int(n - vector.begin());
} }
return -1; return -1;
} }
@ -688,7 +688,7 @@ int lastIndexOf(const QVector<T> &vector, const U &u, int from)
auto n = vector.begin() + from + 1; auto n = vector.begin() + from + 1;
while (n != b) { while (n != b) {
if (*--n == u) if (*--n == u)
return n - b; return int(n - b);
} }
} }
return -1; return -1;

View File

@ -97,7 +97,7 @@ template<> inline char *toString(const QBitArray &ba)
qsizetype size = ba.size(); qsizetype size = ba.size();
char *str = new char[size + 1]; char *str = new char[size + 1];
for (qsizetype i = 0; i < size; ++i) for (qsizetype i = 0; i < size; ++i)
str[i] = "01"[ba.testBit(i)]; str[i] = "01"[ba.testBit(int(i))];
str[size] = '\0'; str[size] = '\0';
return str; return str;
} }