diff options
author | Jaben Carsey <Jaben.carsey@intel.com> | 2014-06-05 22:02:12 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-06-05 22:02:12 +0000 |
commit | 33eb033f8609d960ccf6c3ad9abb0acab5e1a08f (patch) | |
tree | 856ef3fce0d73c576e9468e60ba998451c9c04f4 | |
parent | 4ab4497c38b44832bc1f8b5d8cf77a6a254efed1 (diff) | |
download | edk2-33eb033f8609d960ccf6c3ad9abb0acab5e1a08f.tar.gz edk2-33eb033f8609d960ccf6c3ad9abb0acab5e1a08f.tar.bz2 edk2-33eb033f8609d960ccf6c3ad9abb0acab5e1a08f.zip |
ShellPkg: fix Comp command output
The comp command was potentially displaying the incorrect offset into the file due to comparing 3 extra bytes for difference groups.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hp.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15558 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c index 01ef1997b2..f4e20a4e3a 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c @@ -1,7 +1,7 @@ /** @file
Main file for Comp shell Debug1 function.
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -50,6 +50,7 @@ ShellCommandRunComp ( CHAR16 *FileName1;
CHAR16 *FileName2;
CONST CHAR16 *TempParam;
+ UINTN ErrorAddress;
ErrorCount = 0;
ShellStatus = SHELL_SUCCESS;
@@ -136,12 +137,18 @@ ShellCommandRunComp ( Status = gEfiShellProtocol->ReadFile(FileHandle2, &DataSizeFromFile2, &DataFromFile2);
ASSERT_EFI_ERROR(Status);
if (DataFromFile1 != DataFromFile2) {
+ ErrorAddress = LoopVar;
ADF_File11 = 0;
ADF_File12 = 0;
ADF_File13 = 0;
ADF_File21 = 0;
ADF_File22 = 0;
ADF_File23 = 0;
+
+ //
+ // Now check the next 3 bytes if possible. This will make output
+ // cleaner when there are a sequence of differences.
+ //
if (LoopVar + 1 < Size1) {
LoopVar++;
DataSizeFromFile1 = 1;
@@ -169,6 +176,10 @@ ShellCommandRunComp ( }
}
}
+
+ //
+ // Print out based on highest of the 4 bytes that are different.
+ //
if (ADF_File13 != ADF_File23) {
ShellPrintHiiEx(
-1,
@@ -178,11 +189,11 @@ ShellCommandRunComp ( gShellDebug1HiiHandle,
++ErrorCount,
FileName1,
- LoopVar,
+ ErrorAddress,
DataFromFile1, ADF_File11, ADF_File12, ADF_File13,
DataFromFile1, ADF_File11, ADF_File12, ADF_File13,
FileName2,
- LoopVar,
+ ErrorAddress,
DataFromFile2, ADF_File21, ADF_File22, ADF_File23,
DataFromFile2, ADF_File21, ADF_File22, ADF_File23
);
@@ -195,11 +206,11 @@ ShellCommandRunComp ( gShellDebug1HiiHandle,
++ErrorCount,
FileName1,
- LoopVar,
+ ErrorAddress,
DataFromFile1, ADF_File11, ADF_File12,
DataFromFile1, ADF_File11, ADF_File12,
FileName2,
- LoopVar,
+ ErrorAddress,
DataFromFile2, ADF_File21, ADF_File22,
DataFromFile2, ADF_File21, ADF_File22
);
@@ -212,11 +223,11 @@ ShellCommandRunComp ( gShellDebug1HiiHandle,
++ErrorCount,
FileName1,
- LoopVar,
+ ErrorAddress,
DataFromFile1, ADF_File11,
DataFromFile1, ADF_File11,
FileName2,
- LoopVar,
+ ErrorAddress,
DataFromFile2, ADF_File21,
DataFromFile2, ADF_File21
);
@@ -229,11 +240,11 @@ ShellCommandRunComp ( gShellDebug1HiiHandle,
++ErrorCount,
FileName1,
- LoopVar,
+ ErrorAddress,
DataFromFile1,
DataFromFile1,
FileName2,
- LoopVar,
+ ErrorAddress,
DataFromFile2,
DataFromFile2
);
|