diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 82e79e5e01c..faafc8cff13 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1632,7 +1632,7 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con } else if (timeFormat == "boot"_L1) { // just print the milliseconds since the elapsed timer reference // like the Linux kernel does - uint ms = QDeadlineTimer::current().deadline(); + qint64 ms = QDeadlineTimer::current().deadline(); message.append(QString::asprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000))); #if QT_CONFIG(datestring) } else if (timeFormat.isEmpty()) { diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index 3b53b490f51..a37eecfebdf 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -334,7 +334,7 @@ void QInotifyFileSystemWatcherEngine::readFromInotify() return; QVarLengthArray buffer(buffSize); - buffSize = read(inotifyFd, buffer.data(), buffSize); + buffSize = int(read(inotifyFd, buffer.data(), buffSize)); char *at = buffer.data(); char * const end = at + buffSize; diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 29752c8e4cb..81c2bc16959 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1500,7 +1500,7 @@ qint64 QIODevice::readLineData(char *data, qint64 maxSize) Q_D(QIODevice); qint64 readSoFar = 0; char c; - int lastReadReturn = 0; + qint64 lastReadReturn = 0; d->baseReadLineDataCalled = true; while (readSoFar < maxSize && (lastReadReturn = read(&c, 1)) == 1) { diff --git a/src/corelib/io/qipaddress.cpp b/src/corelib/io/qipaddress.cpp index 9956f03738a..c2b274f8b56 100644 --- a/src/corelib/io/qipaddress.cpp +++ b/src/corelib/io/qipaddress.cpp @@ -61,7 +61,7 @@ static bool parseIp4Internal(IPv4Address &address, const char *ptr, bool acceptL return false; auto [ll, used] = qstrntoull(ptr, stop - ptr, 0); - quint32 x = ll; + const quint32 x = quint32(ll); if (used <= 0 || ll != x) return false; diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index 34aa3b65ec6..47aff8b9737 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -170,7 +170,7 @@ bool QLockFilePrivate::removeStaleLock() bool QLockFilePrivate::isProcessRunning(qint64 pid, const QString &appname) { - if (::kill(pid, 0) == -1 && errno == ESRCH) + if (::kill(pid_t(pid), 0) == -1 && errno == ESRCH) return false; // PID doesn't exist anymore const QString processName = processNameByPid(pid); diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 27c1403226d..24c5ebc6d2c 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -95,8 +95,8 @@ struct AutoPipe struct ChildError { - qint64 code; - char function[8]; + int code; + char function[12]; }; // Used for argv and envp arguments to execve() @@ -568,7 +568,7 @@ bool QProcessPrivate::processStarted(QString *errorMessage) Q_Q(QProcess); ChildError buf; - int ret = qt_safe_read(childStartedPipe[0], &buf, sizeof(buf)); + ssize_t ret = qt_safe_read(childStartedPipe[0], &buf, sizeof(buf)); if (stateNotifier) { stateNotifier->setEnabled(false); diff --git a/src/corelib/serialization/qxmlutils.cpp b/src/corelib/serialization/qxmlutils.cpp index 00a1121280d..e6fae7c173f 100644 --- a/src/corelib/serialization/qxmlutils.cpp +++ b/src/corelib/serialization/qxmlutils.cpp @@ -48,7 +48,7 @@ bool QXmlUtils::rangeContains(RangeIter begin, RangeIter end, const QChar c) return cp >= begin->min; while (begin != end) { - int delta = (end - begin) / 2; + qptrdiff delta = (end - begin) / 2; RangeIter mid = begin + delta; if (mid->min > cp) diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 64ad2c537b3..ab76aadd1dd 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -981,7 +981,7 @@ Q_CORE_EXPORT void qt_from_latin1(char16_t *dst, const char *str, size_t size) n return; } else { size = size % 4; - return UnrollTailLoop<3>::exec(qsizetype(size), [=](int i) { dst[i] = (uchar)str[i]; }); + return UnrollTailLoop<3>::exec(qsizetype(size), [=](qsizetype i) { dst[i] = uchar(str[i]); }); } # endif #endif diff --git a/src/corelib/text/qstringmatcher.cpp b/src/corelib/text/qstringmatcher.cpp index 39fd45cfff9..ac66ec802e3 100644 --- a/src/corelib/text/qstringmatcher.cpp +++ b/src/corelib/text/qstringmatcher.cpp @@ -13,7 +13,7 @@ static void bm_init_skiptable(QStringView needle, uchar *skiptable, Qt::CaseSens const char16_t *uc = needle.utf16(); const qsizetype len = cs == Qt::CaseSensitive ? needle.size() : qMin(needle.size(), FoldBufferCapacity); - qsizetype l = qMin(len, qsizetype(255)); + int l = qMin(int(len), 255); memset(skiptable, l, 256 * sizeof(uchar)); uc += len - l; if (cs == Qt::CaseSensitive) { diff --git a/src/corelib/time/qgregoriancalendar.cpp b/src/corelib/time/qgregoriancalendar.cpp index 69a3665eeec..1a4d3e5569a 100644 --- a/src/corelib/time/qgregoriancalendar.cpp +++ b/src/corelib/time/qgregoriancalendar.cpp @@ -93,7 +93,7 @@ bool QGregorianCalendar::validParts(int year, int month, int day) int QGregorianCalendar::weekDayOfJulian(qint64 jd) { - return qMod<7>(jd) + 1; + return int(qMod<7>(jd) + 1); } bool QGregorianCalendar::dateToJulianDay(int year, int month, int day, qint64 *jd) const diff --git a/src/testlib/qbenchmarkperfevents.cpp b/src/testlib/qbenchmarkperfevents.cpp index 1b9101e854a..c161879a7db 100644 --- a/src/testlib/qbenchmarkperfevents.cpp +++ b/src/testlib/qbenchmarkperfevents.cpp @@ -108,7 +108,8 @@ static QList defaultCounters() static int perf_event_open(perf_event_attr *attr, pid_t pid, int cpu, int group_fd, unsigned long flags) { #ifdef SYS_perf_event_open - return syscall(SYS_perf_event_open, attr, pid, cpu, group_fd, flags); + // syscall() returns long, but perf_event_open() is used to get a file descriptor + return int(syscall(SYS_perf_event_open, attr, pid, cpu, group_fd, flags)); #else Q_UNUSED(attr); Q_UNUSED(pid);