Skip to content

Commit a17b6d8

Browse files
pagabucNikolajSchlej
authored andcommitted
fix formatting
1 parent ea35fb2 commit a17b6d8

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

common/LZMA/LzmaDecompress.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,9 @@ LzmaGetInfo (
9494
)
9595
{
9696
UINT64 DecodedSize;
97-
if(SourceSize <= LZMA_HEADER_SIZE){
97+
if (SourceSize <= LZMA_HEADER_SIZE) {
9898
return U_BUFFER_TOO_SMALL;
9999
}
100-
(void)SourceSize;
101100

102101
DecodedSize = GetDecodedSizeOfBuf((UINT8*)Source);
103102

common/ffsparser.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ USTATUS FfsParser::parseIntelImage(const UByteArray & intelImage, const UINT32 l
352352
if (regionSection->MeLimit) {
353353
me.offset = calculateRegionOffset(regionSection->MeBase);
354354
me.length = calculateRegionSize(regionSection->MeBase, regionSection->MeLimit);
355-
if(me.offset + me.length < me.offset){
355+
if (me.offset + me.length < me.offset) {
356356
return U_INVALID_FLASH_DESCRIPTOR;
357357
}
358358
if ((UINT32)intelImage.size() < me.offset + me.length) {
@@ -394,7 +394,8 @@ USTATUS FfsParser::parseIntelImage(const UByteArray & intelImage, const UINT32 l
394394
index);
395395
return U_TRUNCATED_IMAGE;
396396
}
397-
if(intelImage.size() > bios.offset){
397+
398+
if (intelImage.size() > bios.offset) {
398399
bios.data = intelImage.mid(bios.offset, bios.length);
399400
regions.push_back(bios);
400401
}
@@ -425,7 +426,7 @@ USTATUS FfsParser::parseIntelImage(const UByteArray & intelImage, const UINT32 l
425426
return U_TRUNCATED_IMAGE;
426427
}
427428

428-
if(intelImage.size() > region.offset){
429+
if (intelImage.size() > region.offset) {
429430
region.data = intelImage.mid(region.offset, region.length);
430431
regions.push_back(region);
431432
}
@@ -2180,9 +2181,11 @@ USTATUS FfsParser::parseFileHeader(const UByteArray & file, const UINT32 localOf
21802181

21812182
// Get file body
21822183
UByteArray body = file.mid(header.size());
2183-
if(body.size() < sizeof(UINT16)){
2184+
2185+
if (body.size() < sizeof(UINT16)) {
21842186
return U_INVALID_FILE;
21852187
}
2188+
21862189
// Check for file tail presence
21872190
UByteArray tail;
21882191
bool msgInvalidTailValue = false;
@@ -2792,6 +2795,7 @@ USTATUS FfsParser::parseGuidedSectionHeader(const UByteArray & section, const UI
27922795
dataOffset = guidDefinedSectionHeader->DataOffset;
27932796
attributes = guidDefinedSectionHeader->Attributes;
27942797
}
2798+
27952799
// Check sanity again
27962800
if ((UINT32)section.size() < headerSize || section.size() < dataOffset)
27972801
return U_INVALID_SECTION;
@@ -4990,9 +4994,11 @@ USTATUS FfsParser::parseCpdRegion(const UByteArray & region, const UINT32 localO
49904994
std::vector<CPD_PARTITION_INFO> partitions;
49914995
UINT32 offset = ptHeaderSize;
49924996
const CPD_ENTRY* firstCpdEntry = (const CPD_ENTRY*)(body.constData());
4993-
if(cpdHeader->NumEntries * sizeof(CPD_ENTRY) > (UINT32)body.size()){
4997+
4998+
if (cpdHeader->NumEntries * sizeof(CPD_ENTRY) > (UINT32)body.size()) {
49944999
return U_INVALID_ME_PARTITION_TABLE;
49955000
}
5001+
49965002
for (UINT32 i = 0; i < cpdHeader->NumEntries; i++) {
49975003
// Populate entry header
49985004
const CPD_ENTRY* cpdEntry = firstCpdEntry + i;
@@ -5057,8 +5063,11 @@ USTATUS FfsParser::parseCpdRegion(const UByteArray & region, const UINT32 localO
50575063
// Parse into data block, find Module Attributes extension, and get compressed size from there
50585064
UINT32 offset = 0;
50595065
UINT32 length = 0xFFFFFFFF; // Special guardian value
5060-
if(region.size() <= partitions[i].ptEntry.Offset.Offset)
5066+
5067+
if (region.size() <= partitions[i].ptEntry.Offset.Offset) {
50615068
break;
5069+
}
5070+
50625071
UByteArray partition = region.mid(partitions[i].ptEntry.Offset.Offset, partitions[i].ptEntry.Length);
50635072
while (offset < ((UINT32)partition.size() - sizeof(CPD_EXTENTION_HEADER))) {
50645073
const CPD_EXTENTION_HEADER* extHeader = (const CPD_EXTENTION_HEADER*) (partition.constData() + offset);
@@ -5315,9 +5324,9 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index, const UINT3
53155324
if (extHeader->Type == CPD_EXT_TYPE_SIGNED_PACKAGE_INFO) {
53165325
UByteArray header = partition.left(sizeof(CPD_EXT_SIGNED_PACKAGE_INFO));
53175326
UByteArray data = partition.mid(header.size());
5318-
if(header.size() >= sizeof(CPD_EXT_SIGNED_PACKAGE_INFO)){
5327+
if (header.size() >= sizeof(CPD_EXT_SIGNED_PACKAGE_INFO)) {
53195328
const CPD_EXT_SIGNED_PACKAGE_INFO* infoHeader = (const CPD_EXT_SIGNED_PACKAGE_INFO*)header.constData();
5320-
5329+
53215330
info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %Xh\n"
53225331
"Package name: %.4s\nVersion control number: %Xh\nSecurity version number: %Xh\n"
53235332
"Usage bitmap: %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
@@ -5439,7 +5448,7 @@ USTATUS FfsParser::parseSignedPackageInfoData(const UModelIndex & index)
54395448
UByteArray body = model->body(index);
54405449
UINT32 offset = 0;
54415450
while (offset < (UINT32)body.size()) {
5442-
if(body.size() - offset < sizeof(CPD_EXT_SIGNED_PACKAGE_INFO_MODULE))
5451+
if (body.size() - offset < sizeof(CPD_EXT_SIGNED_PACKAGE_INFO_MODULE))
54435452
break;
54445453
const CPD_EXT_SIGNED_PACKAGE_INFO_MODULE* moduleHeader = (const CPD_EXT_SIGNED_PACKAGE_INFO_MODULE*)(body.constData() + offset);
54455454
if ((sizeof(CPD_EXT_SIGNED_PACKAGE_INFO_MODULE) + moduleHeader->HashSize) <= ((UINT32)body.size() - offset)) {

common/fitparser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void FitParser::findFitRecursive(const UModelIndex & index, UModelIndex & found,
227227
UINT64 fitSignatureValue = INTEL_FIT_SIGNATURE;
228228
UByteArray fitSignature((const char*)&fitSignatureValue, sizeof(fitSignatureValue));
229229

230-
if(lastVtfBody.size() < INTEL_FIT_POINTER_OFFSET)
230+
if (lastVtfBody.size() < INTEL_FIT_POINTER_OFFSET)
231231
return;
232232

233233
UINT32 storedFitAddress = *(const UINT32*)(lastVtfBody.constData() + lastVtfBody.size() - INTEL_FIT_POINTER_OFFSET);

common/nvramparser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index, const bool probe)
208208
guidsInStore = entry_body->guid_index() + 1;
209209

210210
// Sanity check.
211-
if(nvar.size() < sizeof(EFI_GUID) * (entry_body->guid_index() + 1))
211+
if (nvar.size() < sizeof(EFI_GUID) * (entry_body->guid_index() + 1))
212212
goto processing_done;
213213

214214
// The list begins at the end of the store and goes backwards

common/utility.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ USTATUS decompress(const UByteArray & compressedData, const UINT8 compressionTyp
207207
UINT32 scratchSize = 0;
208208
const EFI_TIANO_HEADER* header;
209209

210-
if(compressedData.size() < 4){
210+
if (compressedData.size() < 4) {
211211
return U_BUFFER_TOO_SMALL;
212212
}
213213

0 commit comments

Comments
 (0)