Refine code and check null pointer error.

Signed-off-by: ydong10
Reviewed-by: mdkinney

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12532 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2011-10-13 02:31:58 +00:00
parent 87200170b3
commit 90f6df07f8
1 changed files with 5 additions and 7 deletions

View File

@ -1972,20 +1972,16 @@ AsciiHiiToLower (
IN CHAR8 *ConfigString IN CHAR8 *ConfigString
) )
{ {
CHAR8 *String;
ASSERT (ConfigString != NULL); ASSERT (ConfigString != NULL);
// //
// Convert all hex digits in range [A-F] in the configuration header to [a-f] // Convert all hex digits in range [A-F] in the configuration header to [a-f]
// //
for (String = ConfigString; *String != '\0'; String++) { for (; *ConfigString != '\0'; ConfigString++) {
if ( *String >= 'A' && *String <= 'Z') { if ( *ConfigString >= 'A' && *ConfigString <= 'Z') {
*String = (CHAR8) (*String - 'A' + 'a'); *ConfigString = (CHAR8) (*ConfigString - 'A' + 'a');
} }
} }
return;
} }
/** /**
@ -2014,11 +2010,13 @@ HiiCompareLanguage (
// //
StrLen = AsciiStrSize (Language1); StrLen = AsciiStrSize (Language1);
Lan1 = AllocateZeroPool (StrLen); Lan1 = AllocateZeroPool (StrLen);
ASSERT (Lan1 != NULL);
AsciiStrCpy(Lan1, Language1); AsciiStrCpy(Lan1, Language1);
AsciiHiiToLower (Lan1); AsciiHiiToLower (Lan1);
StrLen = AsciiStrSize (Language2); StrLen = AsciiStrSize (Language2);
Lan2 = AllocateZeroPool (StrLen); Lan2 = AllocateZeroPool (StrLen);
ASSERT (Lan2 != NULL);
AsciiStrCpy(Lan2, Language2); AsciiStrCpy(Lan2, Language2);
AsciiHiiToLower (Lan2); AsciiHiiToLower (Lan2);