BaseTools: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
Creates output file that is a properly formed section per the PI spec.
|
||||
|
||||
Copyright (c) 2004 - 2018, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
#ifndef __GNUC__
|
||||
@@ -103,7 +103,7 @@ STATIC EFI_GUID mZeroGuid = {0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0
|
||||
STATIC EFI_GUID mEfiCrc32SectionGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
VOID
|
||||
Version (
|
||||
VOID
|
||||
)
|
||||
@@ -116,12 +116,12 @@ Routine Description:
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
|
||||
--*/
|
||||
{
|
||||
fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
|
||||
}
|
||||
@@ -151,11 +151,11 @@ Returns:
|
||||
// Summary usage
|
||||
//
|
||||
fprintf (stdout, "\nUsage: %s [options] [input_file]\n\n", UTILITY_NAME);
|
||||
|
||||
|
||||
//
|
||||
// Copyright declaration
|
||||
//
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n");
|
||||
//
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
|
||||
|
||||
//
|
||||
// Details Option
|
||||
@@ -176,7 +176,7 @@ Returns:
|
||||
EFI_SECTION_ALL is default section type.\n");
|
||||
fprintf (stdout, " -c [Type], --compress [Type]\n\
|
||||
Compress method type can be PI_NONE or PI_STD.\n\
|
||||
if -c option is not given, PI_STD is default type.\n");
|
||||
if -c option is not given, PI_STD is default type.\n");
|
||||
fprintf (stdout, " -g GuidValue, --vendor GuidValue\n\
|
||||
GuidValue is one specific vendor guid value.\n\
|
||||
Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n");
|
||||
@@ -215,7 +215,7 @@ Ascii2UnicodeString (
|
||||
|
||||
Routine Description:
|
||||
|
||||
Write ascii string as unicode string format to FILE
|
||||
Write ascii string as unicode string format to FILE
|
||||
|
||||
Arguments:
|
||||
|
||||
@@ -235,7 +235,7 @@ Returns:
|
||||
// End the UniString with a NULL.
|
||||
//
|
||||
*UniString = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
STATUS
|
||||
GenSectionCommonLeafSection (
|
||||
@@ -245,19 +245,19 @@ GenSectionCommonLeafSection (
|
||||
UINT8 **OutFileBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Generate a leaf section of type other than EFI_SECTION_VERSION
|
||||
and EFI_SECTION_USER_INTERFACE. Input file must be well formed.
|
||||
The function won't validate the input file's contents. For
|
||||
common leaf sections, the input file may be a binary file.
|
||||
The utility will add section header to the file.
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
|
||||
InputFileName - Name of the input file.
|
||||
|
||||
|
||||
InputFileNum - Number of input files. Should be 1 for leaf section.
|
||||
|
||||
SectionType - A valid section type string
|
||||
@@ -265,7 +265,7 @@ Arguments:
|
||||
OutFileBuffer - Buffer pointer to Output file contents
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
STATUS_ERROR - can't continue
|
||||
STATUS_SUCCESS - successful return
|
||||
|
||||
@@ -323,7 +323,7 @@ Returns:
|
||||
//
|
||||
Buffer = (UINT8 *) malloc ((size_t) TotalLength);
|
||||
if (Buffer == NULL) {
|
||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");
|
||||
Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");
|
||||
goto Done;
|
||||
}
|
||||
CommonSect = (EFI_COMMON_SECTION_HEADER *) Buffer;
|
||||
@@ -336,7 +336,7 @@ Returns:
|
||||
memset(CommonSect->Size, 0xff, sizeof(UINT8) * 3);
|
||||
((EFI_COMMON_SECTION_HEADER2 *)CommonSect)->ExtendedSize = TotalLength;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// read data from the input file.
|
||||
//
|
||||
@@ -348,7 +348,7 @@ Returns:
|
||||
}
|
||||
|
||||
//
|
||||
// Set OutFileBuffer
|
||||
// Set OutFileBuffer
|
||||
//
|
||||
*OutFileBuffer = Buffer;
|
||||
Status = STATUS_SUCCESS;
|
||||
@@ -408,14 +408,14 @@ GetSectionContents (
|
||||
UINT32 *BufferLength
|
||||
)
|
||||
/*++
|
||||
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Get the contents of all section files specified in InputFileName
|
||||
into FileBuffer.
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
|
||||
InputFileName - Name of the input file.
|
||||
|
||||
InputFileAlign - Alignment required by the input file data.
|
||||
@@ -424,11 +424,11 @@ Arguments:
|
||||
|
||||
FileBuffer - Output buffer to contain data
|
||||
|
||||
BufferLength - On input, this is size of the FileBuffer.
|
||||
BufferLength - On input, this is size of the FileBuffer.
|
||||
On output, this is the actual length of the data.
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
EFI_SUCCESS on successful return
|
||||
EFI_INVALID_PARAMETER if InputFileNum is less than 1 or BufferLength point is NULL.
|
||||
EFI_ABORTED if unable to open input file.
|
||||
@@ -475,8 +475,8 @@ Returns:
|
||||
}
|
||||
Size++;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
// Open file and read contents
|
||||
//
|
||||
InFile = fopen (LongFilePath (InputFileName[Index]), "rb");
|
||||
@@ -488,7 +488,7 @@ Returns:
|
||||
fseek (InFile, 0, SEEK_END);
|
||||
FileSize = ftell (InFile);
|
||||
fseek (InFile, 0, SEEK_SET);
|
||||
DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
|
||||
DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
|
||||
//
|
||||
// Adjust section buffer when section alignment is required.
|
||||
//
|
||||
@@ -525,7 +525,7 @@ Returns:
|
||||
HeaderSize = GuidSectHeader.DataOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fseek (InFile, 0, SEEK_SET);
|
||||
|
||||
@@ -544,7 +544,7 @@ Returns:
|
||||
if ((InputFileAlign [Index] != 0) && (((Size + HeaderSize + TeOffset) % InputFileAlign [Index]) != 0)) {
|
||||
Offset = (Size + sizeof (EFI_COMMON_SECTION_HEADER) + HeaderSize + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
|
||||
Offset = Offset - Size - HeaderSize - TeOffset;
|
||||
|
||||
|
||||
if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) {
|
||||
//
|
||||
// The maximal alignment is 64K, the raw section size must be less than 0xffffff
|
||||
@@ -577,7 +577,7 @@ Returns:
|
||||
fclose (InFile);
|
||||
Size += FileSize;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Set the real required buffer size.
|
||||
//
|
||||
@@ -599,28 +599,28 @@ GenSectionCompressionSection (
|
||||
UINT8 **OutFileBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Generate an encapsulating section of type EFI_SECTION_COMPRESSION
|
||||
Input file must be already sectioned. The function won't validate
|
||||
the input files' contents. Caller should hand in files already
|
||||
the input files' contents. Caller should hand in files already
|
||||
with section header.
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
|
||||
InputFileName - Name of the input file.
|
||||
|
||||
InputFileAlign - Alignment required by the input file data.
|
||||
|
||||
InputFileNum - Number of input files. Should be at least 1.
|
||||
|
||||
SectCompSubType - Specify the compression algorithm requested.
|
||||
|
||||
SectCompSubType - Specify the compression algorithm requested.
|
||||
|
||||
OutFileBuffer - Buffer pointer to Output file contents
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
EFI_SUCCESS on successful return
|
||||
EFI_INVALID_PARAMETER if InputFileNum is less than 1
|
||||
EFI_ABORTED if unable to open input file.
|
||||
@@ -754,7 +754,7 @@ Returns:
|
||||
}
|
||||
}
|
||||
|
||||
DebugMsg (NULL, 0, 9, "comprss file size",
|
||||
DebugMsg (NULL, 0, 9, "comprss file size",
|
||||
"the original section size is %d bytes and the compressed section size is %u bytes", (unsigned) InputLength, (unsigned) CompressedLength);
|
||||
|
||||
//if (TotalLength >= MAX_SECTION_SIZE) {
|
||||
@@ -782,7 +782,7 @@ Returns:
|
||||
CompressionSect2->UncompressedLength = InputLength;
|
||||
} else {
|
||||
CompressionSect = (EFI_COMPRESSION_SECTION *) FileBuffer;
|
||||
|
||||
|
||||
CompressionSect->CommonHeader.Type = EFI_SECTION_COMPRESSION;
|
||||
CompressionSect->CommonHeader.Size[0] = (UINT8) (TotalLength & 0xff);
|
||||
CompressionSect->CommonHeader.Size[1] = (UINT8) ((TotalLength & 0xff00) >> 8);
|
||||
@@ -792,7 +792,7 @@ Returns:
|
||||
}
|
||||
|
||||
//
|
||||
// Set OutFileBuffer
|
||||
// Set OutFileBuffer
|
||||
//
|
||||
*OutFileBuffer = FileBuffer;
|
||||
|
||||
@@ -810,32 +810,32 @@ GenSectionGuidDefinedSection (
|
||||
UINT8 **OutFileBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Generate an encapsulating section of type EFI_SECTION_GUID_DEFINED
|
||||
Input file must be already sectioned. The function won't validate
|
||||
the input files' contents. Caller should hand in files already
|
||||
the input files' contents. Caller should hand in files already
|
||||
with section header.
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
|
||||
InputFileName - Name of the input file.
|
||||
|
||||
|
||||
InputFileAlign - Alignment required by the input file data.
|
||||
|
||||
InputFileNum - Number of input files. Should be at least 1.
|
||||
|
||||
VendorGuid - Specify vendor guid value.
|
||||
|
||||
DataAttribute - Specify attribute for the vendor guid data.
|
||||
|
||||
DataAttribute - Specify attribute for the vendor guid data.
|
||||
|
||||
DataHeaderSize- Guided Data Header Size
|
||||
|
||||
|
||||
OutFileBuffer - Buffer pointer to Output file contents
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
EFI_SUCCESS on successful return
|
||||
EFI_INVALID_PARAMETER if InputFileNum is less than 1
|
||||
EFI_ABORTED if unable to open input file.
|
||||
@@ -935,7 +935,7 @@ Returns:
|
||||
//
|
||||
Crc32Checksum = 0;
|
||||
CalculateCrc32 (FileBuffer + Offset, InputLength, &Crc32Checksum);
|
||||
|
||||
|
||||
if (TotalLength >= MAX_SECTION_SIZE) {
|
||||
Crc32GuidSect2 = (CRC32_SECTION_HEADER2 *) FileBuffer;
|
||||
Crc32GuidSect2->GuidSectionHeader.CommonHeader.Type = EFI_SECTION_GUID_DEFINED;
|
||||
@@ -985,9 +985,9 @@ Returns:
|
||||
}
|
||||
}
|
||||
VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);
|
||||
|
||||
|
||||
//
|
||||
// Set OutFileBuffer
|
||||
// Set OutFileBuffer
|
||||
//
|
||||
*OutFileBuffer = FileBuffer;
|
||||
|
||||
@@ -1126,7 +1126,7 @@ Returns:
|
||||
int VersionNumber;
|
||||
UINT8 SectType;
|
||||
UINT8 SectCompSubType;
|
||||
UINT16 SectGuidAttribute;
|
||||
UINT16 SectGuidAttribute;
|
||||
UINT64 SectGuidHeaderLength;
|
||||
EFI_VERSION_SECTION *VersionSect;
|
||||
EFI_USER_INTERFACE_SECTION *UiSect;
|
||||
@@ -1172,9 +1172,9 @@ Returns:
|
||||
InFile = NULL;
|
||||
InFileSize = 0;
|
||||
InFileBuffer = NULL;
|
||||
|
||||
|
||||
SetUtilityName (UTILITY_NAME);
|
||||
|
||||
|
||||
if (argc == 1) {
|
||||
Error (NULL, 0, 1001, "Missing options", "No options input");
|
||||
Usage ();
|
||||
@@ -1190,12 +1190,12 @@ Returns:
|
||||
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
|
||||
Version ();
|
||||
Usage ();
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (stricmp (argv[0], "--version") == 0) {
|
||||
Version ();
|
||||
return STATUS_SUCCESS;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
while (argc > 0) {
|
||||
@@ -1207,7 +1207,7 @@ Returns:
|
||||
}
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
|
||||
@@ -1218,7 +1218,7 @@ Returns:
|
||||
}
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((stricmp (argv[0], "-c") == 0) || (stricmp (argv[0], "--compress") == 0)) {
|
||||
@@ -1387,7 +1387,7 @@ Returns:
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
InputFileAlignNum ++;
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1529,14 +1529,14 @@ Returns:
|
||||
VerboseMsg ("Compress method is %s", mCompressionTypeName [SectCompSubType]);
|
||||
} else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_GUID_DEFINED]) == 0) {
|
||||
SectType = EFI_SECTION_GUID_DEFINED;
|
||||
|
||||
|
||||
if ((SectGuidAttribute & EFI_GUIDED_SECTION_NONE) != 0) {
|
||||
//
|
||||
// NONE attribute, clear attribute value.
|
||||
//
|
||||
SectGuidAttribute = SectGuidAttribute & ~EFI_GUIDED_SECTION_NONE;
|
||||
}
|
||||
VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
|
||||
VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
|
||||
(unsigned) VendorGuid.Data1,
|
||||
VendorGuid.Data2,
|
||||
VendorGuid.Data3,
|
||||
@@ -1595,7 +1595,7 @@ Returns:
|
||||
Error (NULL, 0, 1003, "Invalid option value", "SectionType = %s", SectionName);
|
||||
goto Finish;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// GuidValue is only required by Guided section.
|
||||
//
|
||||
@@ -1604,10 +1604,10 @@ Returns:
|
||||
(CompareGuid (&VendorGuid, &mZeroGuid) != 0)) {
|
||||
fprintf (stdout, "Warning: the input guid value is not required for this section type %s\n", SectionName);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Check whether there is input file
|
||||
//
|
||||
//
|
||||
if ((SectType != EFI_SECTION_VERSION) && (SectType != EFI_SECTION_USER_INTERFACE)) {
|
||||
//
|
||||
// The input file are required for other section type.
|
||||
@@ -1730,7 +1730,7 @@ Returns:
|
||||
OutFileBuffer,
|
||||
&InputLength
|
||||
);
|
||||
|
||||
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
OutFileBuffer = (UINT8 *) malloc (InputLength);
|
||||
if (OutFileBuffer == NULL) {
|
||||
@@ -1762,10 +1762,10 @@ Returns:
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (Status != EFI_SUCCESS || OutFileBuffer == NULL) {
|
||||
Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (int) Status);
|
||||
goto Finish;
|
||||
goto Finish;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1778,7 +1778,7 @@ Returns:
|
||||
InputLength = ((EFI_COMMON_SECTION_HEADER2 *)SectionHeader)->ExtendedSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Write the output file
|
||||
//
|
||||
|
Reference in New Issue
Block a user