Skip to content

Commit 45d5c3e

Browse files
committed
MdeModulePkg/VarCheckUefiLib: Replace HexaDecimalDigitCharacter()
With the newly added string function to BaseLib, replace VarCheckUefiIsHexaDecimalDigitCharacter() by StrCharIsUpperHexNum(). Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
1 parent 01d23f5 commit 45d5c3e

File tree

1 file changed

+8
-31
lines changed

1 file changed

+8
-31
lines changed

MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLibNullClass.c

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -684,29 +684,6 @@ EFI_GUID *mUefiDefinedGuid[] = {
684684
&gEfiHardwareErrorVariableGuid
685685
};
686686

687-
/**
688-
Check if a Unicode character is an upper case hexadecimal character.
689-
690-
This function checks if a Unicode character is an upper case
691-
hexadecimal character. The valid upper case hexadecimal character is
692-
L'0' to L'9', or L'A' to L'F'.
693-
694-
695-
@param[in] Char The character to check against.
696-
697-
@retval TRUE If the Char is an upper case hexadecmial character.
698-
@retval FALSE If the Char is not an upper case hexadecmial character.
699-
700-
**/
701-
BOOLEAN
702-
EFIAPI
703-
VarCheckUefiIsHexaDecimalDigitCharacter (
704-
IN CHAR16 Char
705-
)
706-
{
707-
return (BOOLEAN)((Char >= L'0' && Char <= L'9') || (Char >= L'A' && Char <= L'F'));
708-
}
709-
710687
/**
711688
712689
This code checks if variable is hardware error record variable or not.
@@ -731,10 +708,10 @@ IsHwErrRecVariable (
731708
if (!CompareGuid (VendorGuid, &gEfiHardwareErrorVariableGuid) ||
732709
(StrLen (VariableName) != StrLen (L"HwErrRec####")) ||
733710
(StrnCmp (VariableName, L"HwErrRec", StrLen (L"HwErrRec")) != 0) ||
734-
!VarCheckUefiIsHexaDecimalDigitCharacter (VariableName[0x8]) ||
735-
!VarCheckUefiIsHexaDecimalDigitCharacter (VariableName[0x9]) ||
736-
!VarCheckUefiIsHexaDecimalDigitCharacter (VariableName[0xA]) ||
737-
!VarCheckUefiIsHexaDecimalDigitCharacter (VariableName[0xB]))
711+
!CharIsUpperHexNum (VariableName[0x8]) ||
712+
!CharIsUpperHexNum (VariableName[0x9]) ||
713+
!CharIsUpperHexNum (VariableName[0xA]) ||
714+
!CharIsUpperHexNum (VariableName[0xB]))
738715
{
739716
return FALSE;
740717
}
@@ -780,10 +757,10 @@ GetUefiDefinedVarCheckFunction (
780757
for (Index = 0; Index < sizeof (mGlobalVariableList2)/sizeof (mGlobalVariableList2[0]); Index++) {
781758
if ((StrLen (VariableName) == StrLen (mGlobalVariableList2[Index].Name)) &&
782759
(StrnCmp (VariableName, mGlobalVariableList2[Index].Name, NameLength) == 0) &&
783-
VarCheckUefiIsHexaDecimalDigitCharacter (VariableName[NameLength]) &&
784-
VarCheckUefiIsHexaDecimalDigitCharacter (VariableName[NameLength + 1]) &&
785-
VarCheckUefiIsHexaDecimalDigitCharacter (VariableName[NameLength + 2]) &&
786-
VarCheckUefiIsHexaDecimalDigitCharacter (VariableName[NameLength + 3]))
760+
CharIsUpperHexNum (VariableName[NameLength]) &&
761+
CharIsUpperHexNum (VariableName[NameLength + 1]) &&
762+
CharIsUpperHexNum (VariableName[NameLength + 2]) &&
763+
CharIsUpperHexNum (VariableName[NameLength + 3]))
787764
{
788765
*VariableProperty = &(mGlobalVariableList2[Index].VariableProperty);
789766
return mGlobalVariableList2[Index].CheckFunction;

0 commit comments

Comments
 (0)