Update HiiString Protocol and HiiSetString Api in HiiLib

1. Reserve the unique string identifier for all languages in the package list. 
2. Track MaxStringId to do the simple check for the requested StringId > MaxStringId, which can improve performance.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9954 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4
2010-02-09 07:12:35 +00:00
parent 995c594047
commit d6a82eaf8d
5 changed files with 192 additions and 89 deletions

View File

@@ -1,7 +1,7 @@
/** @file
HII Library implementation that uses DXE protocols and services.
Copyright (c) 2006 - 2008, Intel Corporation<BR>
Copyright (c) 2006 - 2010, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -66,7 +66,6 @@ HiiSetString (
CHAR8 *AllocatedLanguages;
CHAR8 *Supported;
CHAR8 *Language;
EFI_STRING_ID NewStringId;
ASSERT (HiiHandle != NULL);
ASSERT (String != NULL);
@@ -90,7 +89,6 @@ HiiSetString (
return (EFI_STRING_ID)(0);
}
NewStringId = 0;
Status = EFI_INVALID_PARAMETER;
//
// Loop through each language that the string supports
@@ -113,7 +111,7 @@ HiiSetString (
// If StringId is 0, then call NewString(). Otherwise, call SetString()
//
if (StringId == (EFI_STRING_ID)(0)) {
Status = gHiiString->NewString (gHiiString, HiiHandle, &NewStringId, Language, NULL, String, NULL);
Status = gHiiString->NewString (gHiiString, HiiHandle, &StringId, Language, NULL, String, NULL);
} else {
Status = gHiiString->SetString (gHiiString, HiiHandle, StringId, Language, String, NULL);
}
@@ -133,8 +131,6 @@ HiiSetString (
if (EFI_ERROR (Status)) {
return (EFI_STRING_ID)(0);
} else if (StringId == (EFI_STRING_ID)(0)) {
return NewStringId;
} else {
return StringId;
}