diff options
author | Laszlo Ersek <lersek@redhat.com> | 2016-01-21 18:40:26 +0000 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-07-13 20:41:37 +0800 |
commit | 646690d296572fbc500090cb18da4fb172d4f044 (patch) | |
tree | e96a262ab366b00226ae847e4bc726048160494a /ShellPkg/Library/UefiShellBcfgCommandLib | |
parent | 3a5d7ce52642cf555c15a87c983bdfb306a1eb69 (diff) | |
download | edk2-platforms-646690d296572fbc500090cb18da4fb172d4f044.tar.xz |
ShellPkg: BcfgDisplayDump(): calculate OptionalDataOffset explicitly
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
(cherry picked from commit 5a5a659092ebc3936ecd18c3b78c6fc850d4af1c)
Diffstat (limited to 'ShellPkg/Library/UefiShellBcfgCommandLib')
-rw-r--r-- | ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c index d109ca29a7..ca7ecd1751 100644 --- a/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c +++ b/ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c @@ -1055,6 +1055,7 @@ BcfgDisplayDump( 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 @@ BcfgDisplayDump( FilePathList = (UINT8 *)Description + DescriptionSize;
DevPathString = ConvertDevicePathToText(FilePathList, TRUE, FALSE);
}
+
+ OptionalDataOffset = sizeof *LoadOption + DescriptionSize +
+ LoadOption->FilePathListLength;
+
ShellPrintHiiEx(
-1,
-1,
@@ -1128,9 +1133,10 @@ BcfgDisplayDump( 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,
|