mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 07:58:22 +08:00
GCC/Clang support
This commit is contained in:
parent
95e5ee2496
commit
1f54d73f8c
@ -2252,7 +2252,7 @@ STATUS FfsParser::parseSectionBody(const QModelIndex & index)
|
||||
if (!index.isValid())
|
||||
return ERR_INVALID_PARAMETER;
|
||||
QByteArray header = model->header(index);
|
||||
if (header.size() < sizeof(EFI_COMMON_SECTION_HEADER))
|
||||
if ((UINT32)header.size() < sizeof(EFI_COMMON_SECTION_HEADER))
|
||||
return ERR_INVALID_SECTION;
|
||||
|
||||
const EFI_COMMON_SECTION_HEADER* sectionHeader = (const EFI_COMMON_SECTION_HEADER*)(header.constData());
|
||||
@ -2912,6 +2912,8 @@ STATUS FfsParser::parseNvarStorage(const QByteArray & data, const QModelIndex &
|
||||
QByteArray body;
|
||||
QByteArray extendedData;
|
||||
|
||||
|
||||
|
||||
UINT32 guidAreaSize = guidsInStorage * sizeof(EFI_GUID);
|
||||
UINT32 unparsedSize = (UINT32)data.size() - offset - guidAreaSize;
|
||||
|
||||
@ -3077,6 +3079,7 @@ STATUS FfsParser::parseNvarStorage(const QByteArray & data, const QModelIndex &
|
||||
}
|
||||
|
||||
// Get variable name
|
||||
{
|
||||
UINT32 nameOffset = (variableHeader->Attributes & NVRAM_NVAR_VARIABLE_ATTRIB_GUID) ? sizeof(EFI_GUID) : 1; // GUID can be stored with the variable or in a separate storage, so there will only be an index of it
|
||||
CHAR8* namePtr = (CHAR8*)(variableHeader + 1) + nameOffset;
|
||||
UINT32 nameSize = 0;
|
||||
@ -3108,7 +3111,7 @@ STATUS FfsParser::parseNvarStorage(const QByteArray & data, const QModelIndex &
|
||||
// Include variable name and GUID into the header and remove them from body
|
||||
header = data.mid(offset, sizeof(NVAR_VARIABLE_HEADER) + nameOffset + nameSize);
|
||||
body = body.mid(nameOffset + nameSize);
|
||||
|
||||
}
|
||||
parsing_done:
|
||||
QString info;
|
||||
// Rename invalid variables according to their types
|
||||
@ -3187,8 +3190,7 @@ parsing_done:
|
||||
.hexarg(extendedData.size()), varIndex);
|
||||
|
||||
// Check variable name to be in the list of nesting variables
|
||||
for (std::vector<const CHAR8*>::const_iterator iter = nestingVariableNames.cbegin(); iter != nestingVariableNames.cend(); ++iter)
|
||||
if (QString(*iter) == text.toLatin1()) {
|
||||
if (text.toLatin1() == QString("StdDefaults") || text.toLatin1() == QString("MfgDefaults")) {
|
||||
STATUS result = parseNvarStorage(body, varIndex);
|
||||
if (result)
|
||||
msg(QObject::tr("parseNvarStorage: parsing of nested NVAR storage failed with error \"%1\"").arg(errorCodeToQString(result)), varIndex);
|
||||
|
@ -41,7 +41,3 @@ QString variableAttributesToQstring(UINT8 attributes)
|
||||
return str.mid(2); // Remove the first comma and space
|
||||
}
|
||||
|
||||
std::vector<const CHAR8*> nestingVariableNames = {
|
||||
"StdDefaults",
|
||||
"MfgDefaults"
|
||||
};
|
@ -33,8 +33,6 @@ const QByteArray NVRAM_NVAR_EXTERNAL_DEFAULTS_FILE_GUID
|
||||
|
||||
extern QString variableAttributesToQstring(UINT8 attributes);
|
||||
|
||||
extern std::vector<const CHAR8*> nestingVariableNames;
|
||||
|
||||
// Make sure we use right packing rules
|
||||
#pragma pack(push,1)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user