diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 4 | ||||
-rw-r--r-- | src/corelib/mimetypes/qmimemagicrule.cpp | 16 | ||||
-rw-r--r-- | src/gui/kernel/qplatformcursor.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformdialoghelper.cpp | 6 | ||||
-rw-r--r-- | src/gui/painting/qpagesize.cpp | 6 | ||||
-rw-r--r-- | src/network/access/http2/hpacktable.cpp | 2 | ||||
-rw-r--r-- | src/testlib/qbenchmarkmetric.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qcalendarwidget.cpp | 2 |
8 files changed, 18 insertions, 24 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 2fbd31b3d7..605683b852 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -3990,7 +3990,7 @@ Q_GLOBAL_STATIC(QInternal_CallBackTable, global_callback_table) bool QInternal::registerCallback(Callback cb, qInternalCallback callback) { - if (cb >= 0 && cb < QInternal::LastCallback) { + if (unsigned(cb) < unsigned(QInternal::LastCallback)) { QInternal_CallBackTable *cbt = global_callback_table(); cbt->callbacks.resize(cb + 1); cbt->callbacks[cb].append(callback); @@ -4001,7 +4001,7 @@ bool QInternal::registerCallback(Callback cb, qInternalCallback callback) bool QInternal::unregisterCallback(Callback cb, qInternalCallback callback) { - if (cb >= 0 && cb < QInternal::LastCallback) { + if (unsigned(cb) < unsigned(QInternal::LastCallback)) { if (global_callback_table.exists()) { QInternal_CallBackTable *cbt = global_callback_table(); return (bool) cbt->callbacks[cb].removeAll(callback); diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp index 6356a3581b..9dadebc999 100644 --- a/src/corelib/mimetypes/qmimemagicrule.cpp +++ b/src/corelib/mimetypes/qmimemagicrule.cpp @@ -315,18 +315,14 @@ QMimeMagicRule::QMimeMagicRule(const QString &type, break; case Big32: case Little32: - if (m_number <= quint32(-1)) { - m_number = m_type == Little32 ? qFromLittleEndian<quint32>(m_number) : qFromBigEndian<quint32>(m_number); - if (m_numberMask != 0) - m_numberMask = m_type == Little32 ? qFromLittleEndian<quint32>(m_numberMask) : qFromBigEndian<quint32>(m_numberMask); - } + m_number = m_type == Little32 ? qFromLittleEndian<quint32>(m_number) : qFromBigEndian<quint32>(m_number); + if (m_numberMask != 0) + m_numberMask = m_type == Little32 ? qFromLittleEndian<quint32>(m_numberMask) : qFromBigEndian<quint32>(m_numberMask); Q_FALLTHROUGH(); case Host32: - if (m_number <= quint32(-1)) { - if (m_numberMask == 0) - m_numberMask = quint32(-1); - m_matchFunction = &QMimeMagicRule::matchNumber<quint32>; - } + if (m_numberMask == 0) + m_numberMask = quint32(-1); + m_matchFunction = &QMimeMagicRule::matchNumber<quint32>; break; default: break; diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp index df78e7d896..bab26f6028 100644 --- a/src/gui/kernel/qplatformcursor.cpp +++ b/src/gui/kernel/qplatformcursor.cpp @@ -549,7 +549,7 @@ void QPlatformCursorImage::createSystemCursor(int id) void QPlatformCursorImage::set(Qt::CursorShape id) { QPlatformCursorImage *cursor = 0; - if (id >= 0 && id <= Qt::LastCursor) { + if (unsigned(id) <= unsigned(Qt::LastCursor)) { if (!systemCursorTable[id]) createSystemCursor(id); cursor = systemCursorTable[id]; diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index fbadb48f70..b456c1ca31 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -664,18 +664,18 @@ QStringList QFileDialogOptions::history() const void QFileDialogOptions::setLabelText(QFileDialogOptions::DialogLabel label, const QString &text) { - if (label >= 0 && label < DialogLabelCount) + if (unsigned(label) < unsigned(DialogLabelCount)) d->labels[label] = text; } QString QFileDialogOptions::labelText(QFileDialogOptions::DialogLabel label) const { - return (label >= 0 && label < DialogLabelCount) ? d->labels[label] : QString(); + return (unsigned(label) < unsigned(DialogLabelCount)) ? d->labels[label] : QString(); } bool QFileDialogOptions::isLabelExplicitlySet(DialogLabel label) { - return label >= 0 && label < DialogLabelCount && !d->labels[label].isEmpty(); + return unsigned(label) < unsigned(DialogLabelCount) && !d->labels[label].isEmpty(); } QUrl QFileDialogOptions::initialDirectory() const diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp index 8831d60d48..9cbe6ef911 100644 --- a/src/gui/painting/qpagesize.cpp +++ b/src/gui/painting/qpagesize.cpp @@ -762,7 +762,7 @@ QPageSizePrivate::QPageSizePrivate(QPageSize::PageSizeId pageSizeId) m_windowsId(0), m_units(QPageSize::Point) { - if (pageSizeId >= QPageSize::PageSizeId(0) && pageSizeId <= QPageSize::LastPageSize) + if (unsigned(pageSizeId) <= unsigned(QPageSize::LastPageSize)) init(pageSizeId, QString()); } @@ -1478,7 +1478,7 @@ QRect QPageSize::rectPixels(int resolution) const QString QPageSize::key(PageSizeId pageSizeId) { - if (pageSizeId < PageSizeId(0) || pageSizeId > LastPageSize) + if (unsigned(pageSizeId) > unsigned(LastPageSize)) return QString(); return QString::fromUtf8(qt_pageSizes[pageSizeId].mediaOption); } @@ -1497,7 +1497,7 @@ static QString msgImperialPageSizeInch(int width, int height) QString QPageSize::name(PageSizeId pageSizeId) { - if (pageSizeId < PageSizeId(0) || pageSizeId > LastPageSize) + if (unsigned(pageSizeId) > unsigned(LastPageSize)) return QString(); switch (pageSizeId) { diff --git a/src/network/access/http2/hpacktable.cpp b/src/network/access/http2/hpacktable.cpp index db9574e2bc..a90ee72d52 100644 --- a/src/network/access/http2/hpacktable.cpp +++ b/src/network/access/http2/hpacktable.cpp @@ -64,8 +64,6 @@ HeaderSize entry_size(const QByteArray &name, const QByteArray &value) const unsigned sum = unsigned(name.size()) + value.size(); if (std::numeric_limits<unsigned>::max() - 32 < sum) return HeaderSize(); - if (sum + 32 > std::numeric_limits<quint32>::max()) - return HeaderSize(); return HeaderSize(true, quint32(sum + 32)); } diff --git a/src/testlib/qbenchmarkmetric.cpp b/src/testlib/qbenchmarkmetric.cpp index 0f4f915ed3..88f4235d46 100644 --- a/src/testlib/qbenchmarkmetric.cpp +++ b/src/testlib/qbenchmarkmetric.cpp @@ -139,7 +139,7 @@ static const int NumEntries = sizeof(entries) / sizeof(entries[0]); */ const char * QTest::benchmarkMetricName(QBenchmarkMetric metric) { - if (metric >= 0 && metric < QTest::NumEntries) + if (unsigned(metric) < unsigned(QTest::NumEntries)) return entries[metric].name; return ""; @@ -151,7 +151,7 @@ const char * QTest::benchmarkMetricName(QBenchmarkMetric metric) */ const char * QTest::benchmarkMetricUnit(QBenchmarkMetric metric) { - if (metric >= 0 && metric < QTest::NumEntries) + if (unsigned(metric) < unsigned(QTest::NumEntries)) return entries[metric].unit; return ""; diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index 059fb21295..9559b58339 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -1005,7 +1005,7 @@ Qt::DayOfWeek QCalendarModel::dayOfWeekForColumn(int column) const int QCalendarModel::columnForDayOfWeek(Qt::DayOfWeek day) const { - if (day < 1 || day > 7) + if (day < 1 || unsigned(day) > unsigned(7)) return -1; int column = (int)day - (int)m_firstDay; if (column < 0) |