MdeModulePkg/DisplayEngineDxe: rebase to ARRAY_SIZE()
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Feng Tian <feng.tian@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: Feng Tian <feng.tian@Intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
index 89ed3bb..c2cffec 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c
@@ -49,7 +49,7 @@
}
};
-UINTN mScanCodeNumber = sizeof (gScanCodeToOperation) / sizeof (gScanCodeToOperation[0]);
+UINTN mScanCodeNumber = ARRAY_SIZE (gScanCodeToOperation);
SCREEN_OPERATION_T0_CONTROL_FLAG gScreenOperationToControlFlag[] = {
{
@@ -3248,7 +3248,7 @@
}
for (Index = 0;
- Index < sizeof (gScreenOperationToControlFlag) / sizeof (gScreenOperationToControlFlag[0]);
+ Index < ARRAY_SIZE (gScreenOperationToControlFlag);
Index++
) {
if (ScreenOperation == gScreenOperationToControlFlag[Index].ScreenOperation) {
diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
index 8e7b735..400b934 100644
--- a/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
+++ b/MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c
@@ -1070,14 +1070,14 @@
if (ValidateFail) {
UpdateStatusBar (INPUT_ERROR, TRUE);
- ASSERT (Count < sizeof (PreviousNumber) / sizeof (PreviousNumber[0]));
+ ASSERT (Count < ARRAY_SIZE (PreviousNumber));
EditValue = PreviousNumber[Count];
break;
}
} else {
if (EditValue > Maximum) {
UpdateStatusBar (INPUT_ERROR, TRUE);
- ASSERT (Count < sizeof (PreviousNumber) / sizeof (PreviousNumber[0]));
+ ASSERT (Count < ARRAY_SIZE (PreviousNumber));
EditValue = PreviousNumber[Count];
break;
}
@@ -1086,7 +1086,7 @@
UpdateStatusBar (INPUT_ERROR, FALSE);
Count++;
- ASSERT (Count < (sizeof (PreviousNumber) / sizeof (PreviousNumber[0])));
+ ASSERT (Count < (ARRAY_SIZE (PreviousNumber)));
PreviousNumber[Count] = EditValue;
gST->ConOut->SetAttribute (gST->ConOut, GetHighlightTextColor ());