MdeModulePkg: Use BmCharToUint in BmIsKeyOptionVariable

The patch also moves the BmCharToUint to BmMisc.c because it
belongs to misc functions.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Sunny Wang <sunnywang@hpe.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18855 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Ruiyu Ni
2015-11-17 10:08:40 +00:00
committed by niruiyu
parent d95ff8e8d8
commit 418e8cd924
4 changed files with 44 additions and 28 deletions

View File

@@ -88,6 +88,7 @@ BmIsKeyOptionVariable (
)
{
UINTN Index;
UINTN Uint;
if (!CompareGuid (Guid, &gEfiGlobalVariableGuid) ||
(StrSize (Name) != sizeof (L"Key####")) ||
@@ -98,12 +99,11 @@ BmIsKeyOptionVariable (
*OptionNumber = 0;
for (Index = 3; Index < 7; Index++) {
if ((Name[Index] >= L'0') && (Name[Index] <= L'9')) {
*OptionNumber = *OptionNumber * 16 + Name[Index] - L'0';
} else if ((Name[Index] >= L'A') && (Name[Index] <= L'F')) {
*OptionNumber = *OptionNumber * 16 + Name[Index] - L'A' + 10;
} else {
Uint = BmCharToUint (Name[Index]);
if (Uint == -1) {
return FALSE;
} else {
*OptionNumber = (UINT16) Uint + *OptionNumber * 0x10;
}
}