/** @file\r
Main file for Comp shell Debug1 function.\r
\r
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
+ Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
UINTN DataSizeFromFile2;\r
CHAR16 *FileName1;\r
CHAR16 *FileName2;\r
+ CONST CHAR16 *TempParam;\r
+ UINTN ErrorAddress;\r
\r
ErrorCount = 0;\r
ShellStatus = SHELL_SUCCESS;\r
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);\r
if (EFI_ERROR(Status)) {\r
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"comp", ProblemParam); \r
FreePool(ProblemParam);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
}\r
} else {\r
if (ShellCommandLineGetCount(Package) > 3) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"comp"); \r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else if (ShellCommandLineGetCount(Package) < 3) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"comp"); \r
ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
- FileName1 = ShellFindFilePath(ShellCommandLineGetRawValue(Package, 1));\r
+ TempParam = ShellCommandLineGetRawValue(Package, 1);\r
+ ASSERT(TempParam != NULL);\r
+ FileName1 = ShellFindFilePath(TempParam);\r
if (FileName1 == NULL) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 1));\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"comp", TempParam); \r
ShellStatus = SHELL_NOT_FOUND;\r
} else {\r
Status = ShellOpenFileByName(FileName1, &FileHandle1, EFI_FILE_MODE_READ, 0);\r
if (EFI_ERROR(Status)) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 1), Status);\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"comp", TempParam); \r
ShellStatus = SHELL_NOT_FOUND;\r
}\r
}\r
- FileName2 = ShellFindFilePath(ShellCommandLineGetRawValue(Package, 2));\r
+ TempParam = ShellCommandLineGetRawValue(Package, 2);\r
+ ASSERT(TempParam != NULL);\r
+ FileName2 = ShellFindFilePath(TempParam);\r
if (FileName2 == NULL) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 2));\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"comp", TempParam); \r
ShellStatus = SHELL_NOT_FOUND;\r
} else {\r
Status = ShellOpenFileByName(FileName2, &FileHandle2, EFI_FILE_MODE_READ, 0);\r
if (EFI_ERROR(Status)) {\r
- ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 2), Status);\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"comp", TempParam); \r
ShellStatus = SHELL_NOT_FOUND;\r
}\r
}\r
Status = gEfiShellProtocol->ReadFile(FileHandle2, &DataSizeFromFile2, &DataFromFile2);\r
ASSERT_EFI_ERROR(Status);\r
if (DataFromFile1 != DataFromFile2) {\r
+ ErrorAddress = LoopVar;\r
ADF_File11 = 0;\r
ADF_File12 = 0;\r
ADF_File13 = 0;\r
ADF_File21 = 0;\r
ADF_File22 = 0;\r
ADF_File23 = 0;\r
+\r
+ //\r
+ // Now check the next 3 bytes if possible. This will make output\r
+ // cleaner when there are a sequence of differences.\r
+ //\r
if (LoopVar + 1 < Size1) {\r
LoopVar++;\r
DataSizeFromFile1 = 1;\r
}\r
}\r
}\r
+\r
+ //\r
+ // Print out based on highest of the 4 bytes that are different.\r
+ //\r
if (ADF_File13 != ADF_File23) {\r
ShellPrintHiiEx(\r
-1,\r
gShellDebug1HiiHandle,\r
++ErrorCount,\r
FileName1,\r
- LoopVar,\r
+ ErrorAddress,\r
DataFromFile1, ADF_File11, ADF_File12, ADF_File13,\r
DataFromFile1, ADF_File11, ADF_File12, ADF_File13,\r
FileName2,\r
- LoopVar,\r
+ ErrorAddress,\r
DataFromFile2, ADF_File21, ADF_File22, ADF_File23,\r
DataFromFile2, ADF_File21, ADF_File22, ADF_File23\r
);\r
gShellDebug1HiiHandle,\r
++ErrorCount,\r
FileName1,\r
- LoopVar,\r
+ ErrorAddress,\r
DataFromFile1, ADF_File11, ADF_File12,\r
DataFromFile1, ADF_File11, ADF_File12,\r
FileName2,\r
- LoopVar,\r
+ ErrorAddress,\r
DataFromFile2, ADF_File21, ADF_File22,\r
DataFromFile2, ADF_File21, ADF_File22\r
);\r
gShellDebug1HiiHandle,\r
++ErrorCount,\r
FileName1,\r
- LoopVar,\r
+ ErrorAddress,\r
DataFromFile1, ADF_File11,\r
DataFromFile1, ADF_File11,\r
FileName2,\r
- LoopVar,\r
+ ErrorAddress,\r
DataFromFile2, ADF_File21,\r
DataFromFile2, ADF_File21\r
);\r
gShellDebug1HiiHandle,\r
++ErrorCount,\r
FileName1,\r
- LoopVar,\r
+ ErrorAddress,\r
DataFromFile1,\r
DataFromFile1,\r
FileName2,\r
- LoopVar,\r
+ ErrorAddress,\r
DataFromFile2,\r
DataFromFile2\r
);\r