From 7695927eec4009882c27f39d89f094981f1561e3 Mon Sep 17 00:00:00 2001 From: Nikolaj Schlej Date: Mon, 29 Aug 2022 07:08:45 +0200 Subject: [PATCH] Fixed inconsistent use of %ll and %l format modifiers --- common/ffsparser.cpp | 18 +++++++++--------- common/meparser.cpp | 8 ++++---- common/nvramparser.cpp | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/common/ffsparser.cpp b/common/ffsparser.cpp index fd89720..9e33795 100644 --- a/common/ffsparser.cpp +++ b/common/ffsparser.cpp @@ -4504,8 +4504,8 @@ USTATUS FfsParser::parseBpdtRegion(const UByteArray & region, const UINT32 local // Get info name = bpdtEntryTypeToUString(ptEntry->Type); - info = usprintf("Full size: %lXh (%lu)\nType: %Xh\nPartition offset: %Xh\nPartition length: %Xh", - sizeof(BPDT_ENTRY), sizeof(BPDT_ENTRY), + info = usprintf("Full size: %Xh (%u)\nType: %Xh\nPartition offset: %Xh\nPartition length: %Xh", + (UINT32)sizeof(BPDT_ENTRY), (UINT32)sizeof(BPDT_ENTRY), ptEntry->Type, ptEntry->Offset, ptEntry->Size) + @@ -4954,22 +4954,22 @@ make_partition_table_consistent: UByteArray body = partition.mid(manifestHeader->HeaderLength * sizeof(UINT32)); info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)" - "\nHeader type: %u\nHeader length: %lXh (%lu)\nHeader version: %Xh\nFlags: %08Xh\nVendor: %Xh\n" - "Date: %Xh\nSize: %lXh (%lu)\nVersion: %u.%u.%u.%u\nSecurity version number: %u\nModulus size: %lXh (%lu)\nExponent size: %lXh (%lu)", + "\nHeader type: %u\nHeader length: %Xh (%u)\nHeader version: %Xh\nFlags: %08Xh\nVendor: %Xh\n" + "Date: %Xh\nSize: %Xh (%u)\nVersion: %u.%u.%u.%u\nSecurity version number: %u\nModulus size: %Xh (%u)\nExponent size: %Xh (%u)", (UINT32)partition.size(), (UINT32)partition.size(), (UINT32)header.size(), (UINT32)header.size(), (UINT32)body.size(), (UINT32)body.size(), manifestHeader->HeaderType, - manifestHeader->HeaderLength * sizeof(UINT32), manifestHeader->HeaderLength * sizeof(UINT32), + manifestHeader->HeaderLength * (UINT32)sizeof(UINT32), manifestHeader->HeaderLength * (UINT32)sizeof(UINT32), manifestHeader->HeaderVersion, manifestHeader->Flags, manifestHeader->Vendor, manifestHeader->Date, - manifestHeader->Size * sizeof(UINT32), manifestHeader->Size * sizeof(UINT32), + manifestHeader->Size * (UINT32)sizeof(UINT32), manifestHeader->Size * (UINT32)sizeof(UINT32), manifestHeader->VersionMajor, manifestHeader->VersionMinor, manifestHeader->VersionBugfix, manifestHeader->VersionBuild, manifestHeader->SecurityVersion, - manifestHeader->ModulusSize * sizeof(UINT32), manifestHeader->ModulusSize * sizeof(UINT32), - manifestHeader->ExponentSize * sizeof(UINT32), manifestHeader->ExponentSize * sizeof(UINT32)); + manifestHeader->ModulusSize * (UINT32)sizeof(UINT32), manifestHeader->ModulusSize * (UINT32)sizeof(UINT32), + manifestHeader->ExponentSize * (UINT32)sizeof(UINT32), manifestHeader->ExponentSize * (UINT32)sizeof(UINT32)); // Add tree item UModelIndex partitionIndex = model->addItem(localOffset + partitions[i].ptEntry.Offset.Offset, Types::CpdPartition, Subtypes::ManifestCpdPartition, name, UString(), info, header, body, UByteArray(), Fixed, parent); @@ -5115,7 +5115,7 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index) // Add tree item extIndex = model->addItem(offset, Types::CpdExtension, 0, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, index); if (msgHashSizeMismatch) { - msg(usprintf("%s: IFWI Partition Manifest hash size is %u, maximum allowed is %lu, truncated", __FUNCTION__, attrHeader->HashSize, sizeof(attrHeader->CompletePartitionHash)), extIndex); + msg(usprintf("%s: IFWI Partition Manifest hash size is %u, maximum allowed is %u, truncated", __FUNCTION__, attrHeader->HashSize, (UINT32)sizeof(attrHeader->CompletePartitionHash)), extIndex); } } // Parse Module Attributes a bit further diff --git a/common/meparser.cpp b/common/meparser.cpp index f20a46a..08733f9 100755 --- a/common/meparser.cpp +++ b/common/meparser.cpp @@ -190,8 +190,8 @@ USTATUS MeParser::parseFptRegion(const UByteArray & region, const UModelIndex & // Get info name = visibleAsciiOrHex((UINT8*)ptEntry->Name, 4); - info = usprintf("Full size: %lXh (%lu)\nPartition offset: %Xh\nPartition length: %Xh\nPartition type: %02Xh", - sizeof(FPT_HEADER_ENTRY), sizeof(FPT_HEADER_ENTRY), + info = usprintf("Full size: %Xh (%u)\nPartition offset: %Xh\nPartition length: %Xh\nPartition type: %02Xh", + (UINT32)sizeof(FPT_HEADER_ENTRY), (UINT32)sizeof(FPT_HEADER_ENTRY), ptEntry->Offset, ptEntry->Size, ptEntry->Type); @@ -342,7 +342,7 @@ USTATUS MeParser::parseIfwi16Region(const UByteArray & region, const UModelIndex "Boot3 partition offset: %Xh\nBoot3 partition size: %Xh\n" "Boot4 partition offset: %Xh\nBoot4 partition size: %Xh\n" "Boot5 partition offset: %Xh\nBoot5 partition size: %Xh\n" - "Checksum: %llXh", + "Checksum: %" PRIX64 "h", (UINT32)header.size(), (UINT32)header.size(), ifwiHeader->DataPartition.Offset, ifwiHeader->DataPartition.Size, ifwiHeader->BootPartition[0].Offset, ifwiHeader->BootPartition[0].Size, @@ -350,7 +350,7 @@ USTATUS MeParser::parseIfwi16Region(const UByteArray & region, const UModelIndex ifwiHeader->BootPartition[2].Offset, ifwiHeader->BootPartition[2].Size, ifwiHeader->BootPartition[3].Offset, ifwiHeader->BootPartition[3].Size, ifwiHeader->BootPartition[4].Offset, ifwiHeader->BootPartition[4].Size, - (unsigned long long)ifwiHeader->Checksum); + ifwiHeader->Checksum); // Add tree item index = model->addItem(0, Types::IfwiHeader, 0, name, UString(), info, UByteArray(), header, UByteArray(), Fixed, parent); diff --git a/common/nvramparser.cpp b/common/nvramparser.cpp index 2ee4f87..f96cbd3 100755 --- a/common/nvramparser.cpp +++ b/common/nvramparser.cpp @@ -621,7 +621,7 @@ USTATUS NvramParser::findNextStore(const UModelIndex & index, const UByteArray & else if (ftwHeader->WriteQueueSize % 0x10 == 0x00) { // Header with 64 bit WriteQueueSize const EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER64* ftw64Header = (const EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER64*)currentPos; if (ftw64Header->WriteQueueSize == 0 || ftw64Header->WriteQueueSize >= 0xFFFFFFFF) { - msg(usprintf("%s: FTW block candidate at offset %Xh skipped, has invalid body size %llXh", __FUNCTION__, localOffset + offset, (unsigned long long)ftw64Header->WriteQueueSize), index); + msg(usprintf("%s: FTW block candidate at offset %Xh skipped, has invalid body size %" PRIX64 "h", __FUNCTION__, localOffset + offset, ftw64Header->WriteQueueSize), index); continue; } }