summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2015-11-17 10:08:40 +0000
committerniruiyu <niruiyu@Edk2>2015-11-17 10:08:40 +0000
commit418e8cd9240af2249be0cb1d1e38b81b603218e4 (patch)
tree41eeddf293b6809066c150075fa0ff85695f2f3e /MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
parentd95ff8e8d86b36482b815141233f6c315b43c203 (diff)
downloadedk2-418e8cd9240af2249be0cb1d1e38b81b603218e4.tar.gz
edk2-418e8cd9240af2249be0cb1d1e38b81b603218e4.tar.bz2
edk2-418e8cd9240af2249be0cb1d1e38b81b603218e4.zip
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
Diffstat (limited to 'MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c')
-rw-r--r--MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
index 8d398fb4c6..ff1cbe933c 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
@@ -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;
}
}