Enhance op-code EFI_IFR_TO_BOOLEAN to case insensitive.

Signed-off-by: ydong10
Reviewed-by: lgao4

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12520 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2011-10-10 03:17:46 +00:00
parent befbc4f3fb
commit 39099cbdcf
1 changed files with 9 additions and 4 deletions

View File

@ -2034,7 +2034,7 @@ EvaluateExpression (
// //
// When converting from a string, if case-insensitive compare // When converting from a string, if case-insensitive compare
// with "true" is True, then push True. If a case-insensitive compare // with "true" is True, then push True. If a case-insensitive compare
// with "false" is True, then push False. // with "false" is True, then push False. Otherwise, push Undefined.
// //
StrPtr = GetToken (Value->Value.string, FormSet->HiiHandle); StrPtr = GetToken (Value->Value.string, FormSet->HiiHandle);
if (StrPtr == NULL) { if (StrPtr == NULL) {
@ -2042,10 +2042,15 @@ EvaluateExpression (
goto Done; goto Done;
} }
if ((StrCmp (StrPtr, L"true") == 0) || (StrCmp (StrPtr, L"false") == 0)){ IfrStrToUpper (StrPtr);
if (StrCmp (StrPtr, L"TRUE") == 0){
Value->Value.b = TRUE; Value->Value.b = TRUE;
} else { } else if (StrCmp (StrPtr, L"FALSE") == 0) {
Value->Value.b = FALSE; Value->Value.b = FALSE;
} else {
Status = EFI_INVALID_PARAMETER;
FreePool (StrPtr);
goto Done;
} }
FreePool (StrPtr); FreePool (StrPtr);
Value->Type = EFI_IFR_TYPE_BOOLEAN; Value->Type = EFI_IFR_TYPE_BOOLEAN;