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 744e55b85a, where the explicit cast to size_t
was introduced.
Pick-to: 6.0
Change-Id: I2750a6f48fc09730aa9fa21dcc31f82e33b48b8b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
bb10
parent
9198d7f044
commit
189bc8dd15
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue