public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ShellPkg SmbiosView: Eliminate trailing " | " in PrintBitsInfo()
@ 2017-02-09  9:22 Star Zeng
  2017-02-09 17:00 ` Carsey, Jaben
  0 siblings, 1 reply; 2+ messages in thread
From: Star Zeng @ 2017-02-09  9:22 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Ruiyu Ni, Jaben Carsey

Current PrintBitsInfo() will always print an additional trailing
" | " for the bit flags, for example,

Base Board Feature Flags: Hosting board |  Replaceable |

Th patch is to eliminate trailing " | " in PrintBitsInfo(), then
the output will be like below

Base Board Feature Flags: Hosting board |  Replaceable

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 .../UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c
index 282ba584c8c9..02d9ab1f57b3 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c
@@ -3449,19 +3449,24 @@ PrintBitsInfo (
 
   UINTN   Index;
   UINT32  Value;
-  BOOLEAN NoInfo;
+  BOOLEAN FirstInfo;
 
-  NoInfo  = TRUE;
+  FirstInfo = TRUE;
   Value   = Bits;
   //
   // query the table and print information
   //
   for (Index = 0; Index < Number; Index++) {
     if (BIT (Value, Table[Index].Key) != 0) {
+      if (!FirstInfo) {
+        //
+        // If it is not first info, print the separator first.
+        //
+        Print (L" | ");
+      }
       Print (Table[Index].Info);
-      Print (L" | ");
 
-      NoInfo = FALSE;
+      FirstInfo = FALSE;
       //
       // clear the bit, for reserved bits test
       //
@@ -3469,7 +3474,10 @@ PrintBitsInfo (
     }
   }
 
-  if (NoInfo) {
+  //
+  // There is no any info if FirstInfo is still TRUE.
+  //
+  if (FirstInfo) {
     ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_NO_INFO), gShellDebug1HiiHandle);
   }
 
-- 
2.7.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ShellPkg SmbiosView: Eliminate trailing " | " in PrintBitsInfo()
  2017-02-09  9:22 [PATCH] ShellPkg SmbiosView: Eliminate trailing " | " in PrintBitsInfo() Star Zeng
@ 2017-02-09 17:00 ` Carsey, Jaben
  0 siblings, 0 replies; 2+ messages in thread
From: Carsey, Jaben @ 2017-02-09 17:00 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu, Zeng, Star, Carsey, Jaben

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Star Zeng
> Sent: Thursday, February 09, 2017 1:23 AM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben
> <jaben.carsey@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: [edk2] [PATCH] ShellPkg SmbiosView: Eliminate trailing " | " in
> PrintBitsInfo()
> Importance: High
> 
> Current PrintBitsInfo() will always print an additional trailing
> " | " for the bit flags, for example,
> 
> Base Board Feature Flags: Hosting board |  Replaceable |
> 
> Th patch is to eliminate trailing " | " in PrintBitsInfo(), then
> the output will be like below
> 
> Base Board Feature Flags: Hosting board |  Replaceable
> 
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  .../UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c | 18
> +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.
> c
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.
> c
> index 282ba584c8c9..02d9ab1f57b3 100644
> ---
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.
> c
> +++
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.
> c
> @@ -3449,19 +3449,24 @@ PrintBitsInfo (
> 
>    UINTN   Index;
>    UINT32  Value;
> -  BOOLEAN NoInfo;
> +  BOOLEAN FirstInfo;
> 
> -  NoInfo  = TRUE;
> +  FirstInfo = TRUE;
>    Value   = Bits;
>    //
>    // query the table and print information
>    //
>    for (Index = 0; Index < Number; Index++) {
>      if (BIT (Value, Table[Index].Key) != 0) {
> +      if (!FirstInfo) {
> +        //
> +        // If it is not first info, print the separator first.
> +        //
> +        Print (L" | ");
> +      }
>        Print (Table[Index].Info);
> -      Print (L" | ");
> 
> -      NoInfo = FALSE;
> +      FirstInfo = FALSE;
>        //
>        // clear the bit, for reserved bits test
>        //
> @@ -3469,7 +3474,10 @@ PrintBitsInfo (
>      }
>    }
> 
> -  if (NoInfo) {
> +  //
> +  // There is no any info if FirstInfo is still TRUE.
> +  //
> +  if (FirstInfo) {
>      ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN
> (STR_SMBIOSVIEW_QUERYTABLE_NO_INFO), gShellDebug1HiiHandle);
>    }
> 
> --
> 2.7.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-09 17:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-09  9:22 [PATCH] ShellPkg SmbiosView: Eliminate trailing " | " in PrintBitsInfo() Star Zeng
2017-02-09 17:00 ` Carsey, Jaben

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox