Update the HiiConfigToBlock to follow spec.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13983 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2012-12-05 09:27:15 +00:00
parent 73b5f8bcee
commit edae8d2dbd
2 changed files with 10 additions and 16 deletions

View File

@ -3919,18 +3919,14 @@ HiiConfigToBlock (
Status = EFI_INVALID_PARAMETER;
goto Exit;
}
//
// Skip '&'
//
StringPtr++;
//
// Parse each <ConfigElement> if exists
// Only <BlockConfig> format is supported by this help function.
// Only '&'<BlockConfig> format is supported by this help function.
// <BlockConfig> ::= 'OFFSET='<Number>&'WIDTH='<Number>&'VALUE='<Number>
//
while (*StringPtr != 0 && StrnCmp (StringPtr, L"OFFSET=", StrLen (L"OFFSET=")) == 0) {
StringPtr += StrLen (L"OFFSET=");
while (*StringPtr != 0 && StrnCmp (StringPtr, L"&OFFSET=", StrLen (L"&OFFSET=")) == 0) {
StringPtr += StrLen (L"&OFFSET=");
//
// Get Offset
//
@ -3949,7 +3945,7 @@ HiiConfigToBlock (
StringPtr += Length;
if (StrnCmp (StringPtr, L"&WIDTH=", StrLen (L"&WIDTH=")) != 0) {
*Progress = StringPtr - Length - StrLen (L"OFFSET=") - 1;
*Progress = StringPtr - Length - StrLen (L"&OFFSET=");
Status = EFI_INVALID_PARAMETER;
goto Exit;
}
@ -3990,7 +3986,7 @@ HiiConfigToBlock (
StringPtr += Length;
if (*StringPtr != 0 && *StringPtr != L'&') {
*Progress = StringPtr - Length - 7;
*Progress = StringPtr - Length - StrLen (L"&VALUE=");
Status = EFI_INVALID_PARAMETER;
goto Exit;
}
@ -4009,20 +4005,18 @@ HiiConfigToBlock (
Value = NULL;
//
// If '\0', parsing is finished. Otherwise skip '&' to continue
// If '\0', parsing is finished.
//
if (*StringPtr == 0) {
break;
}
StringPtr++;
}
//
// The input string is ConfigAltResp format.
// The input string is not ConfigResp format, return error.
//
if ((*StringPtr != 0) && (StrnCmp (StringPtr, L"&GUID=", StrLen (L"&GUID=")) != 0)) {
*Progress = StringPtr - 1;
if (*StringPtr != 0) {
*Progress = StringPtr;
Status = EFI_INVALID_PARAMETER;
goto Exit;
}

View File

@ -3513,7 +3513,7 @@ LoadStorage (
//
// Convert Result from <ConfigAltResp> to <ConfigResp>
//
StrPtr = StrStr (Result, L"ALTCFG");
StrPtr = StrStr (Result, L"&GUID=");
if (StrPtr != NULL) {
*StrPtr = L'\0';
}