Revision: 19714
          http://sourceforge.net/p/edk2/code/19714
Author:   lersek
Date:     2016-01-21 18:40:26 +0000 (Thu, 21 Jan 2016)
Log Message:
-----------
ShellPkg: BcfgDisplayDump(): calculate OptionalDataOffset explicitly

Eliminate some more repeated pointer arithmetic.

This patch too is only refactoring.

Cc: Jaben Carsey <[email protected]>
Cc: Ryan Harkin <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c

Modified: 
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
===================================================================
--- 
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c   
    2016-01-21 18:40:22 UTC (rev 19713)
+++ 
trunk/edk2/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c   
    2016-01-21 18:40:26 UTC (rev 19714)
@@ -1055,6 +1055,7 @@
   EFI_LOAD_OPTION *LoadOption;
   CHAR16          *Description;
   UINTN           DescriptionSize;
+  UINTN           OptionalDataOffset;
 
   if (OrderCount == 0) {
     ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_BCFG_NONE), 
gShellBcfgHiiHandle, L"bcfg");  
@@ -1118,6 +1119,10 @@
       FilePathList = (UINT8 *)Description + DescriptionSize;
       DevPathString = ConvertDevicePathToText(FilePathList, TRUE, FALSE);
     }
+
+    OptionalDataOffset = sizeof *LoadOption + DescriptionSize +
+                         LoadOption->FilePathListLength;
+
     ShellPrintHiiEx(
       -1,
       -1,
@@ -1128,9 +1133,10 @@
       VariableName,
       Description,
       DevPathString,
-      (DescriptionSize + LoadOption->FilePathListLength + 6) <= 
BufferSize?L'N':L'Y');
+      OptionalDataOffset <= BufferSize ? L'N' : L'Y'
+      );
     if (VerboseOutput) {
-      for (LoopVar2 = (DescriptionSize + LoadOption->FilePathListLength + 
6);LoopVar2<BufferSize;LoopVar2++){
+      for (LoopVar2 = OptionalDataOffset; LoopVar2 < BufferSize; LoopVar2++){
         ShellPrintEx(
           -1,
           -1,


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to