From a71003f2491a26b96b808064d35c8fd01d6422ed Mon Sep 17 00:00:00 2001 From: Eric Dong Date: Thu, 5 Sep 2013 03:02:14 +0000 Subject: Refine the select language logic. Signed-off-by: Eric Dong Reviewed-by: Liming Gao Reviewed-by: Jaben Carsey git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14629 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Application/Shell/ShellProtocol.c | 38 ++---------------------------- 1 file changed, 2 insertions(+), 36 deletions(-) (limited to 'ShellPkg/Application/Shell') diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index e1aadb845d..89132969b6 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -645,8 +645,6 @@ EfiShellGetDeviceName( UINTN LoopVar; CHAR16 *DeviceNameToReturn; CHAR8 *Lang; - CHAR8 *TempChar; - UINTN ParentControllerCount; EFI_HANDLE *ParentControllerBuffer; UINTN ParentDriverCount; @@ -703,23 +701,7 @@ EfiShellGetDeviceName( if (EFI_ERROR(Status)) { continue; } - if (Language == NULL) { - Lang = AllocateZeroPool(AsciiStrSize(CompName2->SupportedLanguages)); - if (Lang == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - AsciiStrCpy(Lang, CompName2->SupportedLanguages); - TempChar = AsciiStrStr(Lang, ";"); - if (TempChar != NULL){ - *TempChar = CHAR_NULL; - } - } else { - Lang = AllocateZeroPool(AsciiStrSize(Language)); - if (Lang == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - AsciiStrCpy(Lang, Language); - } + Lang = GetBestLanguageForDriver(CompName2->SupportedLanguages, Language, FALSE); Status = CompName2->GetControllerName(CompName2, DeviceHandle, NULL, Lang, &DeviceNameToReturn); FreePool(Lang); Lang = NULL; @@ -762,23 +744,7 @@ EfiShellGetDeviceName( if (EFI_ERROR(Status)) { continue; } - if (Language == NULL) { - Lang = AllocateZeroPool(AsciiStrSize(CompName2->SupportedLanguages)); - if (Lang == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - AsciiStrCpy(Lang, CompName2->SupportedLanguages); - TempChar = AsciiStrStr(Lang, ";"); - if (TempChar != NULL){ - *TempChar = CHAR_NULL; - } - } else { - Lang = AllocateZeroPool(AsciiStrSize(Language)); - if (Lang == NULL) { - return (EFI_OUT_OF_RESOURCES); - } - AsciiStrCpy(Lang, Language); - } + Lang = GetBestLanguageForDriver(CompName2->SupportedLanguages, Language, FALSE); Status = CompName2->GetControllerName(CompName2, ParentControllerBuffer[LoopVar], DeviceHandle, Lang, &DeviceNameToReturn); FreePool(Lang); Lang = NULL; -- cgit v1.2.3