X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=FatPkg%2FEnhancedFatDxe%2FUnicodeCollation.c;h=9b22e05bc320f4846fab394fbf4ad8a23bee0220;hb=a7ef158b07524f9afd0cefa3180aeac0fcb6e436;hp=574db9783e3518cb6864b91ef14347c78b3d7216;hpb=b2477ca46c8b6a8b65ffe076f68db5daafec7d32;p=mirror_edk2.git diff --git a/FatPkg/EnhancedFatDxe/UnicodeCollation.c b/FatPkg/EnhancedFatDxe/UnicodeCollation.c index 574db9783e..9b22e05bc3 100644 --- a/FatPkg/EnhancedFatDxe/UnicodeCollation.c +++ b/FatPkg/EnhancedFatDxe/UnicodeCollation.c @@ -2,14 +2,8 @@ Unicode Collation Support component that hides the trivial difference of Unicode Collation and Unicode collation 2 Protocol. - Copyright (c) 2007 - 2009, Intel Corporation
- All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -20,11 +14,8 @@ EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollationInterface = NULL; /** Worker function to initialize Unicode Collation support. - This function searches Initialized Unicode Collation support based on PCDs: - PcdUnicodeCollation2Support and PcdUnicodeCollationSupport. - It first tries to locate Unicode Collation 2 protocol and matches it with current - platform language code. If for any reason the first attempt fails, it then tries to - use Unicode Collation Protocol. + It tries to locate Unicode Collation (2) protocol and matches it with current + platform language code. @param AgentHandle The handle used to open Unicode Collation (2) protocol. @param ProtocolGuid The pointer to Unicode Collation (2) protocol GUID. @@ -43,6 +34,7 @@ InitializeUnicodeCollationSupportWorker ( IN CONST CHAR8 *DefaultLanguage ) { + EFI_STATUS ReturnStatus; EFI_STATUS Status; UINTN NumHandles; UINTN Index; @@ -64,9 +56,9 @@ InitializeUnicodeCollationSupportWorker ( } Iso639Language = (BOOLEAN) (ProtocolGuid == &gEfiUnicodeCollationProtocolGuid); - Language = GetEfiGlobalVariable(VariableName); + GetEfiGlobalVariable2 (VariableName, (VOID**) &Language, NULL); - Status = EFI_UNSUPPORTED; + ReturnStatus = EFI_UNSUPPORTED; for (Index = 0; Index < NumHandles; Index++) { // // Open Unicode Collation Protocol @@ -85,29 +77,19 @@ InitializeUnicodeCollationSupportWorker ( // // Find the best matching matching language from the supported languages - // of Unicode Collation (2) protocol. + // of Unicode Collation (2) protocol. // - if (Language == NULL) { - BestLanguage = GetBestLanguage ( - Uci->SupportedLanguages, - Iso639Language, - DefaultLanguage, - NULL - ); - } else { - BestLanguage = GetBestLanguage ( - Uci->SupportedLanguages, - Iso639Language, - Language, - Iso639Language, - DefaultLanguage, - NULL - ); - } + BestLanguage = GetBestLanguage ( + Uci->SupportedLanguages, + Iso639Language, + (Language == NULL) ? "" : Language, + DefaultLanguage, + NULL + ); if (BestLanguage != NULL) { FreePool (BestLanguage); mUnicodeCollationInterface = Uci; - Status = EFI_SUCCESS; + ReturnStatus = EFI_SUCCESS; break; } } @@ -118,15 +100,13 @@ InitializeUnicodeCollationSupportWorker ( FreePool (Handles); - return Status; + return ReturnStatus; } /** Initialize Unicode Collation support. - This function searches Initialized Unicode Collation support based on PCDs: - PcdUnicodeCollation2Support and PcdUnicodeCollationSupport. - It first tries to locate Unicode Collation 2 protocol and matches it with current + It tries to locate Unicode Collation 2 protocol and matches it with current platform language code. If for any reason the first attempt fails, it then tries to use Unicode Collation Protocol. @@ -149,20 +129,17 @@ InitializeUnicodeCollationSupport ( // // First try to use RFC 4646 Unicode Collation 2 Protocol. // - if (FeaturePcdGet (PcdUnicodeCollation2Support)) { - Status = InitializeUnicodeCollationSupportWorker ( - AgentHandle, - &gEfiUnicodeCollation2ProtocolGuid, - L"PlatformLang", - (CONST CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang) - ); - } - + Status = InitializeUnicodeCollationSupportWorker ( + AgentHandle, + &gEfiUnicodeCollation2ProtocolGuid, + L"PlatformLang", + (CONST CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang) + ); // // If the attempt to use Unicode Collation 2 Protocol fails, then we fall back // on the ISO 639-2 Unicode Collation Protocol. // - if (FeaturePcdGet (PcdUnicodeCollationSupport) && EFI_ERROR (Status)) { + if (EFI_ERROR (Status)) { Status = InitializeUnicodeCollationSupportWorker ( AgentHandle, &gEfiUnicodeCollationProtocolGuid, @@ -206,9 +183,8 @@ FatStriCmp ( /** Uppercase a string. - @param Str The string which will be upper-cased. + @param String The string which will be upper-cased. - @return None. **/ VOID @@ -226,9 +202,8 @@ FatStrUpr ( /** Lowercase a string - @param Str The string which will be lower-cased. + @param String The string which will be lower-cased. - @return None **/ VOID