OvmfPkg: Make more use of ARRAY_SIZE()

Convert the remaining pieces to make the code shorter and more readable.

Cc: Justen Jordan <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: tweak subject line]
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Gary Lin
2016-10-27 18:16:15 +08:00
committed by Laszlo Ersek
parent 1399565a93
commit 5a5025e485
4 changed files with 9 additions and 12 deletions

View File

@@ -204,7 +204,7 @@ GopQueryMode (
{
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *GopModeInfo;
if (ModeNumber >= sizeof mGopResolutions / sizeof mGopResolutions[0]) {
if (ModeNumber >= ARRAY_SIZE (mGopResolutions)) {
return EFI_INVALID_PARAMETER;
}
@@ -239,7 +239,7 @@ GopSetMode (
EFI_STATUS Status;
EFI_STATUS Status2;
if (ModeNumber >= sizeof mGopResolutions / sizeof mGopResolutions[0]) {
if (ModeNumber >= ARRAY_SIZE (mGopResolutions)) {
return EFI_UNSUPPORTED;
}
@@ -258,8 +258,7 @@ GopSetMode (
//
VgpuGop->Gop.Mode = &VgpuGop->GopMode;
VgpuGop->GopMode.MaxMode = (UINT32)(sizeof mGopResolutions /
sizeof mGopResolutions[0]);
VgpuGop->GopMode.MaxMode = (UINT32)(ARRAY_SIZE (mGopResolutions));
VgpuGop->GopMode.Info = &VgpuGop->GopModeInfo;
VgpuGop->GopMode.SizeOfInfo = sizeof VgpuGop->GopModeInfo;