summaryrefslogtreecommitdiff
path: root/EdkCompatibilityPkg
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-11 05:19:30 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-11 05:19:30 +0000
commit43ffc47f9c270ee39b02cc5b18fa031ecdae6f25 (patch)
tree9412d23ac27b5fbe12aa1a1d6fa7ac47967a0269 /EdkCompatibilityPkg
parent3b428adef9078ceb47d33dddffe1d3e140efb9dd (diff)
downloadedk2-platforms-43ffc47f9c270ee39b02cc5b18fa031ecdae6f25.tar.xz
Enhance HiiThunkGetString to handle the case that PlatformLanguage is not set.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9408 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkCompatibilityPkg')
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c
index d83750bc9b..3165f62676 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c
@@ -308,6 +308,9 @@ HiiThunkGetString (
Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
Rfc4646AsciiLanguage = NULL;
+ SupportedLanguages = NULL;
+ PlatformLanguage = NULL;
+ Status = EFI_SUCCESS;
if (LanguageString != NULL) {
Iso639AsciiLanguage = AllocateZeroPool (StrLen (LanguageString) + 1);
@@ -328,7 +331,6 @@ HiiThunkGetString (
// Iso639ToRfc4646Map.
//
ASSERT (Rfc4646AsciiLanguage != NULL);
-
}
UefiHiiHandle = FwHiiHandleToUefiHiiHandle (Private, Handle);
@@ -342,16 +344,13 @@ HiiThunkGetString (
//
SupportedLanguages = HiiGetSupportedLanguages (UefiHiiHandle);
if (SupportedLanguages == NULL) {
- goto Error2;
+ goto Done;
}
//
// Get the current platform language setting
//
PlatformLanguage = GetEfiGlobalVariable (L"PlatformLang");
- if (PlatformLanguage == NULL) {
- goto Error1;
- }
//
// Get the best matching language from SupportedLanguages
@@ -359,36 +358,38 @@ HiiThunkGetString (
BestLanguage = GetBestLanguage (
SupportedLanguages,
FALSE, // RFC 4646 mode
- (Rfc4646AsciiLanguage != NULL) ? Rfc4646AsciiLanguage : "",
- PlatformLanguage, // Next highest priority
+ (Rfc4646AsciiLanguage != NULL) ? Rfc4646AsciiLanguage : "", // Highest priority
+ (PlatformLanguage != NULL) ? PlatformLanguage : "", // Next highest priority
SupportedLanguages, // Lowest priority
NULL
);
- if (BestLanguage == NULL) {
- FreePool (PlatformLanguage);
-Error1:
- FreePool (SupportedLanguages);
-Error2:
+ if (BestLanguage != NULL) {
+ Status = mHiiStringProtocol->GetString (
+ mHiiStringProtocol,
+ BestLanguage,
+ UefiHiiHandle,
+ Token,
+ StringBuffer,
+ BufferLengthTemp,
+ NULL
+ );
+ FreePool (BestLanguage);
+ } else {
Status = EFI_INVALID_PARAMETER;
- goto Done;
}
- Status = mHiiStringProtocol->GetString (
- mHiiStringProtocol,
- BestLanguage,
- UefiHiiHandle,
- Token,
- StringBuffer,
- BufferLengthTemp,
- NULL
- );
- FreePool (BestLanguage);
-
Done:
if (Rfc4646AsciiLanguage != NULL) {
FreePool (Rfc4646AsciiLanguage);
}
-
+
+ if (SupportedLanguages != NULL) {
+ FreePool (SupportedLanguages);
+ }
+
+ if (PlatformLanguage != NULL) {
+ FreePool (PlatformLanguage);
+ }
return Status;
}