diff options
Diffstat (limited to 'src/corelib/kernel/qcore_foundation.mm')
-rw-r--r-- | src/corelib/kernel/qcore_foundation.mm | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/corelib/kernel/qcore_foundation.mm b/src/corelib/kernel/qcore_foundation.mm index 360b4aebd4..6d2451e078 100644 --- a/src/corelib/kernel/qcore_foundation.mm +++ b/src/corelib/kernel/qcore_foundation.mm @@ -10,7 +10,7 @@ #include <QtCore/qbytearray.h> #include <QtCore/qrect.h> -#if QT_CONFIG(timezone) && !defined(QT_NO_SYSTEMLOCALE) +#if QT_CONFIG(timezone) #include <QtCore/qtimezone.h> #include <QtCore/private/qtimezoneprivate_p.h> #include <QtCore/private/qcore_mac_p.h> @@ -300,8 +300,8 @@ QUuid QUuid::fromCFUUID(CFUUIDRef uuid) */ CFUUIDRef QUuid::toCFUUID() const { - const QByteArray bytes = toRfc4122(); - return CFUUIDCreateFromUUIDBytes(0, *reinterpret_cast<const CFUUIDBytes *>(bytes.constData())); + const auto bytes = toBytes(); + return CFUUIDCreateFromUUIDBytes(0, *reinterpret_cast<const CFUUIDBytes *>(&bytes)); } /*! @@ -333,8 +333,11 @@ QUuid QUuid::fromNSUUID(const NSUUID *uuid) */ NSUUID *QUuid::toNSUUID() const { - const QByteArray bytes = toRfc4122(); - return [[[NSUUID alloc] initWithUUIDBytes:*reinterpret_cast<const uuid_t *>(bytes.constData())] autorelease]; + const auto bytes = toBytes(); + static_assert(sizeof bytes == sizeof(uuid_t)); + uuid_t u; + memcpy(&u, &bytes, sizeof(uuid_t)); + return [[[NSUUID alloc] initWithUUIDBytes:u] autorelease]; } // ---------------------------------------------------------------------------- @@ -466,7 +469,7 @@ NSDate *QDateTime::toNSDate() const // ---------------------------------------------------------------------------- -#if QT_CONFIG(timezone) && !defined(QT_NO_SYSTEMLOCALE) +#if QT_CONFIG(timezone) /*! \brief Constructs a new QTimeZone containing a copy of the CFTimeZone \a timeZone. @@ -495,9 +498,9 @@ QTimeZone QTimeZone::fromCFTimeZone(CFTimeZoneRef timeZone) CFTimeZoneRef QTimeZone::toCFTimeZone() const { #ifndef QT_NO_DYNAMIC_CAST - Q_ASSERT(dynamic_cast<const QMacTimeZonePrivate *>(d.data())); + Q_ASSERT(dynamic_cast<const QMacTimeZonePrivate *>(d.d)); #endif - const QMacTimeZonePrivate *p = static_cast<const QMacTimeZonePrivate *>(d.data()); + const QMacTimeZonePrivate *p = static_cast<const QMacTimeZonePrivate *>(d.d); return reinterpret_cast<CFTimeZoneRef>([p->nsTimeZone() copy]); } |