mirror of https://github.com/acidanthera/audk.git
IntelFrameworkModulePkg/BdsDxe: rebase to ARRAY_SIZE()
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>
This commit is contained in:
parent
80901a247f
commit
bdb898a50c
|
@ -581,7 +581,7 @@ BdsEntry (
|
||||||
Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);
|
Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);
|
||||||
DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", Status));
|
DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", Status));
|
||||||
if (!EFI_ERROR (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);
|
Status = VariableLock->RequestToLock (VariableLock, mReadOnlyVariables[Index], &gEfiGlobalVariableGuid);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ GroupMultipleLegacyBootOption4SameType (
|
||||||
//
|
//
|
||||||
// Legacy Boot Option
|
// 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];
|
NextIndex = &DeviceTypeIndex[((BBS_BBS_DEVICE_PATH *) BootOption->DevicePath)->DeviceType & 0xF];
|
||||||
|
|
||||||
if (*NextIndex == (UINTN) -1) {
|
if (*NextIndex == (UINTN) -1) {
|
||||||
|
@ -225,7 +225,7 @@ GroupMultipleLegacyBootOption4SameType (
|
||||||
//
|
//
|
||||||
// Update the DeviceTypeIndex array to reflect the right shift operation
|
// 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) {
|
if (DeviceTypeIndex[DeviceIndex] != (UINTN) -1 && DeviceTypeIndex[DeviceIndex] >= *NextIndex) {
|
||||||
DeviceTypeIndex[DeviceIndex]++;
|
DeviceTypeIndex[DeviceIndex]++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -520,16 +520,16 @@ BootMaintRouteConfig (
|
||||||
ASSERT (NewMenuEntry != NULL);
|
ASSERT (NewMenuEntry != NULL);
|
||||||
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
|
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
|
||||||
NewTerminalContext->BaudRateIndex = NewBmmData->COMBaudRate[Index];
|
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->BaudRate = BaudRateList[NewBmmData->COMBaudRate[Index]].Value;
|
||||||
NewTerminalContext->DataBitsIndex = NewBmmData->COMDataRate[Index];
|
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->DataBits = (UINT8) DataBitsList[NewBmmData->COMDataRate[Index]].Value;
|
||||||
NewTerminalContext->StopBitsIndex = NewBmmData->COMStopBits[Index];
|
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->StopBits = (UINT8) StopBitsList[NewBmmData->COMStopBits[Index]].Value;
|
||||||
NewTerminalContext->ParityIndex = NewBmmData->COMParity[Index];
|
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->Parity = (UINT8) ParityList[NewBmmData->COMParity[Index]].Value;
|
||||||
NewTerminalContext->TerminalType = NewBmmData->COMTerminalType[Index];
|
NewTerminalContext->TerminalType = NewBmmData->COMTerminalType[Index];
|
||||||
NewTerminalContext->FlowControl = NewBmmData->COMFlowControl[Index];
|
NewTerminalContext->FlowControl = NewBmmData->COMFlowControl[Index];
|
||||||
|
|
|
@ -1702,7 +1702,7 @@ GetLegacyDeviceOrder (
|
||||||
LegacyOrder = NULL;
|
LegacyOrder = NULL;
|
||||||
OldData = NULL;
|
OldData = NULL;
|
||||||
DisMap = ZeroMem (CallbackData->BmmFakeNvData.DisableMap, sizeof (CallbackData->BmmFakeNvData.DisableMap));
|
DisMap = ZeroMem (CallbackData->BmmFakeNvData.DisableMap, sizeof (CallbackData->BmmFakeNvData.DisableMap));
|
||||||
PageNum = sizeof (PageIdList) / sizeof (PageIdList[0]);
|
PageNum = ARRAY_SIZE (PageIdList);
|
||||||
VarData = BdsLibGetVariableAndSize (
|
VarData = BdsLibGetVariableAndSize (
|
||||||
VAR_LEGACY_DEV_ORDER,
|
VAR_LEGACY_DEV_ORDER,
|
||||||
&gEfiLegacyDevOrderVariableGuid,
|
&gEfiLegacyDevOrderVariableGuid,
|
||||||
|
|
|
@ -1167,21 +1167,21 @@ GetTerminalAttribute (
|
||||||
break;
|
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)) {
|
if (NewTerminalContext->DataBits == (UINT64) (DataBitsList[AttributeIndex].Value)) {
|
||||||
NewTerminalContext->DataBitsIndex = AttributeIndex;
|
NewTerminalContext->DataBitsIndex = AttributeIndex;
|
||||||
break;
|
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)) {
|
if (NewTerminalContext->Parity == (UINT64) (ParityList[AttributeIndex].Value)) {
|
||||||
NewTerminalContext->ParityIndex = AttributeIndex;
|
NewTerminalContext->ParityIndex = AttributeIndex;
|
||||||
break;
|
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)) {
|
if (NewTerminalContext->StopBits == (UINT64) (StopBitsList[AttributeIndex].Value)) {
|
||||||
NewTerminalContext->StopBitsIndex = AttributeIndex;
|
NewTerminalContext->StopBitsIndex = AttributeIndex;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -830,7 +830,7 @@ UpdateConModePage (
|
||||||
//
|
//
|
||||||
UnicodeValueToString (ModeString, 0, Col, 0);
|
UnicodeValueToString (ModeString, 0, Col, 0);
|
||||||
PStr = &ModeString[0];
|
PStr = &ModeString[0];
|
||||||
StrCatS (PStr, sizeof (ModeString) / sizeof (ModeString[0]), L" x ");
|
StrCatS (PStr, ARRAY_SIZE (ModeString), L" x ");
|
||||||
PStr = PStr + StrLen (PStr);
|
PStr = PStr + StrLen (PStr);
|
||||||
UnicodeValueToString (PStr , 0, Row, 0);
|
UnicodeValueToString (PStr , 0, Row, 0);
|
||||||
|
|
||||||
|
@ -939,7 +939,7 @@ UpdateTerminalPage (
|
||||||
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
|
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
|
||||||
ASSERT (OptionsOpCodeHandle != NULL);
|
ASSERT (OptionsOpCodeHandle != NULL);
|
||||||
|
|
||||||
for (Index = 0; Index < sizeof (DataBitsList) / sizeof (DataBitsList[0]); Index++) {
|
for (Index = 0; Index < ARRAY_SIZE (DataBitsList); Index++) {
|
||||||
CheckFlags = 0;
|
CheckFlags = 0;
|
||||||
|
|
||||||
if (DataBitsList[Index].Value == 8) {
|
if (DataBitsList[Index].Value == 8) {
|
||||||
|
@ -972,7 +972,7 @@ UpdateTerminalPage (
|
||||||
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
|
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
|
||||||
ASSERT (OptionsOpCodeHandle != NULL);
|
ASSERT (OptionsOpCodeHandle != NULL);
|
||||||
|
|
||||||
for (Index = 0; Index < sizeof (ParityList) / sizeof (ParityList[0]); Index++) {
|
for (Index = 0; Index < ARRAY_SIZE (ParityList); Index++) {
|
||||||
CheckFlags = 0;
|
CheckFlags = 0;
|
||||||
if (ParityList[Index].Value == NoParity) {
|
if (ParityList[Index].Value == NoParity) {
|
||||||
CheckFlags |= EFI_IFR_OPTION_DEFAULT;
|
CheckFlags |= EFI_IFR_OPTION_DEFAULT;
|
||||||
|
@ -1004,7 +1004,7 @@ UpdateTerminalPage (
|
||||||
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
|
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
|
||||||
ASSERT (OptionsOpCodeHandle != NULL);
|
ASSERT (OptionsOpCodeHandle != NULL);
|
||||||
|
|
||||||
for (Index = 0; Index < sizeof (StopBitsList) / sizeof (StopBitsList[0]); Index++) {
|
for (Index = 0; Index < ARRAY_SIZE (StopBitsList); Index++) {
|
||||||
CheckFlags = 0;
|
CheckFlags = 0;
|
||||||
if (StopBitsList[Index].Value == OneStopBit) {
|
if (StopBitsList[Index].Value == OneStopBit) {
|
||||||
CheckFlags |= EFI_IFR_OPTION_DEFAULT;
|
CheckFlags |= EFI_IFR_OPTION_DEFAULT;
|
||||||
|
@ -1068,7 +1068,7 @@ UpdateTerminalPage (
|
||||||
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
|
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
|
||||||
ASSERT (OptionsOpCodeHandle != NULL);
|
ASSERT (OptionsOpCodeHandle != NULL);
|
||||||
|
|
||||||
for (Index = 0; Index < sizeof (mFlowControlType) / sizeof (mFlowControlType[0]); Index++) {
|
for (Index = 0; Index < ARRAY_SIZE (mFlowControlType); Index++) {
|
||||||
CheckFlags = 0;
|
CheckFlags = 0;
|
||||||
if (Index == 0) {
|
if (Index == 0) {
|
||||||
CheckFlags |= EFI_IFR_OPTION_DEFAULT;
|
CheckFlags |= EFI_IFR_OPTION_DEFAULT;
|
||||||
|
|
|
@ -448,7 +448,7 @@ Var_UpdateConsoleOption (
|
||||||
Vendor.Header.Type = MESSAGING_DEVICE_PATH;
|
Vendor.Header.Type = MESSAGING_DEVICE_PATH;
|
||||||
Vendor.Header.SubType = MSG_VENDOR_DP;
|
Vendor.Header.SubType = MSG_VENDOR_DP;
|
||||||
|
|
||||||
ASSERT (NewTerminalContext->TerminalType < (sizeof (TerminalTypeGuid) / sizeof (TerminalTypeGuid[0])));
|
ASSERT (NewTerminalContext->TerminalType < (ARRAY_SIZE (TerminalTypeGuid)));
|
||||||
CopyMem (
|
CopyMem (
|
||||||
&Vendor.Guid,
|
&Vendor.Guid,
|
||||||
&TerminalTypeGuid[NewTerminalContext->TerminalType],
|
&TerminalTypeGuid[NewTerminalContext->TerminalType],
|
||||||
|
|
|
@ -305,7 +305,7 @@ CallBootManager (
|
||||||
HiiHandle,
|
HiiHandle,
|
||||||
0,
|
0,
|
||||||
mDeviceTypeStr[
|
mDeviceTypeStr[
|
||||||
MIN (DeviceType & 0xF, sizeof (mDeviceTypeStr) / sizeof (mDeviceTypeStr[0]) - 1)
|
MIN (DeviceType & 0xF, ARRAY_SIZE (mDeviceTypeStr) - 1)
|
||||||
],
|
],
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue