From b18ba91c671f01d4c93470747cd34a2231567e3b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 10 Feb 2024 12:37:59 -0800 Subject: QDataStream: don't store the byteorder member in Qt 7 It's redundant with the noswap member: we swap if the stream byte order is the opposite of the CPU's and don't swap if it is the same. That the default is to swap is another reason why people should stop using QDataStream (though CBOR also stores numbers in big-endian). Change-Id: I50e2158aeade4256ad1dfffd17b29adc2b698ead Reviewed-by: Ivan Solovev Reviewed-by: Edward Welbourne --- src/corelib/serialization/qdatastream.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/corelib/serialization/qdatastream.cpp') diff --git a/src/corelib/serialization/qdatastream.cpp b/src/corelib/serialization/qdatastream.cpp index f1572b46c7d..57713d36459 100644 --- a/src/corelib/serialization/qdatastream.cpp +++ b/src/corelib/serialization/qdatastream.cpp @@ -476,11 +476,14 @@ void QDataStream::setStatus(Status status) void QDataStream::setByteOrder(ByteOrder bo) { +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED) + // accessed by inline byteOrder() prior to Qt 6.8 byteorder = bo; +#endif if (QSysInfo::ByteOrder == QSysInfo::BigEndian) - noswap = (byteorder == BigEndian); + noswap = (bo == BigEndian); else - noswap = (byteorder == LittleEndian); + noswap = (bo == LittleEndian); } -- cgit v1.2.3