From d357145fca78f3ec36c477ca47606deb3bf60004 Mon Sep 17 00:00:00 2001 From: eric_tian Date: Mon, 27 Apr 2009 07:12:20 +0000 Subject: [PATCH] improve platformlangcodes/langcodes and platformlang/lang autoupdate mechanism. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8185 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/BdsDxe/FrontPage.c | 21 +++---------------- .../Universal/BdsDxe/Language.c | 8 +++---- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c index 73207cc718..10bbf74294 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c @@ -156,7 +156,6 @@ FrontPageCallback ( CHAR8 *LanguageString; CHAR8 *LangCode; CHAR8 *Lang; - CHAR8 OldLang[ISO_639_2_ENTRY_SIZE]; UINTN Index; EFI_STATUS Status; CHAR8 *PlatformSupportedLanguages; @@ -230,25 +229,11 @@ FrontPageCallback ( AsciiStrSize (BestLanguage), Lang ); - - if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) { - // - // Set UEFI deprecated variable "Lang" for backwards compatibility - // - Status = ConvertRfc3066LanguageToIso639Language (BestLanguage, OldLang); - if (!EFI_ERROR (Status)) { - Status = gRT->SetVariable ( - L"Lang", - &gEfiGlobalVariableGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - ISO_639_2_ENTRY_SIZE, - OldLang - ); - } - } FreePool (BestLanguage); + } else { + ASSERT (FALSE); } - + FreePool (PlatformSupportedLanguages); FreePool (Lang); FreePool (LanguageString); diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Language.c b/IntelFrameworkModulePkg/Universal/BdsDxe/Language.c index ae64c7252b..78a6198737 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/Language.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/Language.c @@ -504,7 +504,7 @@ InitializeLanguage ( EFI_STATUS Status; UINTN Size; CHAR8 *Lang; - CHAR8 LangCode[ISO_639_2_ENTRY_SIZE]; + CHAR8 LangCode[ISO_639_2_ENTRY_SIZE + 1]; CHAR8 *LangCodes; CHAR8 *PlatformLang; CHAR8 *PlatformLangCodes; @@ -523,7 +523,7 @@ InitializeLanguage ( L"LangCodes", &gEfiGlobalVariableGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - AsciiStrLen (LangCodes), + AsciiStrSize (LangCodes), LangCodes ); } @@ -547,7 +547,7 @@ InitializeLanguage ( // // Find current LangCode from Lang NV Variable // - Size = ISO_639_2_ENTRY_SIZE; + Size = ISO_639_2_ENTRY_SIZE + 1; Status = gRT->GetVariable ( L"Lang", &gEfiGlobalVariableGuid, @@ -576,7 +576,7 @@ InitializeLanguage ( L"Lang", &gEfiGlobalVariableGuid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - ISO_639_2_ENTRY_SIZE, + ISO_639_2_ENTRY_SIZE + 1, Lang ); }