summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-26 03:48:50 +0000
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2009-05-26 03:48:50 +0000
commitf324bf4dbeda4d64b769bd005331e8f9404b692d (patch)
tree2f595bc48d40f5d1a706d64e6797e926a554409e /MdeModulePkg
parentb0a5e682d632f139e8b4bd6a642aa15e0518a5c1 (diff)
downloadedk2-platforms-f324bf4dbeda4d64b769bd005331e8f9404b692d.tar.xz
Roll back changes to apply GetBestLanguage() in HiiDataBase. Exact language match should be used in HiiDatabase.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8384 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/Database.c5
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h18
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/String.c58
3 files changed, 61 insertions, 20 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index 9081e7c5cb..918559e544 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
@@ -784,7 +784,6 @@ InsertStringPackage (
EFI_STATUS Status;
EFI_HII_PACKAGE_HEADER PackageHeader;
CHAR8 *Language;
- CHAR8 *MatchedLanguage;
UINT32 LanguageSize;
LIST_ENTRY *Link;
@@ -810,10 +809,8 @@ InsertStringPackage (
AsciiStrCpy (Language, (CHAR8 *) PackageHdr + HeaderSize - LanguageSize);
for (Link = PackageList->StringPkgHdr.ForwardLink; Link != &PackageList->StringPkgHdr; Link = Link->ForwardLink) {
StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);
- MatchedLanguage = GetBestLanguage (StringPackage->StringPkgHdr->Language, FALSE, (CHAR8 *) Language, NULL);
- if (MatchedLanguage != NULL) {
+ if (HiiCompareLanguage (Language, StringPackage->StringPkgHdr->Language)) {
FreePool (Language);
- FreePool (MatchedLanguage);
return EFI_UNSUPPORTED;
}
}
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
index af6ef9aaf9..81f42c5bf2 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
@@ -1745,6 +1745,24 @@ HiiGetAltCfg (
OUT EFI_STRING *AltCfgResp
);
+
+/**
+ Compare whether two names of languages are identical.
+
+ @param Language1 Name of language 1
+ @param Language2 Name of language 2
+
+ @retval TRUE same
+ @retval FALSE not same
+
+**/
+BOOLEAN
+HiiCompareLanguage (
+ IN CHAR8 *Language1,
+ IN CHAR8 *Language2
+ )
+;
+
//
// Global variables
//
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
index 052abca689..00ff6ce786 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
@@ -968,7 +968,6 @@ HiiNewString (
EFI_HII_SIBT_EXT2_BLOCK Ext2;
HII_FONT_INFO *LocalFont;
HII_GLOBAL_FONT_INFO *GlobalFont;
- CHAR8 *MatchedLanguage;
if (This == NULL || String == NULL || StringId == NULL || Language == NULL || PackageList == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1015,9 +1014,7 @@ HiiNewString (
Link = Link->ForwardLink
) {
StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);
- MatchedLanguage = GetBestLanguage (StringPackage->StringPkgHdr->Language, FALSE, (CHAR8 *) Language, NULL);
- if (MatchedLanguage != NULL) {
- FreePool (MatchedLanguage);
+ if (HiiCompareLanguage (StringPackage->StringPkgHdr->Language, (CHAR8 *) Language)) {
Matched = TRUE;
break;
}
@@ -1323,7 +1320,6 @@ HiiGetString (
HII_DATABASE_RECORD *DatabaseRecord;
HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageListNode;
HII_STRING_PACKAGE_INSTANCE *StringPackage;
- CHAR8 *MatchedLanguage;
if (This == NULL || Language == NULL || StringId < 1 || StringSize == NULL || PackageList == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1357,9 +1353,7 @@ HiiGetString (
Link = Link->ForwardLink
) {
StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);
- MatchedLanguage = GetBestLanguage (StringPackage->StringPkgHdr->Language, FALSE, (CHAR8 *) Language, NULL);
- if (MatchedLanguage != NULL) {
- FreePool (MatchedLanguage);
+ if (HiiCompareLanguage (StringPackage->StringPkgHdr->Language, (CHAR8 *) Language)) {
Status = GetStringWorker (Private, StringPackage, StringId, String, StringSize, StringFontInfo);
if (Status != EFI_NOT_FOUND) {
return Status;
@@ -1427,7 +1421,6 @@ HiiSetString (
HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageListNode;
HII_STRING_PACKAGE_INSTANCE *StringPackage;
UINT32 OldPackageLen;
- CHAR8 *MatchedLanguage;
if (This == NULL || Language == NULL || StringId < 1 || String == NULL || PackageList == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1453,9 +1446,7 @@ HiiSetString (
Link = Link->ForwardLink
) {
StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);
- MatchedLanguage = GetBestLanguage (StringPackage->StringPkgHdr->Language, FALSE, (CHAR8 *) Language, NULL);
- if (MatchedLanguage != NULL) {
- FreePool (MatchedLanguage);
+ if (HiiCompareLanguage (StringPackage->StringPkgHdr->Language, (CHAR8 *) Language)) {
OldPackageLen = StringPackage->StringPkgHdr->Header.Length;
Status = SetStringWorker (
Private,
@@ -1612,7 +1603,6 @@ HiiGetSecondaryLanguages (
HII_STRING_PACKAGE_INSTANCE *StringPackage;
CHAR8 *Languages;
UINTN ResultSize;
- CHAR8 *MatchedLanguage;
if (This == NULL || PackageList == NULL || FirstLanguage == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1645,9 +1635,7 @@ HiiGetSecondaryLanguages (
Link1 = Link1->ForwardLink
) {
StringPackage = CR (Link1, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);
- MatchedLanguage = GetBestLanguage (StringPackage->StringPkgHdr->Language, FALSE, (CHAR8 *) FirstLanguage, NULL);
- if (MatchedLanguage != NULL) {
- FreePool (MatchedLanguage);
+ if (HiiCompareLanguage (StringPackage->StringPkgHdr->Language, (CHAR8 *) FirstLanguage)) {
Languages = StringPackage->StringPkgHdr->Language;
//
// Language is a series of ';' terminated strings, first one is primary
@@ -1675,3 +1663,41 @@ HiiGetSecondaryLanguages (
return EFI_INVALID_LANGUAGE;
}
+/**
+ Compare whether two names of languages are identical.
+
+ @param Language1 Name of language 1
+ @param Language2 Name of language 2
+
+ @retval TRUE same
+ @retval FALSE not same
+
+**/
+BOOLEAN
+HiiCompareLanguage (
+ IN CHAR8 *Language1,
+ IN CHAR8 *Language2
+ )
+{
+ //
+ // Porting Guide:
+ // This library interface is simply obsolete.
+ // Include the source code to user code.
+ //
+ UINTN Index;
+
+ for (Index = 0; (Language1[Index] != 0) && (Language2[Index] != 0); Index++) {
+ if (Language1[Index] != Language2[Index]) {
+ return FALSE;
+ }
+ }
+
+ if (((Language1[Index] == 0) && (Language2[Index] == 0)) ||
+ ((Language1[Index] == 0) && (Language2[Index] != ';')) ||
+ ((Language1[Index] == ';') && (Language2[Index] != 0)) ||
+ ((Language1[Index] == ';') && (Language2[Index] != ';'))) {
+ return TRUE;
+ }
+
+ return FALSE;
+}