Fix some MSVC warnings in tests

tst_qvariant.cpp(80): warning C4309: 'initializing': truncation of constant value
tst_qvariant.cpp(4635): warning C4309: 'initializing': truncation of constant value
tst_qbytearray.cpp(1438): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data
tst_qbytearray.cpp(1440): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data
http2srv.cpp(64): warning C4018: '<=': signed/unsigned mismatch
tst_qinputdialog.cpp(352): warning C4804: '<=': unsafe use of type 'bool' in operation

Change-Id: Id012d88b7b20c5c9f128f2ef53753cc1d479f358
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Friedemann Kleint 2017-06-27 10:01:36 +02:00
parent 4f7be34a42
commit 5d31b52a12
4 changed files with 7 additions and 6 deletions

View File

@ -77,7 +77,7 @@ public:
enum MetaEnumTest_Enum0 { MetaEnumTest_Enum0_dummy = 2, MetaEnumTest_Enum0_value = 42, MetaEnsureSignedEnum0 = -1 };
Q_ENUM(MetaEnumTest_Enum0)
enum MetaEnumTest_Enum1 { MetaEnumTest_Enum1_value = 42, MetaEnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 };
enum MetaEnumTest_Enum1 : qint64 { MetaEnumTest_Enum1_value = 42, MetaEnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 };
Q_ENUM(MetaEnumTest_Enum1)
enum MetaEnumTest_Enum3 ENUM_SIZE(qint64) { MetaEnumTest_Enum3_value = -47, MetaEnumTest_Enum3_bigValue = (Q_INT64_C(1) << 56) + 5, MetaEnumTest_Enum3_bigNegValue = -(Q_INT64_C(1) << 56) - 3 };
@ -4632,7 +4632,7 @@ void tst_QVariant::pairElements()
enum EnumTest_Enum0 { EnumTest_Enum0_value = 42, EnumTest_Enum0_negValue = -8 };
Q_DECLARE_METATYPE(EnumTest_Enum0)
enum EnumTest_Enum1 { EnumTest_Enum1_value = 42, EnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 };
enum EnumTest_Enum1 : qint64 { EnumTest_Enum1_value = 42, EnumTest_Enum1_bigValue = (Q_INT64_C(1) << 33) + 50 };
Q_DECLARE_METATYPE(EnumTest_Enum1)
#if defined(Q_COMPILER_CLASS_ENUM)

View File

@ -1372,7 +1372,7 @@ void tst_QByteArray::toULongLong()
QCOMPARE(b, ok);
}
static bool checkSize(size_t value, uint min)
static bool checkSize(size_t value, size_t min)
{
return value >= min && value <= INT_MAX;
}

View File

@ -61,7 +61,7 @@ namespace
inline bool is_valid_client_stream(quint32 streamID)
{
// A valid client stream ID is an odd integer number in the range [1, INT_MAX].
return (streamID & 0x1) && streamID <= std::numeric_limits<qint32>::max();
return (streamID & 0x1) && streamID <= quint32(std::numeric_limits<qint32>::max());
}
void fill_push_header(const HttpHeader &originalRequest, HttpHeader &promisedRequest)

View File

@ -349,11 +349,12 @@ void tst_QInputDialog::taskQTBUG_54693_crashWhenParentIsDeletedWhileDialogIsOpen
}
// getItem
for (int editable = false; editable <= true; ++editable) {
for (int editable = 0; editable < 2; ++editable) {
QAutoPointer<SelfDestructParent> dialog(new SelfDestructParent);
bool ok = true;
const QString result = QInputDialog::getItem(dialog.get(), "Title", "Label",
QStringList() << "1" << "2", 1, editable, &ok);
QStringList() << "1" << "2", 1,
editable != 0, &ok);
QVERIFY(!dialog);
QVERIFY(!ok);
QCOMPARE(result, QLatin1String("2"));