summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2020-12-08 12:55:34 +0100
committerKai Koehne <kai.koehne@qt.io>2020-12-08 15:15:58 +0100
commit189bc8dd1546c56d9c4986024a345dcb2604ed04 (patch)
treea052513954d0875c6ff3dfa7501165af45b48ed6
parent9198d7f0444235b2c79b91834f725add56ea049e (diff)
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 <lars.knoll@qt.io>
-rw-r--r--src/corelib/text/qstring.cpp6
1 files changed, 4 insertions, 2 deletions
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<const char *>(str.unicode()), size_t(sizeof(QChar) * str.length()));
+ out.writeBytes(reinterpret_cast<const char *>(str.unicode()),
+ static_cast<uint>(sizeof(QChar) * str.length()));
} else {
QVarLengthArray<char16_t> buffer(str.length());
qbswap<sizeof(char16_t)>(str.constData(), str.length(), buffer.data());
- out.writeBytes(reinterpret_cast<const char *>(buffer.data()), size_t(sizeof(char16_t) * buffer.size()));
+ out.writeBytes(reinterpret_cast<const char *>(buffer.data()),
+ static_cast<uint>(sizeof(char16_t) * buffer.size()));
}
} else {
// write null marker