MdeModulePkg/UefiBootManagerLib: rebase to ARRAY_SIZE()

Cc: Feng Tian <feng.tian@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@Intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
Laszlo Ersek 2016-10-26 19:05:48 +02:00
parent a031a53fa4
commit f0209935ad
4 changed files with 5 additions and 5 deletions

View File

@ -632,7 +632,7 @@ BmGetBootDescription (
// Firstly get the default boot description
//
DefaultDescription = NULL;
for (Index = 0; Index < sizeof (mBmBootDescriptionHandlers) / sizeof (mBmBootDescriptionHandlers[0]); Index++) {
for (Index = 0; Index < ARRAY_SIZE (mBmBootDescriptionHandlers); Index++) {
DefaultDescription = mBmBootDescriptionHandlers[Index] (Handle);
if (DefaultDescription != NULL) {
//

View File

@ -430,7 +430,7 @@ EfiBootManagerUpdateConsoleVariable (
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
EFI_DEVICE_PATH_PROTOCOL *TempNewDevicePath;
if (ConsoleType >= sizeof (mConVarName) / sizeof (mConVarName[0])) {
if (ConsoleType >= ARRAY_SIZE (mConVarName)) {
return EFI_INVALID_PARAMETER;
}

View File

@ -680,7 +680,7 @@ BmProcessKeyOption (
KeyShiftStateCount = 0;
BmGenerateKeyShiftState (0, KeyOption, EFI_SHIFT_STATE_VALID, KeyShiftStates, &KeyShiftStateCount);
ASSERT (KeyShiftStateCount <= sizeof (KeyShiftStates) / sizeof (KeyShiftStates[0]));
ASSERT (KeyShiftStateCount <= ARRAY_SIZE (KeyShiftStates));
EfiAcquireLock (&mBmHotkeyLock);

View File

@ -796,7 +796,7 @@ EfiBootManagerIsValidLoadOptionVariableName (
return FALSE;
}
for (Index = 0; Index < sizeof (mBmLoadOptionName) / sizeof (mBmLoadOptionName[0]); Index++) {
for (Index = 0; Index < ARRAY_SIZE (mBmLoadOptionName); Index++) {
if ((VariableNameLen - 4 == StrLen (mBmLoadOptionName[Index])) &&
(StrnCmp (VariableName, mBmLoadOptionName[Index], VariableNameLen - 4) == 0)
) {
@ -804,7 +804,7 @@ EfiBootManagerIsValidLoadOptionVariableName (
}
}
if (Index == sizeof (mBmLoadOptionName) / sizeof (mBmLoadOptionName[0])) {
if (Index == ARRAY_SIZE (mBmLoadOptionName)) {
return FALSE;
}