]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFrameworkModulePkg/BdsDxe: rebase to ARRAY_SIZE()
authorLaszlo Ersek <lersek@redhat.com>
Wed, 26 Oct 2016 16:38:12 +0000 (18:38 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Thu, 27 Oct 2016 09:10:55 +0000 (11:10 +0200)
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c

index ae7ad2153c51b5d663992648db0b3e9ad5e0b7ed..bf81de40a31da058b1b0d033357f583025c8bc21 100644 (file)
@@ -581,7 +581,7 @@ BdsEntry (
   Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);\r
   DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", Status));\r
   if (!EFI_ERROR (Status)) {\r
-    for (Index = 0; Index < sizeof (mReadOnlyVariables) / sizeof (mReadOnlyVariables[0]); Index++) {\r
+    for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) {\r
       Status = VariableLock->RequestToLock (VariableLock, mReadOnlyVariables[Index], &gEfiGlobalVariableGuid);\r
       ASSERT_EFI_ERROR (Status);\r
     }\r
index 6a0b525f1581eafd6e8923929b4767413e6e0e72..2ef9cf13ebb8c9cf0a56a49bd8331f4bb83482af 100644 (file)
@@ -206,7 +206,7 @@ GroupMultipleLegacyBootOption4SameType (
       //\r
       // Legacy Boot Option\r
       //\r
-      ASSERT ((((BBS_BBS_DEVICE_PATH *) BootOption->DevicePath)->DeviceType & 0xF) < sizeof (DeviceTypeIndex) / sizeof (DeviceTypeIndex[0]));\r
+      ASSERT ((((BBS_BBS_DEVICE_PATH *) BootOption->DevicePath)->DeviceType & 0xF) < ARRAY_SIZE (DeviceTypeIndex));\r
       NextIndex = &DeviceTypeIndex[((BBS_BBS_DEVICE_PATH *) BootOption->DevicePath)->DeviceType & 0xF];\r
 \r
       if (*NextIndex == (UINTN) -1) {\r
@@ -225,7 +225,7 @@ GroupMultipleLegacyBootOption4SameType (
         //\r
         // Update the DeviceTypeIndex array to reflect the right shift operation\r
         //\r
-        for (DeviceIndex = 0; DeviceIndex < sizeof (DeviceTypeIndex) / sizeof (DeviceTypeIndex[0]); DeviceIndex++) {\r
+        for (DeviceIndex = 0; DeviceIndex < ARRAY_SIZE (DeviceTypeIndex); DeviceIndex++) {\r
           if (DeviceTypeIndex[DeviceIndex] != (UINTN) -1 && DeviceTypeIndex[DeviceIndex] >= *NextIndex) {\r
             DeviceTypeIndex[DeviceIndex]++;\r
           }\r
index 96f84ece2a9a1981575423c73fe5bdd9311e0f1c..d5ea0f45770556c1f854412985055f9e39d489e6 100644 (file)
@@ -520,16 +520,16 @@ BootMaintRouteConfig (
     ASSERT (NewMenuEntry != NULL);\r
     NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;\r
     NewTerminalContext->BaudRateIndex = NewBmmData->COMBaudRate[Index];\r
-    ASSERT (NewBmmData->COMBaudRate[Index] < (sizeof (BaudRateList) / sizeof (BaudRateList[0])));\r
+    ASSERT (NewBmmData->COMBaudRate[Index] < (ARRAY_SIZE (BaudRateList)));\r
     NewTerminalContext->BaudRate      = BaudRateList[NewBmmData->COMBaudRate[Index]].Value;\r
     NewTerminalContext->DataBitsIndex = NewBmmData->COMDataRate[Index];\r
-    ASSERT (NewBmmData->COMDataRate[Index] < (sizeof (DataBitsList) / sizeof (DataBitsList[0])));\r
+    ASSERT (NewBmmData->COMDataRate[Index] < (ARRAY_SIZE (DataBitsList)));\r
     NewTerminalContext->DataBits      = (UINT8) DataBitsList[NewBmmData->COMDataRate[Index]].Value;\r
     NewTerminalContext->StopBitsIndex = NewBmmData->COMStopBits[Index];\r
-    ASSERT (NewBmmData->COMStopBits[Index] < (sizeof (StopBitsList) / sizeof (StopBitsList[0])));\r
+    ASSERT (NewBmmData->COMStopBits[Index] < (ARRAY_SIZE (StopBitsList)));\r
     NewTerminalContext->StopBits      = (UINT8) StopBitsList[NewBmmData->COMStopBits[Index]].Value;\r
     NewTerminalContext->ParityIndex   = NewBmmData->COMParity[Index];\r
-    ASSERT (NewBmmData->COMParity[Index] < (sizeof (ParityList) / sizeof (ParityList[0])));\r
+    ASSERT (NewBmmData->COMParity[Index] < (ARRAY_SIZE (ParityList)));\r
     NewTerminalContext->Parity        = (UINT8) ParityList[NewBmmData->COMParity[Index]].Value;\r
     NewTerminalContext->TerminalType  = NewBmmData->COMTerminalType[Index];\r
     NewTerminalContext->FlowControl   = NewBmmData->COMFlowControl[Index];\r
index 56bcfab23f435099a1ae58bcb0ad5a36d3c69f71..5898fb31bb2b71909fd2c5480845878c19b5c2de 100644 (file)
@@ -1702,7 +1702,7 @@ GetLegacyDeviceOrder (
   LegacyOrder = NULL;\r
   OldData     = NULL;\r
   DisMap      = ZeroMem (CallbackData->BmmFakeNvData.DisableMap, sizeof (CallbackData->BmmFakeNvData.DisableMap));\r
-  PageNum     = sizeof (PageIdList) / sizeof (PageIdList[0]);\r
+  PageNum     = ARRAY_SIZE (PageIdList);\r
   VarData     = BdsLibGetVariableAndSize (\r
                   VAR_LEGACY_DEV_ORDER,\r
                   &gEfiLegacyDevOrderVariableGuid,\r
index 1854b98c360fdd45ba00cee2c1c3aa6e5e9e38da..126feeb9ae51dbb2d2264a9017321e3c530a8830 100644 (file)
@@ -1167,21 +1167,21 @@ GetTerminalAttribute (
         break;\r
       }\r
     }\r
-    for (AttributeIndex = 0; AttributeIndex < sizeof (DataBitsList) / sizeof (DataBitsList[0]); AttributeIndex++) {\r
+    for (AttributeIndex = 0; AttributeIndex < ARRAY_SIZE (DataBitsList); AttributeIndex++) {\r
       if (NewTerminalContext->DataBits == (UINT64) (DataBitsList[AttributeIndex].Value)) {\r
         NewTerminalContext->DataBitsIndex = AttributeIndex;\r
         break;\r
       }\r
     }    \r
     \r
-    for (AttributeIndex = 0; AttributeIndex < sizeof (ParityList) / sizeof (ParityList[0]); AttributeIndex++) {\r
+    for (AttributeIndex = 0; AttributeIndex < ARRAY_SIZE (ParityList); AttributeIndex++) {\r
       if (NewTerminalContext->Parity == (UINT64) (ParityList[AttributeIndex].Value)) {\r
         NewTerminalContext->ParityIndex = AttributeIndex;\r
         break;\r
       }\r
     }            \r
     \r
-    for (AttributeIndex = 0; AttributeIndex < sizeof (StopBitsList) / sizeof (StopBitsList[0]); AttributeIndex++) {\r
+    for (AttributeIndex = 0; AttributeIndex < ARRAY_SIZE (StopBitsList); AttributeIndex++) {\r
       if (NewTerminalContext->StopBits == (UINT64) (StopBitsList[AttributeIndex].Value)) {\r
         NewTerminalContext->StopBitsIndex = AttributeIndex;\r
         break;\r
index b13ed116303b0e948da132e062b0b55819f3bd23..02efefd2a61428503b3d2fc291328924cb506a23 100644 (file)
@@ -830,7 +830,7 @@ UpdateConModePage (
     //\r
     UnicodeValueToString (ModeString, 0, Col, 0);\r
     PStr = &ModeString[0];\r
-    StrCatS (PStr, sizeof (ModeString) / sizeof (ModeString[0]), L" x ");\r
+    StrCatS (PStr, ARRAY_SIZE (ModeString), L" x ");\r
     PStr = PStr + StrLen (PStr);\r
     UnicodeValueToString (PStr , 0, Row, 0);\r
 \r
@@ -939,7 +939,7 @@ UpdateTerminalPage (
   OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();\r
   ASSERT (OptionsOpCodeHandle != NULL);\r
 \r
-  for (Index = 0; Index < sizeof (DataBitsList) / sizeof (DataBitsList[0]); Index++) {\r
+  for (Index = 0; Index < ARRAY_SIZE (DataBitsList); Index++) {\r
     CheckFlags = 0;\r
 \r
     if (DataBitsList[Index].Value == 8) {\r
@@ -972,7 +972,7 @@ UpdateTerminalPage (
   OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();\r
   ASSERT (OptionsOpCodeHandle != NULL);\r
 \r
-  for (Index = 0; Index < sizeof (ParityList) / sizeof (ParityList[0]); Index++) {\r
+  for (Index = 0; Index < ARRAY_SIZE (ParityList); Index++) {\r
     CheckFlags = 0;\r
     if (ParityList[Index].Value ==  NoParity) {\r
       CheckFlags |= EFI_IFR_OPTION_DEFAULT;\r
@@ -1004,7 +1004,7 @@ UpdateTerminalPage (
   OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();\r
   ASSERT (OptionsOpCodeHandle != NULL);\r
 \r
-  for (Index = 0; Index < sizeof (StopBitsList) / sizeof (StopBitsList[0]); Index++) {\r
+  for (Index = 0; Index < ARRAY_SIZE (StopBitsList); Index++) {\r
     CheckFlags = 0;\r
     if (StopBitsList[Index].Value == OneStopBit) {\r
       CheckFlags |= EFI_IFR_OPTION_DEFAULT;\r
@@ -1068,7 +1068,7 @@ UpdateTerminalPage (
   OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();\r
   ASSERT (OptionsOpCodeHandle != NULL);\r
 \r
-  for (Index = 0; Index < sizeof (mFlowControlType) / sizeof (mFlowControlType[0]); Index++) {\r
+  for (Index = 0; Index < ARRAY_SIZE (mFlowControlType); Index++) {\r
   CheckFlags = 0;\r
     if (Index == 0) {\r
       CheckFlags |= EFI_IFR_OPTION_DEFAULT;\r
index b933dd9699cb9ec2c2b79b8e08baf62dd5c705e4..414367cf238799f9f75f60b59da491c5d732b144 100644 (file)
@@ -448,7 +448,7 @@ Var_UpdateConsoleOption (
       Vendor.Header.Type    = MESSAGING_DEVICE_PATH;\r
       Vendor.Header.SubType = MSG_VENDOR_DP;\r
       \r
-      ASSERT (NewTerminalContext->TerminalType < (sizeof (TerminalTypeGuid) / sizeof (TerminalTypeGuid[0])));\r
+      ASSERT (NewTerminalContext->TerminalType < (ARRAY_SIZE (TerminalTypeGuid)));\r
       CopyMem (\r
         &Vendor.Guid,\r
         &TerminalTypeGuid[NewTerminalContext->TerminalType],\r
index 6efd783ab21957e5b71c5b1393dcdaa06264416e..9ee063859ce1fe7a6258127ae4c3bd6086d6cb8f 100644 (file)
@@ -305,7 +305,7 @@ CallBootManager (
                      HiiHandle,\r
                      0,\r
                      mDeviceTypeStr[\r
-                       MIN (DeviceType & 0xF, sizeof (mDeviceTypeStr) / sizeof (mDeviceTypeStr[0]) - 1)\r
+                       MIN (DeviceType & 0xF, ARRAY_SIZE (mDeviceTypeStr) - 1)\r
                        ],\r
                      NULL\r
                      );\r