From patchwork Wed Oct 26 19:04:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 79508 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp227161qge; Wed, 26 Oct 2016 12:06:27 -0700 (PDT) X-Received: by 10.99.129.200 with SMTP id t191mr5710561pgd.180.1477508787006; Wed, 26 Oct 2016 12:06:27 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id v10si4155401pgc.216.2016.10.26.12.06.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Oct 2016 12:06:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2A6401A1F0B; Wed, 26 Oct 2016 12:05:55 -0700 (PDT) X-Original-To: edk2-devel@ml01.01.org Delivered-To: edk2-devel@ml01.01.org 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 AB0F91A1F0A for ; Wed, 26 Oct 2016 12:05:52 -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 449A18051D; Wed, 26 Oct 2016 19:05:52 +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 u9QJ57xx025834; Wed, 26 Oct 2016 15:05:50 -0400 From: Laszlo Ersek To: edk2-devel-01 Date: Wed, 26 Oct 2016 21:04:40 +0200 Message-Id: <20161026190504.9888-24-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:52 +0000 (UTC) Subject: [edk2] [PATCH 23/47] MdeModulePkg/BootMaintenanceManagerUiLib: 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: , Cc: Dandan Bi , Feng Tian , Eric Dong , Star Zeng MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Cc: Dandan Bi Cc: Eric Dong Cc: Feng Tian Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- 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(-) -- 2.9.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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],