summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qdatastream.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-02-10 12:37:59 -0800
committerThiago Macieira <thiago.macieira@intel.com>2024-03-12 12:51:43 -0800
commitb18ba91c671f01d4c93470747cd34a2231567e3b (patch)
treec875ec62c584c0d8c605f404b3ae75bde4c190d2 /src/corelib/serialization/qdatastream.cpp
parent6dfc92abe8796462eacd881cd896313d654df24d (diff)
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 <ivan.solovev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/serialization/qdatastream.cpp')
-rw-r--r--src/corelib/serialization/qdatastream.cpp7
1 files changed, 5 insertions, 2 deletions
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);
}