]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/HiiDatabaseDxe/String.c
String Reference Cleanup.
[mirror_edk2.git] / MdeModulePkg / Universal / HiiDatabaseDxe / String.c
index 0846abfe4253c0ed2adbbf565eb4aa6b0b564b9a..bec8ce748c7aa265431d761477b1b960483bfe4e 100644 (file)
@@ -1763,7 +1763,8 @@ HiiSetString (
 \r
   @param  This                   A pointer to the EFI_HII_STRING_PROTOCOL instance.\r
   @param  PackageList            The package list to examine.\r
-  @param  Languages              Points to the buffer to hold the returned string.\r
+  @param  Languages              Points to the buffer to hold the returned\r
+                                 null-terminated ASCII string.\r
   @param  LanguagesSize          On entry, points to the size of the buffer pointed\r
                                  to by  Languages, in bytes. On  return, points to\r
                                  the length of Languages, in bytes.\r
@@ -1851,25 +1852,28 @@ HiiGetLanguages (
 \r
   @param  This                   A pointer to the EFI_HII_STRING_PROTOCOL instance.\r
   @param  PackageList            The package list to examine.\r
-  @param  FirstLanguage          Points to the primary language.\r
-  @param  SecondaryLanguages     Points to the buffer to hold the returned list of\r
+  @param  PrimaryLanguage        Points to the null-terminated ASCII string that specifies\r
+                                 the primary language. Languages are specified in the\r
+                                 format specified in Appendix M of the UEFI 2.0 specification.\r
+  @param  SecondaryLanguages     Points to the buffer to hold the returned null-terminated\r
+                                 ASCII string that describes the list of\r
                                  secondary languages for the specified\r
-                                 FirstLanguage. If there are no secondary\r
-                                 languages, the function  returns successfully, but\r
+                                 PrimaryLanguage. If there are no secondary\r
+                                 languages, the function returns successfully, but\r
                                  this is set to NULL.\r
   @param  SecondaryLanguagesSize On entry, points to the size of the buffer pointed\r
-                                 to  by SecondaryLanguages, in bytes. On return,\r
+                                 to by SecondaryLanguages, in bytes. On return,\r
                                  points to the length of SecondaryLanguages in bytes.\r
 \r
   @retval EFI_SUCCESS            Secondary languages were correctly returned.\r
-  @retval EFI_INVALID_PARAMETER  FirstLanguage or SecondaryLanguages or\r
+  @retval EFI_INVALID_PARAMETER  PrimaryLanguage or SecondaryLanguages or\r
                                  SecondaryLanguagesSize was NULL.\r
   @retval EFI_BUFFER_TOO_SMALL   The buffer specified by SecondaryLanguagesSize is\r
                                  too small to hold the returned information.\r
-                                 SecondLanguageSize is updated to hold the size of\r
+                                 SecondaryLanguageSize is updated to hold the size of\r
                                  the buffer required.\r
-  @retval EFI_INVALID_LANGUAGE           The language specified by FirstLanguage is not\r
-                                  present in the specified package list.\r
+  @retval EFI_INVALID_LANGUAGE   The language specified by PrimaryLanguage is not\r
+                                 present in the specified package list.\r
   @retval EFI_NOT_FOUND          The specified PackageList is not in the Database.                                \r
 \r
 **/\r
@@ -1878,7 +1882,7 @@ EFIAPI
 HiiGetSecondaryLanguages (\r
   IN CONST EFI_HII_STRING_PROTOCOL   *This,\r
   IN EFI_HII_HANDLE                  PackageList,\r
-  IN CONST CHAR8                     *FirstLanguage,\r
+  IN CONST CHAR8                     *PrimaryLanguage,\r
   IN OUT CHAR8                       *SecondaryLanguages,\r
   IN OUT UINTN                       *SecondaryLanguagesSize\r
   )\r
@@ -1892,7 +1896,7 @@ HiiGetSecondaryLanguages (
   CHAR8                               *Languages;\r
   UINTN                               ResultSize;\r
 \r
-  if (This == NULL || PackageList == NULL || FirstLanguage == NULL) {\r
+  if (This == NULL || PackageList == NULL || PrimaryLanguage == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
   if (SecondaryLanguages == NULL || SecondaryLanguagesSize == NULL) {\r
@@ -1923,7 +1927,7 @@ HiiGetSecondaryLanguages (
          Link1 = Link1->ForwardLink\r
         ) {\r
     StringPackage = CR (Link1, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);\r
-    if (HiiCompareLanguage (StringPackage->StringPkgHdr->Language, (CHAR8 *) FirstLanguage)) {\r
+    if (HiiCompareLanguage (StringPackage->StringPkgHdr->Language, (CHAR8 *) PrimaryLanguage)) {\r
       Languages = StringPackage->StringPkgHdr->Language;\r
       //\r
       // Language is a series of ';' terminated strings, first one is primary\r
@@ -1954,8 +1958,8 @@ HiiGetSecondaryLanguages (
 /**\r
   Compare whether two names of languages are identical.\r
 \r
-  @param  Language1              Name of language 1\r
-  @param  Language2              Name of language 2\r
+  @param  Language1              Name of language 1 from StringPackage\r
+  @param  Language2              Name of language 2 to be compared with language 1.\r
 \r
   @retval TRUE                   same\r
   @retval FALSE                  not same\r
@@ -1967,25 +1971,25 @@ HiiCompareLanguage (
   IN  CHAR8  *Language2\r
   )\r
 {\r
+  UINTN  Index;\r
+\r
   //\r
-  // Porting Guide:\r
-  // This library interface is simply obsolete.\r
-  // Include the source code to user code.\r
+  // Compare the Primary Language in Language1 to Language2\r
   //\r
-  UINTN Index;\r
-\r
-  for (Index = 0; (Language1[Index] != 0) && (Language2[Index] != 0); Index++) {\r
+  for (Index = 0; Language1[Index] != 0 && Language1[Index] != ';'; Index++) {\r
     if (Language1[Index] != Language2[Index]) {\r
+      //\r
+      // Return FALSE if any characters are different.\r
+      //\r
       return FALSE;\r
     }\r
   }\r
 \r
-  if (((Language1[Index] == 0) && (Language2[Index] == 0))   || \r
-         ((Language1[Index] == 0) && (Language2[Index] != ';')) ||\r
-         ((Language1[Index] == ';') && (Language2[Index] != 0)) ||\r
-         ((Language1[Index] == ';') && (Language2[Index] != ';'))) {\r
-    return TRUE;\r
-  }\r
-\r
-  return FALSE;\r
+  //\r
+  // Only return TRUE if Language2[Index] is a Null-terminator which means\r
+  // the Primary Language in Language1 is the same length as Language2.  If\r
+  // Language2[Index] is not a Null-terminator, then Language2 is longer than\r
+  // the Primary Language in Language1, and FALSE must be returned.\r
+  //\r
+  return (BOOLEAN) (Language2[Index] == 0);\r
 }\r