diff options
author | rsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-05-26 03:48:50 +0000 |
---|---|---|
committer | rsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-05-26 03:48:50 +0000 |
commit | f324bf4dbeda4d64b769bd005331e8f9404b692d (patch) | |
tree | 2f595bc48d40f5d1a706d64e6797e926a554409e /MdeModulePkg/Universal/HiiDatabaseDxe/String.c | |
parent | b0a5e682d632f139e8b4bd6a642aa15e0518a5c1 (diff) | |
download | edk2-f324bf4dbeda4d64b769bd005331e8f9404b692d.zip edk2-f324bf4dbeda4d64b769bd005331e8f9404b692d.tar.gz edk2-f324bf4dbeda4d64b769bd005331e8f9404b692d.tar.bz2 |
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/Universal/HiiDatabaseDxe/String.c')
-rw-r--r-- | MdeModulePkg/Universal/HiiDatabaseDxe/String.c | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c index 052abca..00ff6ce 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;
+}
|