From 39099cbdcf8584a0ad3259eb3fdf330439679948 Mon Sep 17 00:00:00 2001 From: ydong10 Date: Mon, 10 Oct 2011 03:17:46 +0000 Subject: 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 --- MdeModulePkg/Universal/SetupBrowserDxe/Expression.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c index cbbb20dc9f..60a23f1822 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c @@ -2034,18 +2034,23 @@ EvaluateExpression ( // // When converting from a string, if 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); if (StrPtr == NULL) { Status = EFI_INVALID_PARAMETER; 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; - } else { + } else if (StrCmp (StrPtr, L"FALSE") == 0) { Value->Value.b = FALSE; + } else { + Status = EFI_INVALID_PARAMETER; + FreePool (StrPtr); + goto Done; } FreePool (StrPtr); Value->Type = EFI_IFR_TYPE_BOOLEAN; -- cgit v1.2.3