From 189bc8dd1546c56d9c4986024a345dcb2604ed04 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 8 Dec 2020 12:55:34 +0100 Subject: Fix MSVC warning C4267 in qstring.cpp Fix warnings qstring.cpp(9650): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data qstring.cpp(9654): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data QDataStream::writeBytes expects an uint as second parameter, not size_t. This reverts parts of 744e55b85a96b37a, where the explicit cast to size_t was introduced. Pick-to: 6.0 Change-Id: I2750a6f48fc09730aa9fa21dcc31f82e33b48b8b Reviewed-by: Lars Knoll --- src/corelib/text/qstring.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 35a5ba9b40..af7bc039fd 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -9647,11 +9647,13 @@ QDataStream &operator<<(QDataStream &out, const QString &str) } else { if (!str.isNull() || out.version() < 3) { if ((out.byteOrder() == QDataStream::BigEndian) == (QSysInfo::ByteOrder == QSysInfo::BigEndian)) { - out.writeBytes(reinterpret_cast(str.unicode()), size_t(sizeof(QChar) * str.length())); + out.writeBytes(reinterpret_cast(str.unicode()), + static_cast(sizeof(QChar) * str.length())); } else { QVarLengthArray buffer(str.length()); qbswap(str.constData(), str.length(), buffer.data()); - out.writeBytes(reinterpret_cast(buffer.data()), size_t(sizeof(char16_t) * buffer.size())); + out.writeBytes(reinterpret_cast(buffer.data()), + static_cast(sizeof(char16_t) * buffer.size())); } } else { // write null marker -- cgit v1.2.3