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. Pick-to: 6.2 6.3 6.4 5.15 Change-Id: I288aa94b8f2fbda47fd1cbaf329799db7ab988a0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
a50590370f
commit
337f28c9ab
@ -2977,7 +2977,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);
|
||||
|
Loading…
Reference in New Issue
Block a user