diff options
author | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-03-17 07:31:35 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-03-17 07:31:35 +0000 |
commit | 4a12dfd454c56a0256fa4ec4b4b27dac8ae79bf1 (patch) | |
tree | 1d4b4e08904c7063dde462b059b050861d097af2 /MdeModulePkg | |
parent | a70dbff78560f4ad676d5072dcd3d1690d071656 (diff) | |
download | edk2-platforms-4a12dfd454c56a0256fa4ec4b4b27dac8ae79bf1.tar.xz |
Use exactly match method for HiiCompareLanguage.
Compare all of Language2 against the characters in Language1 up to the first ‘;’ or Null terminator.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11409 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/HiiDatabaseDxe/String.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c index eeac9c2087..194e44e6d0 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c @@ -1967,11 +1967,25 @@ HiiCompareLanguage ( IN CHAR8 *Language2
)
{
- UINTN Language2Len;
+ UINTN Index;
+
+ //
+ // Compare the Primary Language in Language1 to Language2
+ //
+ for (Index = 0; Language1[Index] != 0 && Language1[Index] != ';'; Index++) {
+ if (Language1[Index] != Language2[Index]) {
+ //
+ // Return FALSE if any characters are different.
+ //
+ return FALSE;
+ }
+ }
//
- // When languages are exactly same, they will be identical.
+ // Only return TRUE if Language2[Index] is a Null-terminator which means
+ // the Primary Language in Language1 is the same length as Language2. If
+ // Language2[Index] is not a Null-terminator, then Language2 is longer than
+ // the Primary Language in Language1, and FALSE must be returned.
//
- Language2Len = AsciiStrLen (Language2);
- return (BOOLEAN) (AsciiStrnCmp (Language1, Language2, Language2Len) == 0);
+ return (Language2[Index] == 0);
}
|