/** @file\r
Utility functions for expression evaluation.\r
\r
-Copyright (c) 2007, Intel Corporation\r
+Copyright (c) 2007 - 2008, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
//\r
// Free The Old Stack\r
//\r
- gBS->FreePool (*Stack);\r
+ FreePool (*Stack);\r
}\r
\r
//\r
\r
Question = IdToQuestion2 (Form, QuestionId);\r
if (Question != NULL) {\r
+ //\r
+ // EFI variable storage may be updated by Callback() asynchronous,\r
+ // to keep synchronous, always reload the Question Value.\r
+ //\r
+ if (Question->Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE) {\r
+ GetQuestionValue (FormSet, Form, Question, FALSE);\r
+ }\r
+\r
return Question;\r
}\r
\r
EFI_HII_VALUE Value;\r
CHAR16 *String;\r
CHAR16 *StringPtr;\r
- UINTN BufferSize;\r
\r
Status = PopExpression (&Value);\r
if (EFI_ERROR (Status)) {\r
if (String == NULL) {\r
return EFI_NOT_FOUND;\r
}\r
-\r
+ \r
IfrStrToUpper (String);\r
StringPtr = StrStr (String, L"0X");\r
if (StringPtr != NULL) {\r
//\r
// Hex string\r
//\r
- BufferSize = sizeof (UINT64);\r
- Status = HexStringToBuf ((UINT8 *) &Result->Value.u64, &BufferSize, StringPtr + 2, NULL);\r
+ Result->Value.u64 = StrHexToUint64 (String);\r
} else {\r
//\r
- // BUGBUG: Need handle decimal string\r
+ // decimal string\r
//\r
+ Result->Value.u64 = StrDecimalToUint64 (String);\r
}\r
- gBS->FreePool (String);\r
+ FreePool (String);\r
} else {\r
CopyMem (Result, &Value, sizeof (EFI_HII_VALUE));\r
}\r
}\r
\r
String[Index] = GetToken (Value.Value.string, FormSet->HiiHandle);\r
- if (String== NULL) {\r
+ if (String[Index] == NULL) {\r
Status = EFI_NOT_FOUND;\r
goto Done;\r
}\r
}\r
\r
String[Index] = GetToken (Value.Value.string, FormSet->HiiHandle);\r
- if (String== NULL) {\r
+ if (String [Index] == NULL) {\r
Status = EFI_NOT_FOUND;\r
goto Done;\r
}\r
}\r
\r
String[Index] = GetToken (Value.Value.string, FormSet->HiiHandle);\r
- if (String== NULL) {\r
+ if (String[Index] == NULL) {\r
Status = EFI_NOT_FOUND;\r
goto Done;\r
}\r
Result->Type = EFI_IFR_TYPE_STRING;\r
Result->Value.string = NewString (SubString, FormSet->HiiHandle);\r
\r
- gBS->FreePool (String);\r
+ FreePool (String);\r
\r
return Status;\r
}\r
}\r
\r
String[Index] = GetToken (Value.Value.string, FormSet->HiiHandle);\r
- if (String== NULL) {\r
+ if (String[Index] == NULL) {\r
Status = EFI_NOT_FOUND;\r
goto Done;\r
}\r
}\r
\r
String[Index] = GetToken (Value.Value.string, FormSet->HiiHandle);\r
- if (String== NULL) {\r
+ if (String [Index] == NULL) {\r
Status = EFI_NOT_FOUND;\r
goto Done;\r
}\r
\r
Str2 = GetToken (Value2->Value.string, HiiHandle);\r
if (Str2 == NULL) {\r
- gBS->FreePool (Str1);\r
+ FreePool (Str1);\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
Result = StrCmp (Str1, Str2);\r
\r
- gBS->FreePool (Str1);\r
- gBS->FreePool (Str2);\r
+ FreePool (Str1);\r
+ FreePool (Str2);\r
\r
return Result;\r
}\r
\r
\r
/**\r
- Evaluate the result of a HII expression\r
+ Evaluate the result of a HII expression.\r
+\r
+ If Expression is NULL, then ASSERT.\r
\r
@param FormSet FormSet associated with this expression.\r
@param Form Form associated with this expression.\r
//\r
ResetExpressionStack ();\r
\r
+ ASSERT (Expression != NULL);\r
Expression->Result.Type = EFI_IFR_TYPE_OTHER;\r
\r
Link = GetFirstNode (&Expression->OpCodeListHead);\r
\r
Value->Type = EFI_IFR_TYPE_NUM_SIZE_64;\r
Value->Value.u64 = StrLen (StrPtr);\r
- gBS->FreePool (StrPtr);\r
+ FreePool (StrPtr);\r
break;\r
\r
case EFI_IFR_NOT_OP:\r
} else {\r
Index = (UINT16) Value->Value.u64;\r
Value->Value.string = Index;\r
- gBS->FreePool (StrPtr);\r
+ FreePool (StrPtr);\r
}\r
break;\r
\r
} else {\r
Value->Value.b = FALSE;\r
}\r
- gBS->FreePool (StrPtr);\r
+ FreePool (StrPtr);\r
Value->Type = EFI_IFR_TYPE_BOOLEAN;\r
}\r
break;\r
mUnicodeCollation->StrUpr (mUnicodeCollation, StrPtr);\r
}\r
Value->Value.string = NewString (StrPtr, FormSet->HiiHandle);\r
- gBS->FreePool (StrPtr);\r
+ FreePool (StrPtr);\r
break;\r
\r
case EFI_IFR_BITWISE_NOT_OP:\r