diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-07-05 15:38:33 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-07-06 18:07:00 +0000 |
commit | f48bba3c14cffeaf9c9dc318710d2be62c8351a3 (patch) | |
tree | bb73ee85665a654eb740e136c8fa637f7da75ea7 /src/corelib/global | |
parent | 8d986174e2e46b2e76ce4a46af9f01b47822dffd (diff) |
Darwin: Replace deprecated symbol kIOMasterPortDefault with equivalent
We can't use the replacement kIOMainPortDefault yet, as it's not
available in operating system versions we still support, but the
kIOMasterPortDefault documentation explicitly says that passing
NULL as a port argument indicates "use the default".
As the underlying type of a mach_port_t is potentially either
a pointer or an unsigned int, we initialize the default to 0.
Change-Id: I288aa94b8f2fbda47fd1cbaf329799db7ab988a0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 337f28c9abb12f28538cfe2f49e5afc460578b32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 9c546d87a4..a4cc506089 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -3077,7 +3077,8 @@ QByteArray QSysInfo::machineUniqueId() { #if defined(Q_OS_DARWIN) && __has_include(<IOKit/IOKitLib.h>) char uuid[UuidStringLen + 1]; - io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); + static const mach_port_t defaultPort = 0; // Effectively kIOMasterPortDefault/kIOMainPortDefault + io_service_t service = IOServiceGetMatchingService(defaultPort, IOServiceMatching("IOPlatformExpertDevice")); QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); return QByteArray(uuid); |