Re: [edk2] [PATCH 25/47] MdeModulePkg/UefiBootManagerLib: rebase to ARRAY_SIZE()

2016-10-26 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Regards,
Ray

>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Thursday, October 27, 2016 3:05 AM
>To: edk2-devel-01 
>Cc: Tian, Feng ; Ni, Ruiyu ; Zeng, 
>Star 
>Subject: [PATCH 25/47] MdeModulePkg/UefiBootManagerLib: rebase to ARRAY_SIZE()
>
>Cc: Feng Tian 
>Cc: Ruiyu Ni 
>Cc: Star Zeng 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Laszlo Ersek 
>---
> MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c | 2 +-
> MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c | 2 +-
> MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c  | 2 +-
> MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c  | 4 ++--
> 4 files changed, 5 insertions(+), 5 deletions(-)
>
>diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
>b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
>index f086764f24da..050647d8f186 100644
>--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
>+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
>@@ -632,7 +632,7 @@ BmGetBootDescription (
>   // Firstly get the default boot description
>   //
>   DefaultDescription = NULL;
>-  for (Index = 0; Index < sizeof (mBmBootDescriptionHandlers) / sizeof 
>(mBmBootDescriptionHandlers[0]); Index++) {
>+  for (Index = 0; Index < ARRAY_SIZE (mBmBootDescriptionHandlers); Index++) {
> DefaultDescription = mBmBootDescriptionHandlers[Index] (Handle);
> if (DefaultDescription != NULL) {
>   //
>diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
>b/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
>index a13917bd0844..43895e10f85b 100644
>--- a/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
>+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
>@@ -430,7 +430,7 @@ EfiBootManagerUpdateConsoleVariable (
>   EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;
>   EFI_DEVICE_PATH_PROTOCOL  *TempNewDevicePath;
>
>-  if (ConsoleType >= sizeof (mConVarName) / sizeof (mConVarName[0])) {
>+  if (ConsoleType >= ARRAY_SIZE (mConVarName)) {
> return EFI_INVALID_PARAMETER;
>   }
>
>diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
>b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
>index 55df7e9a5f31..35131a94f61d 100644
>--- a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
>+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
>@@ -680,7 +680,7 @@ BmProcessKeyOption (
>
>   KeyShiftStateCount = 0;
>   BmGenerateKeyShiftState (0, KeyOption, EFI_SHIFT_STATE_VALID, 
> KeyShiftStates, );
>-  ASSERT (KeyShiftStateCount <= sizeof (KeyShiftStates) / sizeof 
>(KeyShiftStates[0]));
>+  ASSERT (KeyShiftStateCount <= ARRAY_SIZE (KeyShiftStates));
>
>   EfiAcquireLock ();
>
>diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
>b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
>index 9af98de0afaf..e638e5fc67e6 100644
>--- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
>+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
>@@ -796,7 +796,7 @@ EfiBootManagerIsValidLoadOptionVariableName (
> return FALSE;
>   }
>
>-  for (Index = 0; Index < sizeof (mBmLoadOptionName) / sizeof 
>(mBmLoadOptionName[0]); Index++) {
>+  for (Index = 0; Index < ARRAY_SIZE (mBmLoadOptionName); Index++) {
> if ((VariableNameLen - 4 == StrLen (mBmLoadOptionName[Index])) &&
> (StrnCmp (VariableName, mBmLoadOptionName[Index], VariableNameLen - 
> 4) == 0)
> ) {
>@@ -804,7 +804,7 @@ EfiBootManagerIsValidLoadOptionVariableName (
> }
>   }
>
>-  if (Index == sizeof (mBmLoadOptionName) / sizeof (mBmLoadOptionName[0])) {
>+  if (Index == ARRAY_SIZE (mBmLoadOptionName)) {
> return FALSE;
>   }
>
>--
>2.9.2
>

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 25/47] MdeModulePkg/UefiBootManagerLib: rebase to ARRAY_SIZE()

2016-10-26 Thread Laszlo Ersek
Cc: Feng Tian 
Cc: Ruiyu Ni 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c | 2 +-
 MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c | 2 +-
 MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c  | 2 +-
 MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c  | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
index f086764f24da..050647d8f186 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
@@ -632,7 +632,7 @@ BmGetBootDescription (
   // Firstly get the default boot description
   //
   DefaultDescription = NULL;
-  for (Index = 0; Index < sizeof (mBmBootDescriptionHandlers) / sizeof 
(mBmBootDescriptionHandlers[0]); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (mBmBootDescriptionHandlers); Index++) {
 DefaultDescription = mBmBootDescriptionHandlers[Index] (Handle);
 if (DefaultDescription != NULL) {
   //
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
index a13917bd0844..43895e10f85b 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c
@@ -430,7 +430,7 @@ EfiBootManagerUpdateConsoleVariable (
   EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;
   EFI_DEVICE_PATH_PROTOCOL  *TempNewDevicePath;
 
-  if (ConsoleType >= sizeof (mConVarName) / sizeof (mConVarName[0])) {
+  if (ConsoleType >= ARRAY_SIZE (mConVarName)) {
 return EFI_INVALID_PARAMETER;
   }
 
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
index 55df7e9a5f31..35131a94f61d 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c
@@ -680,7 +680,7 @@ BmProcessKeyOption (
 
   KeyShiftStateCount = 0;
   BmGenerateKeyShiftState (0, KeyOption, EFI_SHIFT_STATE_VALID, 
KeyShiftStates, );
-  ASSERT (KeyShiftStateCount <= sizeof (KeyShiftStates) / sizeof 
(KeyShiftStates[0]));
+  ASSERT (KeyShiftStateCount <= ARRAY_SIZE (KeyShiftStates));
 
   EfiAcquireLock ();
 
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
index 9af98de0afaf..e638e5fc67e6 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
@@ -796,7 +796,7 @@ EfiBootManagerIsValidLoadOptionVariableName (
 return FALSE;
   }
 
-  for (Index = 0; Index < sizeof (mBmLoadOptionName) / sizeof 
(mBmLoadOptionName[0]); Index++) {
+  for (Index = 0; Index < ARRAY_SIZE (mBmLoadOptionName); Index++) {
 if ((VariableNameLen - 4 == StrLen (mBmLoadOptionName[Index])) &&
 (StrnCmp (VariableName, mBmLoadOptionName[Index], VariableNameLen - 4) 
== 0)
 ) {
@@ -804,7 +804,7 @@ EfiBootManagerIsValidLoadOptionVariableName (
 }
   }
 
-  if (Index == sizeof (mBmLoadOptionName) / sizeof (mBmLoadOptionName[0])) {
+  if (Index == ARRAY_SIZE (mBmLoadOptionName)) {
 return FALSE;
   }
 
-- 
2.9.2


___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel