Teach QMacVersion to deal with 32-bit Mach-O headers

Pick-to: 5.15
Pick-to: 5.12
Change-Id: I7946aa35722bc76326e2d6cf0820353c4ba13fad
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
bb10
Tor Arne Vestbø 2020-08-05 10:31:35 +02:00
parent de3b2541de
commit b6de6a9699
2 changed files with 3 additions and 5 deletions

View File

@ -593,7 +593,9 @@ QMacVersion::VersionTuple QMacVersion::versionsForImage(const mach_header *machH
);
};
auto commandCursor = uintptr_t(machHeader) + sizeof(mach_header_64);
const bool is64Bit = machHeader->magic == MH_MAGIC_64 || machHeader->magic == MH_CIGAM_64;
auto commandCursor = uintptr_t(machHeader) + (is64Bit ? sizeof(mach_header_64) : sizeof(mach_header));
for (uint32_t i = 0; i < machHeader->ncmds; ++i) {
load_command *loadCommand = reinterpret_cast<load_command *>(commandCursor);
if (loadCommand->cmd == LC_VERSION_MIN_MACOSX || loadCommand->cmd == LC_VERSION_MIN_IPHONEOS

View File

@ -419,10 +419,6 @@ private:
// -------------------------------------------------------------------------
#if QT_POINTER_SIZE == 4
#error "32-bit builds are not supported"
#endif
class Q_CORE_EXPORT QMacVersion
{
public: