Replace unneeded BOOLEAN with bool

This commit is contained in:
Nikolaj Schlej 2023-01-29 15:13:37 -08:00
parent e6b567532d
commit 66e9f95dc3
6 changed files with 29 additions and 40 deletions

View file

@ -85,19 +85,19 @@ typedef size_t USTATUS;
#define U_NOT_IMPLEMENTED 255
// EDK2 porting definitions
typedef uint8_t BOOLEAN;
typedef int8_t INT8;
typedef uint8_t UINT8;
typedef int16_t INT16;
typedef uint16_t UINT16;
typedef int32_t INT32;
typedef uint32_t UINT32;
typedef int64_t INT64;
typedef uint64_t UINT64;
typedef char CHAR8;
typedef uint16_t CHAR16;
typedef size_t UINTN;
typedef ptrdiff_t INTN;
typedef uint8_t BOOLEAN;
typedef int8_t INT8;
typedef uint8_t UINT8;
typedef int16_t INT16;
typedef uint16_t UINT16;
typedef int32_t INT32;
typedef uint32_t UINT32;
typedef int64_t INT64;
typedef uint64_t UINT64;
typedef char CHAR8;
typedef uint16_t CHAR16;
typedef size_t UINTN;
typedef ptrdiff_t INTN;
#define CONST const
#define VOID void
@ -137,7 +137,6 @@ typedef ptrdiff_t INTN;
#define COMPRESSION_ALGORITHM_GZIP 8
#define COMPRESSION_ALGORITHM_ZLIB 9
// Item create modes
#define CREATE_MODE_APPEND 0
#define CREATE_MODE_PREPEND 1

View file

@ -1222,19 +1222,9 @@ USTATUS FfsParser::parseVolumeHeader(const UByteArray & volume, const UINT32 loc
return U_SUCCESS;
}
BOOLEAN FfsParser::microcodeHeaderValid(const INTEL_MICROCODE_HEADER* ucodeHeader)
bool FfsParser::microcodeHeaderValid(const INTEL_MICROCODE_HEADER* ucodeHeader)
{
// Check main reserved bytes to be zero
bool reservedBytesValid = true;
for (UINT32 i = 0; i < sizeof(ucodeHeader->Reserved); i++) {
if (ucodeHeader->Reserved[i] != 0x00) {
reservedBytesValid = false;
break;
}
}
if (!reservedBytesValid) {
return FALSE;
}
// Check CpuFlags reserved bytes to be zero
for (UINT32 i = 0; i < sizeof(ucodeHeader->ProcessorFlagsReserved); i++) {
@ -1244,19 +1234,19 @@ BOOLEAN FfsParser::microcodeHeaderValid(const INTEL_MICROCODE_HEADER* ucodeHeade
}
}
if (!reservedBytesValid) {
return FALSE;
return false;
}
// Check data size to be multiple of 4 and less than 0x1000000
if (ucodeHeader->DataSize % 4 != 0 ||
ucodeHeader->DataSize > 0xFFFFFF) {
return FALSE;
return false;
}
// Check TotalSize to be greater or equal than DataSize and less than 0x1000000
if (ucodeHeader->TotalSize < ucodeHeader->DataSize ||
ucodeHeader->TotalSize > 0xFFFFFF) {
return FALSE;
return false;
}
// Check date to be sane
@ -1266,7 +1256,7 @@ BOOLEAN FfsParser::microcodeHeaderValid(const INTEL_MICROCODE_HEADER* ucodeHeade
(ucodeHeader->DateDay > 0x19 && ucodeHeader->DateDay < 0x20) ||
(ucodeHeader->DateDay > 0x29 && ucodeHeader->DateDay < 0x30) ||
ucodeHeader->DateDay > 0x31) {
return FALSE;
return false;
}
// Check month to be in 0x01-0x09, 0x10-0x12
if (ucodeHeader->DateMonth < 0x01 ||

View file

@ -175,7 +175,7 @@ private:
UINT32 getSectionSize(const UByteArray & file, const UINT32 sectionOffset, const UINT8 ffsVersion);
USTATUS parseIntelMicrocodeHeader(const UByteArray & store, const UINT32 localOffset, const UModelIndex & parent, UModelIndex & index);
BOOLEAN microcodeHeaderValid(const INTEL_MICROCODE_HEADER* ucodeHeader);
bool microcodeHeaderValid(const INTEL_MICROCODE_HEADER* ucodeHeader);
USTATUS parseVendorHashFile(const UByteArray & fileGuid, const UModelIndex & index);

View file

@ -117,7 +117,7 @@ public:
UString headerData(int section, int orientation, int role = 0) const;
TreeModel() : markingEnabledFlag(false) {
rootItem = new TreeItem(0, Types::Root, 0, UString(), UString(), UString(), UByteArray(), UByteArray(), UByteArray(), TRUE, FALSE);
rootItem = new TreeItem(0, Types::Root, 0, UString(), UString(), UString(), UByteArray(), UByteArray(), UByteArray(), true, false);
}
bool hasIndex(int row, int column, const UModelIndex &parent = UModelIndex()) const {
@ -162,7 +162,7 @@ public:
UString info(const UModelIndex &index) const;
void setInfo(const UModelIndex &index, const UString &info);
void addInfo(const UModelIndex &index, const UString &info, const bool append = TRUE);
void addInfo(const UModelIndex &index, const UString &info, const bool append = true);
bool fixed(const UModelIndex &index) const;
void setFixed(const UModelIndex &index, const bool fixed);

View file

@ -469,10 +469,10 @@ INTN findPattern(const UINT8 *pattern, const UINT8 *patternMask, UINTN patternSi
return -1;
while (dataOff + patternSize < dataSize) {
BOOLEAN matches = TRUE;
bool matches = true;
for (UINTN i = 0; i < patternSize; i++) {
if ((data[dataOff + i] & patternMask[i]) != pattern[i]) {
matches = FALSE;
matches = true;
break;
}
}
@ -486,12 +486,12 @@ INTN findPattern(const UINT8 *pattern, const UINT8 *patternMask, UINTN patternSi
return -1;
}
BOOLEAN makePattern(const CHAR8 *textPattern, std::vector<UINT8> &pattern, std::vector<UINT8> &patternMask)
bool makePattern(const CHAR8 *textPattern, std::vector<UINT8> &pattern, std::vector<UINT8> &patternMask)
{
UINTN len = std::strlen(textPattern);
if (len == 0 || len % 2 != 0)
return FALSE;
return false;
len /= 2;
@ -503,7 +503,7 @@ BOOLEAN makePattern(const CHAR8 *textPattern, std::vector<UINT8> &pattern, std::
int v2 = char2hex(std::toupper(textPattern[i * 2 + 1]));
if (v1 == -1 || v2 == -1)
return FALSE;
return false;
if (v1 != -2) {
patternMask[i] = 0xF0;
@ -516,7 +516,7 @@ BOOLEAN makePattern(const CHAR8 *textPattern, std::vector<UINT8> &pattern, std::
}
}
return TRUE;
return true;
}
USTATUS gzipDecompress(const UByteArray & input, UByteArray & output)

View file

@ -60,7 +60,7 @@ UINT32 calculateChecksum32(const UINT32* buffer, UINT32 bufferSize);
UINT8 getPaddingType(const UByteArray & padding);
// Make pattern from a hexstring with an assumption of . being any char
BOOLEAN makePattern(const CHAR8 *textPattern, std::vector<UINT8> &pattern, std::vector<UINT8> &patternMask);
bool makePattern(const CHAR8 *textPattern, std::vector<UINT8> &pattern, std::vector<UINT8> &patternMask);
// Find pattern in a binary blob
INTN findPattern(const UINT8 *pattern, const UINT8 *patternMask, UINTN patternSize,