summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2016-01-21 18:40:17 +0000
committerHao Wu <hao.a.wu@intel.com>2016-07-13 20:41:33 +0800
commit05f3fb2539188b9dd108bb1227506923d0f0278d (patch)
treeecb022404b917608a7e30330c86648b91caf20a7
parent8d3baa7fde0b24ce40d24eabbb6dc71696e1d20f (diff)
downloadedk2-platforms-05f3fb2539188b9dd108bb1227506923d0f0278d.tar.xz
ShellPkg: BcfgDisplayDump(): call Description[Size] by name
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 (cherry picked from commit 5dc03ade6adbb7e91ec7ce90045692154dbef2aa)
-rw-r--r--ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
index b08aac1bd8..aac85d3850 100644
--- a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
+++ b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c
@@ -1053,6 +1053,8 @@ BcfgDisplayDump(
VOID *DevPath;
UINTN Errors;
EFI_LOAD_OPTION *LoadOption;
+ CHAR16 *Description;
+ UINTN DescriptionSize;
if (OrderCount == 0) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_BCFG_NONE), gShellBcfgHiiHandle, L"bcfg");
@@ -1108,12 +1110,15 @@ BcfgDisplayDump(
++Errors;
goto Cleanup;
}
- LoadOption = (EFI_LOAD_OPTION *)Buffer;
+
+ LoadOption = (EFI_LOAD_OPTION *)Buffer;
+ Description = (CHAR16 *)(&LoadOption->FilePathListLength + 1);
+ DescriptionSize = StrSize (Description);
if (LoadOption->FilePathListLength != 0) {
DevPath = AllocateZeroPool(LoadOption->FilePathListLength);
if (DevPath != NULL) {
- CopyMem(DevPath, Buffer+6+StrSize((CHAR16*)(Buffer+6)), LoadOption->FilePathListLength);
+ CopyMem(DevPath, Buffer+6+DescriptionSize, LoadOption->FilePathListLength);
DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);
}
}
@@ -1125,11 +1130,11 @@ BcfgDisplayDump(
gShellBcfgHiiHandle,
LoopVar,
VariableName,
- (CHAR16*)(Buffer+6),
+ Description,
DevPathString,
- (StrSize((CHAR16*)(Buffer+6)) + LoadOption->FilePathListLength + 6) <= BufferSize?L'N':L'Y');
+ (DescriptionSize + LoadOption->FilePathListLength + 6) <= BufferSize?L'N':L'Y');
if (VerboseOutput) {
- for (LoopVar2 = (StrSize((CHAR16*)(Buffer+6)) + LoadOption->FilePathListLength + 6);LoopVar2<BufferSize;LoopVar2++){
+ for (LoopVar2 = (DescriptionSize + LoadOption->FilePathListLength + 6);LoopVar2<BufferSize;LoopVar2++){
ShellPrintEx(
-1,
-1,