From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D3BD91A1EF4 for ; Wed, 26 Oct 2016 12:05:41 -0700 (PDT) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E16580516; Wed, 26 Oct 2016 19:05:41 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-27.phx2.redhat.com [10.3.116.27]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9QJ57xq025834; Wed, 26 Oct 2016 15:05:40 -0400 From: Laszlo Ersek To: edk2-devel-01 Cc: Jeff Fan Date: Wed, 26 Oct 2016 21:04:33 +0200 Message-Id: <20161026190504.9888-17-lersek@redhat.com> In-Reply-To: <20161026190504.9888-1-lersek@redhat.com> References: <20161026190504.9888-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 26 Oct 2016 19:05:41 +0000 (UTC) Subject: [PATCH 16/47] IntelFrameworkModulePkg/BdsDxe: rebase to ARRAY_SIZE() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Oct 2016 19:05:42 -0000 Cc: Jeff Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c | 2 +- IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c | 4 ++-- IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c | 8 ++++---- IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c | 2 +- IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c | 6 +++--- IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c | 10 +++++----- IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c | 2 +- IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c index ae7ad2153c51..bf81de40a31d 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c @@ -581,7 +581,7 @@ BdsEntry ( Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock); DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", Status)); if (!EFI_ERROR (Status)) { - for (Index = 0; Index < sizeof (mReadOnlyVariables) / sizeof (mReadOnlyVariables[0]); Index++) { + for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) { Status = VariableLock->RequestToLock (VariableLock, mReadOnlyVariables[Index], &gEfiGlobalVariableGuid); ASSERT_EFI_ERROR (Status); } diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c index 6a0b525f1581..2ef9cf13ebb8 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c @@ -206,7 +206,7 @@ GroupMultipleLegacyBootOption4SameType ( // // Legacy Boot Option // - ASSERT ((((BBS_BBS_DEVICE_PATH *) BootOption->DevicePath)->DeviceType & 0xF) < sizeof (DeviceTypeIndex) / sizeof (DeviceTypeIndex[0])); + ASSERT ((((BBS_BBS_DEVICE_PATH *) BootOption->DevicePath)->DeviceType & 0xF) < ARRAY_SIZE (DeviceTypeIndex)); NextIndex = &DeviceTypeIndex[((BBS_BBS_DEVICE_PATH *) BootOption->DevicePath)->DeviceType & 0xF]; if (*NextIndex == (UINTN) -1) { @@ -225,7 +225,7 @@ GroupMultipleLegacyBootOption4SameType ( // // Update the DeviceTypeIndex array to reflect the right shift operation // - for (DeviceIndex = 0; DeviceIndex < sizeof (DeviceTypeIndex) / sizeof (DeviceTypeIndex[0]); DeviceIndex++) { + for (DeviceIndex = 0; DeviceIndex < ARRAY_SIZE (DeviceTypeIndex); DeviceIndex++) { if (DeviceTypeIndex[DeviceIndex] != (UINTN) -1 && DeviceTypeIndex[DeviceIndex] >= *NextIndex) { DeviceTypeIndex[DeviceIndex]++; } diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c index 96f84ece2a9a..d5ea0f457705 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c @@ -520,16 +520,16 @@ BootMaintRouteConfig ( ASSERT (NewMenuEntry != NULL); NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext; NewTerminalContext->BaudRateIndex = NewBmmData->COMBaudRate[Index]; - ASSERT (NewBmmData->COMBaudRate[Index] < (sizeof (BaudRateList) / sizeof (BaudRateList[0]))); + ASSERT (NewBmmData->COMBaudRate[Index] < (ARRAY_SIZE (BaudRateList))); NewTerminalContext->BaudRate = BaudRateList[NewBmmData->COMBaudRate[Index]].Value; NewTerminalContext->DataBitsIndex = NewBmmData->COMDataRate[Index]; - ASSERT (NewBmmData->COMDataRate[Index] < (sizeof (DataBitsList) / sizeof (DataBitsList[0]))); + ASSERT (NewBmmData->COMDataRate[Index] < (ARRAY_SIZE (DataBitsList))); NewTerminalContext->DataBits = (UINT8) DataBitsList[NewBmmData->COMDataRate[Index]].Value; NewTerminalContext->StopBitsIndex = NewBmmData->COMStopBits[Index]; - ASSERT (NewBmmData->COMStopBits[Index] < (sizeof (StopBitsList) / sizeof (StopBitsList[0]))); + ASSERT (NewBmmData->COMStopBits[Index] < (ARRAY_SIZE (StopBitsList))); NewTerminalContext->StopBits = (UINT8) StopBitsList[NewBmmData->COMStopBits[Index]].Value; NewTerminalContext->ParityIndex = NewBmmData->COMParity[Index]; - ASSERT (NewBmmData->COMParity[Index] < (sizeof (ParityList) / sizeof (ParityList[0]))); + ASSERT (NewBmmData->COMParity[Index] < (ARRAY_SIZE (ParityList))); NewTerminalContext->Parity = (UINT8) ParityList[NewBmmData->COMParity[Index]].Value; NewTerminalContext->TerminalType = NewBmmData->COMTerminalType[Index]; NewTerminalContext->FlowControl = NewBmmData->COMFlowControl[Index]; diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c index 56bcfab23f43..5898fb31bb2b 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c @@ -1702,7 +1702,7 @@ GetLegacyDeviceOrder ( LegacyOrder = NULL; OldData = NULL; DisMap = ZeroMem (CallbackData->BmmFakeNvData.DisableMap, sizeof (CallbackData->BmmFakeNvData.DisableMap)); - PageNum = sizeof (PageIdList) / sizeof (PageIdList[0]); + PageNum = ARRAY_SIZE (PageIdList); VarData = BdsLibGetVariableAndSize ( VAR_LEGACY_DEV_ORDER, &gEfiLegacyDevOrderVariableGuid, diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c index 1854b98c360f..126feeb9ae51 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c @@ -1167,21 +1167,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/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c index b13ed116303b..02efefd2a614 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c @@ -830,7 +830,7 @@ UpdateConModePage ( // UnicodeValueToString (ModeString, 0, Col, 0); PStr = &ModeString[0]; - StrCatS (PStr, sizeof (ModeString) / sizeof (ModeString[0]), L" x "); + StrCatS (PStr, ARRAY_SIZE (ModeString), L" x "); PStr = PStr + StrLen (PStr); UnicodeValueToString (PStr , 0, Row, 0); @@ -939,7 +939,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) { @@ -972,7 +972,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; @@ -1004,7 +1004,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; @@ -1068,7 +1068,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/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c index b933dd9699cb..414367cf2387 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c @@ -448,7 +448,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], diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c index 6efd783ab219..9ee063859ce1 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c @@ -305,7 +305,7 @@ CallBootManager ( HiiHandle, 0, mDeviceTypeStr[ - MIN (DeviceType & 0xF, sizeof (mDeviceTypeStr) / sizeof (mDeviceTypeStr[0]) - 1) + MIN (DeviceType & 0xF, ARRAY_SIZE (mDeviceTypeStr) - 1) ], NULL ); -- 2.9.2