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
//\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
//\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
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
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
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
//\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
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
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
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
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
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
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