/** @file\r
FrontPage routines to handle the callbacks and browser calls\r
\r
-Copyright (c) 2004 - 2009, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
+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
http://opensource.org/licenses/bsd-license.php\r
CHAR8 *PlatformSupportedLanguages;\r
CHAR8 *BestLanguage;\r
\r
+ if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) {\r
+ //\r
+ // Do nothing for UEFI OPEN/CLOSE Action\r
+ //\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
if ((Value == NULL) || (ActionRequest == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
EFI_IFR_GUID_LABEL *StartLabel;\r
EFI_IFR_GUID_LABEL *EndLabel;\r
BOOLEAN FirstFlag;\r
- EFI_STRING_ID Temp;\r
\r
if (InitializeHiiData) {\r
//\r
GetNextLanguage (&LangCode, Lang);\r
OptionCount ++;\r
}\r
- gFrontPagePrivate.LanguageToken = AllocatePool ((OptionCount + 1) * sizeof (EFI_STRING_ID));\r
+ gFrontPagePrivate.LanguageToken = AllocatePool (OptionCount * sizeof (EFI_STRING_ID));\r
ASSERT (gFrontPagePrivate.LanguageToken != NULL);\r
FirstFlag = TRUE;\r
}\r
\r
- Status = gHiiString->NewString (gHiiString, HiiHandle, &Temp, "de-DE", L"Dedede", L"TEST", NULL);\r
-\r
OptionCount = 0;\r
LangCode = LanguageString;\r
while (*LangCode != 0) {\r
\r
if (FirstFlag) {\r
StringBuffer = HiiGetString (HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, Lang);\r
- ASSERT_EFI_ERROR (StringBuffer != NULL);\r
+ ASSERT (StringBuffer != NULL);\r
\r
//\r
// Save the string Id for each language\r
OUT CHAR16 **String\r
)\r
{\r
- UINT8 StrNum;\r
- UINTN CurrentStrLen;\r
- CHAR8* CharInStr;\r
- EFI_STATUS Status;\r
+ UINTN StrSize;\r
\r
- StrNum = 0;\r
- Status = EFI_NOT_FOUND;\r
- CharInStr = OptionalStrStart;\r
+ if (Index == 0) {\r
+ *String = AllocateZeroPool (sizeof (CHAR16));\r
+ return EFI_SUCCESS;\r
+ }\r
\r
- if (Index != 1) {\r
- CurrentStrLen = 0;\r
- //\r
- // look for the two consecutive zeros, check the string limit by the way.\r
- //\r
- while (*CharInStr != 0 || *(CharInStr+1) != 0) { \r
- if (*CharInStr == 0) {\r
- StrNum += 1;\r
- CharInStr++;\r
- }\r
- \r
- if (StrNum == Index) {\r
- Status = EFI_SUCCESS;\r
- break;\r
- }\r
- \r
- CurrentStrLen = AsciiStrLen(CharInStr);\r
- \r
- //\r
- // forward the pointer\r
- //\r
- OptionalStrStart = CharInStr;\r
- CharInStr += CurrentStrLen;\r
- }\r
- \r
- if (EFI_ERROR (Status)) {\r
- *String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));\r
- return Status;\r
- }\r
+ StrSize = 0;\r
+ do {\r
+ Index--;\r
+ OptionalStrStart += StrSize;\r
+ StrSize = AsciiStrSize (OptionalStrStart);\r
+ } while (OptionalStrStart[StrSize] != 0 && Index != 0);\r
+\r
+ if (Index != 0) {\r
+ *String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));\r
} else {\r
- CurrentStrLen = AsciiStrLen(CharInStr);\r
+ *String = AllocatePool (StrSize * sizeof (CHAR16));\r
+ AsciiStrToUnicodeStr (OptionalStrStart, *String);\r
}\r
\r
- *String = AllocatePool((CurrentStrLen + 1)*sizeof(CHAR16));\r
- AsciiStrToUnicodeStr(OptionalStrStart, *String);\r
-\r
return EFI_SUCCESS;\r
}\r
\r