public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel-01 <edk2-devel@ml01.01.org>
Cc: Dandan Bi <dandan.bi@intel.com>, Eric Dong <eric.dong@intel.com>,
	Feng Tian <feng.tian@intel.com>, Star Zeng <star.zeng@intel.com>
Subject: [PATCH 23/47] MdeModulePkg/BootMaintenanceManagerUiLib: rebase to ARRAY_SIZE()
Date: Wed, 26 Oct 2016 21:04:40 +0200	[thread overview]
Message-ID: <20161026190504.9888-24-lersek@redhat.com> (raw)
In-Reply-To: <20161026190504.9888-1-lersek@redhat.com>

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>
---
 MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c |  8 ++++----
 MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c   |  8 ++++----
 MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c      | 12 ++++++------
 MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c        |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
index 33c85b7d8599..5cccbf6de15d 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
@@ -548,16 +548,16 @@ UpdateTerminalContent (
     ASSERT (NewMenuEntry != NULL);
     NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
     NewTerminalContext->BaudRateIndex = BmmData->COMBaudRate[Index];
-    ASSERT (BmmData->COMBaudRate[Index] < (sizeof (BaudRateList) / sizeof (BaudRateList[0])));
+    ASSERT (BmmData->COMBaudRate[Index] < (ARRAY_SIZE (BaudRateList)));
     NewTerminalContext->BaudRate      = BaudRateList[BmmData->COMBaudRate[Index]].Value;
     NewTerminalContext->DataBitsIndex = BmmData->COMDataRate[Index];
-    ASSERT (BmmData->COMDataRate[Index] < (sizeof (DataBitsList) / sizeof (DataBitsList[0])));
+    ASSERT (BmmData->COMDataRate[Index] < (ARRAY_SIZE (DataBitsList)));
     NewTerminalContext->DataBits      = (UINT8) DataBitsList[BmmData->COMDataRate[Index]].Value;
     NewTerminalContext->StopBitsIndex = BmmData->COMStopBits[Index];
-    ASSERT (BmmData->COMStopBits[Index] < (sizeof (StopBitsList) / sizeof (StopBitsList[0])));
+    ASSERT (BmmData->COMStopBits[Index] < (ARRAY_SIZE (StopBitsList)));
     NewTerminalContext->StopBits      = (UINT8) StopBitsList[BmmData->COMStopBits[Index]].Value;
     NewTerminalContext->ParityIndex   = BmmData->COMParity[Index];
-    ASSERT (BmmData->COMParity[Index] < (sizeof (ParityList) / sizeof (ParityList[0])));
+    ASSERT (BmmData->COMParity[Index] < (ARRAY_SIZE (ParityList)));
     NewTerminalContext->Parity        = (UINT8) ParityList[BmmData->COMParity[Index]].Value;
     NewTerminalContext->TerminalType  = BmmData->COMTerminalType[Index];
     NewTerminalContext->FlowControl   = BmmData->COMFlowControl[Index];
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c
index fd48d5d4cdb0..a145a77c70a1 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c
@@ -567,7 +567,7 @@ LocateSerialIo (
     Vendor.Header.Type                = MESSAGING_DEVICE_PATH;
     Vendor.Header.SubType             = MSG_VENDOR_DP;
 
-    for (Index2 = 0; Index2 < (sizeof (TerminalTypeGuid) / sizeof (TerminalTypeGuid[0])); Index2++) {
+    for (Index2 = 0; Index2 < (ARRAY_SIZE (TerminalTypeGuid)); Index2++) {
       CopyMem (&Vendor.Guid, &TerminalTypeGuid[Index2], sizeof (EFI_GUID));
       SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));
       NewDevicePath = AppendDevicePathNode (
@@ -1131,21 +1131,21 @@ GetTerminalAttribute (
         break;
       }
     }
-    for (AttributeIndex = 0; AttributeIndex < sizeof (DataBitsList) / sizeof (DataBitsList[0]); AttributeIndex++) {
+    for (AttributeIndex = 0; AttributeIndex < ARRAY_SIZE (DataBitsList); AttributeIndex++) {
       if (NewTerminalContext->DataBits == (UINT64) (DataBitsList[AttributeIndex].Value)) {
         NewTerminalContext->DataBitsIndex = AttributeIndex;
         break;
       }
     }    
 
-    for (AttributeIndex = 0; AttributeIndex < sizeof (ParityList) / sizeof (ParityList[0]); AttributeIndex++) {
+    for (AttributeIndex = 0; AttributeIndex < ARRAY_SIZE (ParityList); AttributeIndex++) {
       if (NewTerminalContext->Parity == (UINT64) (ParityList[AttributeIndex].Value)) {
         NewTerminalContext->ParityIndex = AttributeIndex;
         break;
       }
     }
 
-    for (AttributeIndex = 0; AttributeIndex < sizeof (StopBitsList) / sizeof (StopBitsList[0]); AttributeIndex++) {
+    for (AttributeIndex = 0; AttributeIndex < ARRAY_SIZE (StopBitsList); AttributeIndex++) {
       if (NewTerminalContext->StopBits == (UINT64) (StopBitsList[AttributeIndex].Value)) {
         NewTerminalContext->StopBitsIndex = AttributeIndex;
         break;
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c
index 8194979477ba..dede4b392f15 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c
@@ -736,7 +736,7 @@ UpdateConModePage (
     //
     UnicodeValueToString (ModeString, 0, Col, 0);
     PStr = &ModeString[0];
-    StrnCatS (PStr, sizeof (ModeString) / sizeof (ModeString[0]), L" x ", StrLen(L" x ") + 1);
+    StrnCatS (PStr, ARRAY_SIZE (ModeString), L" x ", StrLen(L" x ") + 1);
     PStr = PStr + StrLen (PStr);
     UnicodeValueToString (PStr , 0, Row, 0);
 
@@ -847,7 +847,7 @@ UpdateTerminalPage (
   OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
   ASSERT (OptionsOpCodeHandle != NULL);
 
-  for (Index = 0; Index < sizeof (DataBitsList) / sizeof (DataBitsList[0]); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (DataBitsList); Index++) {
     CheckFlags = 0;
 
     if (DataBitsList[Index].Value == 8) {
@@ -880,7 +880,7 @@ UpdateTerminalPage (
   OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
   ASSERT (OptionsOpCodeHandle != NULL);
 
-  for (Index = 0; Index < sizeof (ParityList) / sizeof (ParityList[0]); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (ParityList); Index++) {
     CheckFlags = 0;
     if (ParityList[Index].Value ==  NoParity) {
       CheckFlags |= EFI_IFR_OPTION_DEFAULT;
@@ -912,7 +912,7 @@ UpdateTerminalPage (
   OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
   ASSERT (OptionsOpCodeHandle != NULL);
 
-  for (Index = 0; Index < sizeof (StopBitsList) / sizeof (StopBitsList[0]); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (StopBitsList); Index++) {
     CheckFlags = 0;
     if (StopBitsList[Index].Value == OneStopBit) {
       CheckFlags |= EFI_IFR_OPTION_DEFAULT;
@@ -944,7 +944,7 @@ UpdateTerminalPage (
   OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
   ASSERT (OptionsOpCodeHandle != NULL);
 
-  for (Index = 0; Index < sizeof (TerminalType) / sizeof (TerminalType[0]); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (TerminalType); Index++) {
     CheckFlags = 0;
     if (Index == 0) {
       CheckFlags |= EFI_IFR_OPTION_DEFAULT;
@@ -976,7 +976,7 @@ UpdateTerminalPage (
   OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
   ASSERT (OptionsOpCodeHandle != NULL);
 
-  for (Index = 0; Index < sizeof (mFlowControlType) / sizeof (mFlowControlType[0]); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (mFlowControlType); Index++) {
   CheckFlags = 0;
     if (Index == 0) {
       CheckFlags |= EFI_IFR_OPTION_DEFAULT;
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c
index a2ae2a773666..746b2335edc5 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c
@@ -371,7 +371,7 @@ Var_UpdateConsoleOption (
       Vendor.Header.Type    = MESSAGING_DEVICE_PATH;
       Vendor.Header.SubType = MSG_VENDOR_DP;
       
-      ASSERT (NewTerminalContext->TerminalType < (sizeof (TerminalTypeGuid) / sizeof (TerminalTypeGuid[0])));
+      ASSERT (NewTerminalContext->TerminalType < (ARRAY_SIZE (TerminalTypeGuid)));
       CopyMem (
         &Vendor.Guid,
         &TerminalTypeGuid[NewTerminalContext->TerminalType],
-- 
2.9.2




  parent reply	other threads:[~2016-10-26 19:05 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26 19:04 [PATCH 00/47] edk2: centralize and adopt ARRAY_SIZE() Laszlo Ersek
2016-10-26 19:04 ` [PATCH 01/47] MdeModulePkg/RegularExpressionDxe: guard the definition of ARRAY_SIZE Laszlo Ersek
2016-10-26 19:04 ` [PATCH 02/47] NetworkPkg/IpsecConfig: " Laszlo Ersek
2016-10-27  1:59   ` Fu, Siyuan
2016-10-27  2:30   ` Wu, Jiaxin
2016-10-26 19:04 ` [PATCH 03/47] OvmfPkg/PlatformBootManagerLib: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 04/47] OvmfPkg/XenBusDxe: " Laszlo Ersek
2016-10-27  3:15   ` Gary Lin
2016-10-26 19:04 ` [PATCH 05/47] MdePkg/Include/Base.h: introduce the ARRAY_SIZE() function-like macro Laszlo Ersek
2016-10-26 22:13   ` Kinney, Michael D
2016-10-26 22:25     ` Laszlo Ersek
2016-10-27  2:21       ` Kinney, Michael D
2016-10-26 19:04 ` [PATCH 06/47] MdeModulePkg/RegularExpressionDxe: remove module-local ARRAY_SIZE macro Laszlo Ersek
2016-10-26 19:04 ` [PATCH 07/47] NetworkPkg/IpsecConfig: " Laszlo Ersek
2016-10-27  1:59   ` Fu, Siyuan
2016-10-27  2:31   ` Wu, Jiaxin
2016-10-26 19:04 ` [PATCH 08/47] OvmfPkg/PlatformBootManagerLib: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 09/47] OvmfPkg/XenBusDxe: " Laszlo Ersek
2016-10-27  3:16   ` Gary Lin
2016-10-26 19:04 ` [PATCH 10/47] ArmVirtPkg/NorFlashQemuLib: rebase to ARRAY_SIZE() Laszlo Ersek
2016-10-27  7:30   ` Ard Biesheuvel
2016-10-26 19:04 ` [PATCH 11/47] DuetPkg/DuetBdsLib: " Laszlo Ersek
2016-10-27  8:16   ` Laszlo Ersek
2016-10-27  9:04     ` Ni, Ruiyu
2016-10-27  9:12       ` Laszlo Ersek
2016-10-26 19:04 ` [PATCH 12/47] EdkCompatibilityPkg/FrameworkHiiOnUefiHiiThunk: " Laszlo Ersek
2016-10-27  1:20   ` Gao, Liming
2016-10-26 19:04 ` [PATCH 13/47] EdkCompatibilityPkg/Sample/Tools: " Laszlo Ersek
2016-10-27  1:20   ` Gao, Liming
2016-10-26 19:04 ` [PATCH 14/47] FatPkg/EnhancedFatDxe: " Laszlo Ersek
2016-10-27  1:53   ` Ni, Ruiyu
2016-10-26 19:04 ` [PATCH 15/47] IntelFrameworkModulePkg/LegacyBootManagerLib: " Laszlo Ersek
2016-10-27  3:09   ` Fan, Jeff
2016-10-26 19:04 ` [PATCH 16/47] IntelFrameworkModulePkg/BdsDxe: " Laszlo Ersek
2016-10-27  3:12   ` Fan, Jeff
2016-10-26 19:04 ` [PATCH 17/47] MdeModulePkg/MemoryProfileInfo: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 18/47] MdeModulePkg/PciBusDxe: " Laszlo Ersek
2016-10-27  1:53   ` Ni, Ruiyu
2016-10-26 19:04 ` [PATCH 19/47] MdeModulePkg/PciHostBridgeDxe: " Laszlo Ersek
2016-10-27  1:49   ` Ni, Ruiyu
2016-10-26 19:04 ` [PATCH 20/47] MdeModulePkg/UsbBusDxe: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 21/47] MdeModulePkg/Core/Dxe: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 22/47] MdeModulePkg/Core/PiSmmCore: " Laszlo Ersek
2016-10-27  2:20   ` Kinney, Michael D
2016-10-26 19:04 ` Laszlo Ersek [this message]
2016-10-26 19:04 ` [PATCH 24/47] MdeModulePkg/BootManagerUiLib: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 25/47] MdeModulePkg/UefiBootManagerLib: " Laszlo Ersek
2016-10-27  1:50   ` Ni, Ruiyu
2016-10-26 19:04 ` [PATCH 26/47] MdeModulePkg/VarCheckHiiLib: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 27/47] MdeModulePkg/Logo: " Laszlo Ersek
2016-10-27  1:53   ` Ni, Ruiyu
2016-10-26 19:04 ` [PATCH 28/47] MdeModulePkg/BdsDxe: " Laszlo Ersek
2016-10-27  1:50   ` Ni, Ruiyu
2016-10-27  1:50   ` Ni, Ruiyu
2016-10-26 19:04 ` [PATCH 29/47] MdeModulePkg/DisplayEngineDxe: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 30/47] MdeModulePkg/EbcDxe: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 31/47] MdeModulePkg/Tcp4Dxe: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 32/47] MdeModulePkg/Variable/RuntimeDxe: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 33/47] NetworkPkg/IScsiDxe: " Laszlo Ersek
2016-10-27  1:59   ` Fu, Siyuan
2016-10-26 19:04 ` [PATCH 34/47] NetworkPkg/TcpDxe: " Laszlo Ersek
2016-10-27  2:00   ` Fu, Siyuan
2016-10-27  2:31   ` Wu, Jiaxin
2016-10-26 19:04 ` [PATCH 35/47] Nt32Pkg/WinNtSerialIoDxe: " Laszlo Ersek
2016-10-27  1:49   ` Ni, Ruiyu
2016-10-26 19:04 ` [PATCH 36/47] OptionRomPkg/AtapiPassThruDxe: " Laszlo Ersek
2016-10-27  1:47   ` Ni, Ruiyu
2016-10-26 19:04 ` [PATCH 37/47] OvmfPkg/QemuBootOrderLib: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 38/47] OvmfPkg/QemuVideoDxe: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 39/47] PerformancePkg/Dp_App: " Laszlo Ersek
2016-10-26 19:04 ` [PATCH 40/47] SecurityPkg/AuthVariableLib: " Laszlo Ersek
2016-10-27  9:07   ` Laszlo Ersek
2016-10-27  9:09     ` Zeng, Star
2016-10-27  9:12       ` Laszlo Ersek
2016-10-28  8:36     ` Zhang, Chao B
2016-10-28 10:20       ` Laszlo Ersek
2016-10-26 19:04 ` [PATCH 41/47] ShellPkg/UefiDpLib: " Laszlo Ersek
2016-10-27  1:47   ` Ni, Ruiyu
2016-10-26 19:04 ` [PATCH 42/47] ShellPkg/UefiShellLevel2CommandsLib: " Laszlo Ersek
2016-10-27  1:47   ` Ni, Ruiyu
2016-10-26 19:05 ` [PATCH 43/47] Vlv2TbltDevicePkg/FirmwareUpdate: " Laszlo Ersek
2016-10-27  7:08   ` Guo, Mang
2016-10-26 19:05 ` [PATCH 44/47] Vlv2TbltDevicePkg/PlatformInitPei: " Laszlo Ersek
2016-10-27  7:10   ` Guo, Mang
2016-10-26 19:05 ` [PATCH 45/47] Vlv2TbltDevicePkg/PlatformPei: " Laszlo Ersek
2016-10-27  7:12   ` Guo, Mang
2016-10-26 19:05 ` [PATCH 46/47] Vlv2TbltDevicePkg/PlatformSetupDxe: " Laszlo Ersek
2016-10-27  7:14   ` Guo, Mang
2016-10-26 19:05 ` [PATCH 47/47] Vlv2TbltDevicePkg/SmBiosMiscDxe: " Laszlo Ersek
2016-10-27  7:14   ` Guo, Mang
2016-10-26 21:48 ` [PATCH 00/47] edk2: centralize and adopt ARRAY_SIZE() Carsey, Jaben
2016-10-27  1:17 ` Tian, Feng
2016-10-27  2:37   ` Zeng, Star
2016-10-27  4:43 ` Gary Lin
2016-10-27  7:52   ` Laszlo Ersek
2016-10-27  6:05 ` Jordan Justen
2016-10-27  8:49   ` Laszlo Ersek
2016-10-27  9:27 ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161026190504.9888-24-lersek@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox