Revert "QUuid: use NSDMI to initialize the members"

This reverts commit c3c5d2cab0.
Reason for the revert - it breaks the purpose of the Qt::Uninitialized
ctor

The commit also updates the QUuid(quint128, QSysInfo::Endian) ctor
to avoid the compiler errors:

 error: member ‘QUuid::data*’ must be initialized by mem-initializer
 in ‘constexpr’ constructor

Pick-to: 6.6
Change-Id: I0057fab3d7203adaddad3e890129668923a9eef6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ivan Solovev 2023-07-12 11:38:30 +02:00 committed by Marc Mutz
parent 4bc0a08bea
commit f1ffc11e61

View File

@ -70,7 +70,7 @@ public:
} }
}; };
constexpr QUuid() noexcept {} constexpr QUuid() noexcept : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
constexpr QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, constexpr QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3,
uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) noexcept uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) noexcept
@ -183,10 +183,10 @@ public:
NSUUID *toNSUUID() const Q_DECL_NS_RETURNS_AUTORELEASED; NSUUID *toNSUUID() const Q_DECL_NS_RETURNS_AUTORELEASED;
#endif #endif
uint data1 = 0; uint data1;
ushort data2 = 0; ushort data2;
ushort data3 = 0; ushort data3;
uchar data4[8] = {}; uchar data4[8];
private: private:
static constexpr Id128Bytes bswap(Id128Bytes b) static constexpr Id128Bytes bswap(Id128Bytes b)
@ -244,6 +244,7 @@ inline QUuid QUuid::fromBytes(const void *bytes, QSysInfo::Endian order) noexcep
#ifdef __SIZEOF_INT128__ #ifdef __SIZEOF_INT128__
constexpr inline QUuid::QUuid(quint128 uuid, QSysInfo::Endian order) noexcept constexpr inline QUuid::QUuid(quint128 uuid, QSysInfo::Endian order) noexcept
: QUuid()
{ {
if (order == QSysInfo::LittleEndian) if (order == QSysInfo::LittleEndian)
uuid = qbswap(uuid); uuid = qbswap(uuid);