]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: BcfgDisplayDump(): call Description[Size] by name
authorLaszlo Ersek <lersek@redhat.com>
Thu, 21 Jan 2016 18:40:17 +0000 (18:40 +0000)
committerlersek <lersek@Edk2>
Thu, 21 Jan 2016 18:40:17 +0000 (18:40 +0000)
Introduce two more helper variables to avoid repeated pointer arithmetic.

This patch is not supposed to change behavior.

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@19712 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c

index b08aac1bd822eb9c7c439f27df842911fb3a2e28..aac85d3850907a86feefdd0a78ebf28cd2de8895 100644 (file)
@@ -1053,6 +1053,8 @@ BcfgDisplayDump(
   VOID            *DevPath;\r
   UINTN           Errors;\r
   EFI_LOAD_OPTION *LoadOption;\r
+  CHAR16          *Description;\r
+  UINTN           DescriptionSize;\r
 \r
   if (OrderCount == 0) {\r
     ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_BCFG_NONE), gShellBcfgHiiHandle, L"bcfg");  \r
@@ -1108,12 +1110,15 @@ BcfgDisplayDump(
       ++Errors;\r
       goto Cleanup;\r
     }\r
-    LoadOption = (EFI_LOAD_OPTION *)Buffer;\r
+\r
+    LoadOption      = (EFI_LOAD_OPTION *)Buffer;\r
+    Description     = (CHAR16 *)(&LoadOption->FilePathListLength + 1);\r
+    DescriptionSize = StrSize (Description);\r
 \r
     if (LoadOption->FilePathListLength != 0) {\r
       DevPath = AllocateZeroPool(LoadOption->FilePathListLength);\r
       if (DevPath != NULL) {\r
-        CopyMem(DevPath, Buffer+6+StrSize((CHAR16*)(Buffer+6)), LoadOption->FilePathListLength);\r
+        CopyMem(DevPath, Buffer+6+DescriptionSize, LoadOption->FilePathListLength);\r
         DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);\r
       }\r
     }\r
@@ -1125,11 +1130,11 @@ BcfgDisplayDump(
       gShellBcfgHiiHandle,\r
       LoopVar,\r
       VariableName,\r
-      (CHAR16*)(Buffer+6),\r
+      Description,\r
       DevPathString,\r
-      (StrSize((CHAR16*)(Buffer+6)) + LoadOption->FilePathListLength + 6) <= BufferSize?L'N':L'Y');\r
+      (DescriptionSize + LoadOption->FilePathListLength + 6) <= BufferSize?L'N':L'Y');\r
     if (VerboseOutput) {\r
-      for (LoopVar2 = (StrSize((CHAR16*)(Buffer+6)) + LoadOption->FilePathListLength + 6);LoopVar2<BufferSize;LoopVar2++){\r
+      for (LoopVar2 = (DescriptionSize + LoadOption->FilePathListLength + 6);LoopVar2<BufferSize;LoopVar2++){\r
         ShellPrintEx(\r
           -1,\r
           -1,\r