]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: BcfgDisplayDump(): calculate OptionalDataOffset explicitly
authorLaszlo Ersek <lersek@redhat.com>
Thu, 21 Jan 2016 18:40:26 +0000 (18:40 +0000)
committerlersek <lersek@Edk2>
Thu, 21 Jan 2016 18:40:26 +0000 (18:40 +0000)
Eliminate some more repeated pointer arithmetic.

This patch too is only refactoring.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ryan Harkin <ryan.harkin@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19714 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c

index d109ca29a781b1ac06eaf888ff633b87f805f520..ca7ecd17519f85e155f7017c3f41ed004cf4f8d6 100644 (file)
@@ -1055,6 +1055,7 @@ BcfgDisplayDump(
   EFI_LOAD_OPTION *LoadOption;\r
   CHAR16          *Description;\r
   UINTN           DescriptionSize;\r
+  UINTN           OptionalDataOffset;\r
 \r
   if (OrderCount == 0) {\r
     ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_BCFG_NONE), gShellBcfgHiiHandle, L"bcfg");  \r
@@ -1118,6 +1119,10 @@ BcfgDisplayDump(
       FilePathList = (UINT8 *)Description + DescriptionSize;\r
       DevPathString = ConvertDevicePathToText(FilePathList, TRUE, FALSE);\r
     }\r
+\r
+    OptionalDataOffset = sizeof *LoadOption + DescriptionSize +\r
+                         LoadOption->FilePathListLength;\r
+\r
     ShellPrintHiiEx(\r
       -1,\r
       -1,\r
@@ -1128,9 +1133,10 @@ BcfgDisplayDump(
       VariableName,\r
       Description,\r
       DevPathString,\r
-      (DescriptionSize + LoadOption->FilePathListLength + 6) <= BufferSize?L'N':L'Y');\r
+      OptionalDataOffset <= BufferSize ? L'N' : L'Y'\r
+      );\r
     if (VerboseOutput) {\r
-      for (LoopVar2 = (DescriptionSize + LoadOption->FilePathListLength + 6);LoopVar2<BufferSize;LoopVar2++){\r
+      for (LoopVar2 = OptionalDataOffset; LoopVar2 < BufferSize; LoopVar2++){\r
         ShellPrintEx(\r
           -1,\r
           -1,\r