]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FatPkg/EnhancedFatDxe/UnicodeCollation.c
Merge 2-clause BSD licensed FatPkg
[mirror_edk2.git] / FatPkg / EnhancedFatDxe / UnicodeCollation.c
index e0b7e0d6f030d0ab26c8197d6bf2c45340102f23..61b9aab4d93a66296001cd0b2bd175490c826f60 100644 (file)
@@ -2,14 +2,14 @@
   Unicode Collation Support component that hides the trivial difference of Unicode Collation\r
   and Unicode collation 2 Protocol.\r
 \r
-  Copyright (c) 2007 - 2009, Intel Corporation<BR>\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
-  http://opensource.org/licenses/bsd-license.php\r
+  Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are licensed and made available\r
+under the terms and conditions of the BSD License which accompanies this\r
+distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
 \r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
@@ -20,11 +20,8 @@ EFI_UNICODE_COLLATION_PROTOCOL  *mUnicodeCollationInterface = NULL;
 /**\r
   Worker function to initialize Unicode Collation support.\r
 \r
-  This function searches Initialized Unicode Collation support based on PCDs:\r
-  PcdUnicodeCollation2Support and PcdUnicodeCollationSupport.\r
-  It first tries to locate Unicode Collation 2 protocol and matches it with current\r
-  platform language code. If for any reason the first attempt fails, it then tries to\r
-  use Unicode Collation Protocol.\r
+  It tries to locate Unicode Collation (2) protocol and matches it with current\r
+  platform language code.\r
 \r
   @param  AgentHandle          The handle used to open Unicode Collation (2) protocol.\r
   @param  ProtocolGuid         The pointer to Unicode Collation (2) protocol GUID.\r
@@ -43,6 +40,7 @@ InitializeUnicodeCollationSupportWorker (
   IN CONST CHAR8        *DefaultLanguage\r
   )\r
 {\r
+  EFI_STATUS                      ReturnStatus;\r
   EFI_STATUS                      Status;\r
   UINTN                           NumHandles;\r
   UINTN                           Index;\r
@@ -64,9 +62,9 @@ InitializeUnicodeCollationSupportWorker (
   }\r
 \r
   Iso639Language = (BOOLEAN) (ProtocolGuid == &gEfiUnicodeCollationProtocolGuid);\r
-  Language = GetEfiGlobalVariable(VariableName);\r
+  GetEfiGlobalVariable2 (VariableName, (VOID**) &Language, NULL);\r
 \r
-  Status = EFI_UNSUPPORTED;\r
+  ReturnStatus = EFI_UNSUPPORTED;\r
   for (Index = 0; Index < NumHandles; Index++) {\r
     //\r
     // Open Unicode Collation Protocol\r
@@ -90,14 +88,14 @@ InitializeUnicodeCollationSupportWorker (
     BestLanguage = GetBestLanguage (\r
                      Uci->SupportedLanguages,\r
                      Iso639Language,\r
-                     (Language == NULL) ? Language : "",\r
+                     (Language == NULL) ? "" : Language,\r
                      DefaultLanguage,\r
                      NULL\r
                      );\r
     if (BestLanguage != NULL) {\r
       FreePool (BestLanguage);\r
       mUnicodeCollationInterface = Uci;\r
-      Status = EFI_SUCCESS;\r
+      ReturnStatus = EFI_SUCCESS;\r
       break;\r
     }\r
   }\r
@@ -108,15 +106,13 @@ InitializeUnicodeCollationSupportWorker (
 \r
   FreePool (Handles);\r
 \r
-  return Status;\r
+  return ReturnStatus;\r
 }\r
 \r
 /**\r
   Initialize Unicode Collation support.\r
 \r
-  This function searches Initialized Unicode Collation support based on PCDs:\r
-  PcdUnicodeCollation2Support and PcdUnicodeCollationSupport.\r
-  It first tries to locate Unicode Collation 2 protocol and matches it with current\r
+  It tries to locate Unicode Collation 2 protocol and matches it with current\r
   platform language code. If for any reason the first attempt fails, it then tries to\r
   use Unicode Collation Protocol.\r
 \r
@@ -139,20 +135,17 @@ InitializeUnicodeCollationSupport (
   //\r
   // First try to use RFC 4646 Unicode Collation 2 Protocol.\r
   //\r
-  if (FeaturePcdGet (PcdUnicodeCollation2Support)) {\r
-    Status = InitializeUnicodeCollationSupportWorker (\r
-               AgentHandle,\r
-               &gEfiUnicodeCollation2ProtocolGuid,\r
-               L"PlatformLang",\r
-               (CONST CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang)\r
-               );\r
-  }\r
-\r
+  Status = InitializeUnicodeCollationSupportWorker (\r
+             AgentHandle,\r
+             &gEfiUnicodeCollation2ProtocolGuid,\r
+             L"PlatformLang",\r
+             (CONST CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang)\r
+             );\r
   //\r
   // If the attempt to use Unicode Collation 2 Protocol fails, then we fall back\r
   // on the ISO 639-2 Unicode Collation Protocol.\r
   //\r
-  if (FeaturePcdGet (PcdUnicodeCollationSupport) && EFI_ERROR (Status)) {\r
+  if (EFI_ERROR (Status)) {\r
     Status = InitializeUnicodeCollationSupportWorker (\r
                AgentHandle,\r
                &gEfiUnicodeCollationProtocolGuid,\r