summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C/Common
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/C/Common')
-rw-r--r--BaseTools/Source/C/Common/BasePeCoff.c56
-rw-r--r--BaseTools/Source/C/Common/CommonLib.c6
-rw-r--r--BaseTools/Source/C/Common/EfiUtilityMsgs.c14
-rw-r--r--BaseTools/Source/C/Common/EfiUtilityMsgs.h4
-rw-r--r--BaseTools/Source/C/Common/MyAlloc.c56
-rw-r--r--BaseTools/Source/C/Common/ParseGuidedSectionTools.c1
-rw-r--r--BaseTools/Source/C/Common/ParseInf.c10
-rw-r--r--BaseTools/Source/C/Common/SimpleFileParsing.c14
8 files changed, 82 insertions, 79 deletions
diff --git a/BaseTools/Source/C/Common/BasePeCoff.c b/BaseTools/Source/C/Common/BasePeCoff.c
index 72b6a52..0166c22 100644
--- a/BaseTools/Source/C/Common/BasePeCoff.c
+++ b/BaseTools/Source/C/Common/BasePeCoff.c
@@ -856,6 +856,7 @@ Returns:
PeHdr = NULL;
TeHdr = NULL;
+ OptionHeader.Header = NULL;
//
// Assume success
//
@@ -1252,11 +1253,11 @@ PeCoffLoaderGetPdbPointer (
//
// Get the DebugEntry offset in the raw data image.
//
- SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);
- Index = Hdr.Te->NumberOfSections;
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);
+ Index = Hdr.Te->NumberOfSections;
for (Index1 = 0; Index1 < Index; Index1 ++) {
- if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
- (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
+ if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
+ (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN) Hdr.Te +
DirectoryEntry->VirtualAddress -
SectionHeader [Index1].VirtualAddress +
@@ -1324,8 +1325,8 @@ PeCoffLoaderGetPdbPointer (
// Get the DebugEntry offset in the raw data image.
//
for (Index1 = 0; Index1 < Index; Index1 ++) {
- if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
- (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
+ if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
+ (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (
(UINTN) Pe32Data +
DirectoryEntry->VirtualAddress -
@@ -1349,27 +1350,28 @@ PeCoffLoaderGetPdbPointer (
for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) {
if (EFI_IMAGE_DEBUG_TYPE_CODEVIEW == DebugEntry->Type) {
if (DebugEntry->SizeOfData > 0) {
- //
- // Get the DebugEntry offset in the raw data image.
- //
- for (Index1 = 0; Index1 < Index; Index1 ++) {
- if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) &&
- (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
- CodeViewEntryPointer = (VOID *) (
- ((UINTN)Pe32Data) +
- (UINTN) DebugEntry->RVA -
- SectionHeader[Index1].VirtualAddress +
- SectionHeader[Index1].PointerToRawData +
- (UINTN)TEImageAdjust);
- break;
- }
- }
- if (Index1 >= Index) {
- //
- // Can't find CodeViewEntryPointer in raw PE/COFF image.
- //
- continue;
- }
+ //
+ // Get the DebugEntry offset in the raw data image.
+ //
+ CodeViewEntryPointer = NULL;
+ for (Index1 = 0; Index1 < Index; Index1 ++) {
+ if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) &&
+ (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
+ CodeViewEntryPointer = (VOID *) (
+ ((UINTN)Pe32Data) +
+ (UINTN) DebugEntry->RVA -
+ SectionHeader[Index1].VirtualAddress +
+ SectionHeader[Index1].PointerToRawData +
+ (UINTN)TEImageAdjust);
+ break;
+ }
+ }
+ if (Index1 >= Index) {
+ //
+ // Can't find CodeViewEntryPointer in raw PE/COFF image.
+ //
+ continue;
+ }
switch (* (UINT32 *) CodeViewEntryPointer) {
case CODEVIEW_SIGNATURE_NB10:
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));
diff --git a/BaseTools/Source/C/Common/CommonLib.c b/BaseTools/Source/C/Common/CommonLib.c
index 970b2af..a0c6603 100644
--- a/BaseTools/Source/C/Common/CommonLib.c
+++ b/BaseTools/Source/C/Common/CommonLib.c
@@ -472,7 +472,7 @@ Returns:
printf (
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
- Guid->Data1,
+ (unsigned) Guid->Data1,
Guid->Data2,
Guid->Data3,
Guid->Data4[0],
@@ -529,7 +529,7 @@ Returns:
sprintf (
(CHAR8 *)Buffer,
"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
- Guid->Data1,
+ (unsigned) Guid->Data1,
Guid->Data2,
Guid->Data3,
Guid->Data4[0],
@@ -545,7 +545,7 @@ Returns:
sprintf (
(CHAR8 *)Buffer,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- Guid->Data1,
+ (unsigned) Guid->Data1,
Guid->Data2,
Guid->Data3,
Guid->Data4[0],
diff --git a/BaseTools/Source/C/Common/EfiUtilityMsgs.c b/BaseTools/Source/C/Common/EfiUtilityMsgs.c
index 9d697da..68cf024 100644
--- a/BaseTools/Source/C/Common/EfiUtilityMsgs.c
+++ b/BaseTools/Source/C/Common/EfiUtilityMsgs.c
@@ -34,7 +34,7 @@ Abstract:
//
STATIC STATUS mStatus = STATUS_SUCCESS;
STATIC CHAR8 mUtilityName[50] = { 0 };
-STATIC UINT32 mPrintLogLevel = INFO_LOG_LEVEL;
+STATIC UINT64 mPrintLogLevel = INFO_LOG_LEVEL;
STATIC CHAR8 *mSourceFileName = NULL;
STATIC UINT32 mSourceFileLineNum = 0;
STATIC UINT32 mErrorCount = 0;
@@ -355,7 +355,7 @@ VOID
DebugMsg (
CHAR8 *FileName,
UINT32 LineNumber,
- UINT32 MsgLevel,
+ UINT64 MsgLevel,
CHAR8 *Text,
CHAR8 *MsgFmt,
...
@@ -495,7 +495,7 @@ Notes:
if (Cptr != NULL) {
sprintf (Line, ": %s", Cptr);
if (LineNumber != 0) {
- sprintf (Line2, "(%d)", LineNumber);
+ sprintf (Line2, "(%u)", (unsigned) LineNumber);
strcat (Line, Line2);
}
}
@@ -509,7 +509,7 @@ Notes:
}
sprintf (Line, "%s", Cptr);
if (LineNumber != 0) {
- sprintf (Line2, "(%d)", LineNumber);
+ sprintf (Line2, "(%u)", (unsigned) LineNumber);
strcat (Line, Line2);
}
} else {
@@ -524,7 +524,7 @@ Notes:
// message for you. It has to be decimal digits too.
//
if (MessageCode != 0) {
- sprintf (Line2, ": %s %04d", Type, MessageCode);
+ sprintf (Line2, ": %s %04u", Type, (unsigned) MessageCode);
} else {
sprintf (Line2, ": %s", Type);
}
@@ -665,7 +665,7 @@ Returns:
VOID
SetPrintLevel (
- UINT32 LogLevel
+ UINT64 LogLevel
)
/*++
@@ -843,7 +843,7 @@ TestUtilityMessages (
)
{
CHAR8 *ArgStr = "ArgString";
- INTN ArgInt;
+ int ArgInt;
ArgInt = 0x12345678;
//
diff --git a/BaseTools/Source/C/Common/EfiUtilityMsgs.h b/BaseTools/Source/C/Common/EfiUtilityMsgs.h
index 6c2f9d2..40e6e17 100644
--- a/BaseTools/Source/C/Common/EfiUtilityMsgs.h
+++ b/BaseTools/Source/C/Common/EfiUtilityMsgs.h
@@ -96,7 +96,7 @@ VOID
DebugMsg (
CHAR8 *FileName,
UINT32 LineNumber,
- UINT32 MsgLevel,
+ UINT64 MsgLevel,
CHAR8 *OffendingText,
CHAR8 *MsgFmt,
...
@@ -123,7 +123,7 @@ KeyMsg (
VOID
SetPrintLevel (
- UINT32 LogLevel
+ UINT64 LogLevel
);
VOID
diff --git a/BaseTools/Source/C/Common/MyAlloc.c b/BaseTools/Source/C/Common/MyAlloc.c
index b537139..64c5ff7 100644
--- a/BaseTools/Source/C/Common/MyAlloc.c
+++ b/BaseTools/Source/C/Common/MyAlloc.c
@@ -86,7 +86,7 @@ MyCheck (
"Invalid parameter(s).\n",
Final,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -98,7 +98,7 @@ MyCheck (
"Invalid parameter.\n",
Final,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -121,12 +121,12 @@ MyCheck (
"\nFile=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",
Final,
File,
- (UINT32)Line,
+ (unsigned)Line,
Tmp->File,
- (UINT32)Tmp->Line,
- (UINT32)Tmp->Size,
- *(UINT32 *) (Tmp->Buffer),
- *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
+ (unsigned) Tmp->Line,
+ (unsigned) Tmp->Size,
+ (unsigned) *(UINT32 *) (Tmp->Buffer),
+ (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
);
exit (1);
@@ -141,17 +141,17 @@ MyCheck (
"\nSome allocated items have not been freed.\n",
Final,
File,
- (UINT32)Line
+ (unsigned)Line
);
for (Tmp = MyAllocData; Tmp != NULL; Tmp = Tmp->Next) {
printf (
"File=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",
Tmp->File,
- (UINT32)Tmp->Line,
- (UINT32)Tmp->Size,
- *(UINT32 *) (Tmp->Buffer),
- *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
+ (unsigned) Tmp->Line,
+ (unsigned) Tmp->Size,
+ (unsigned) *(UINT32 *) (Tmp->Buffer),
+ (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
);
}
}
@@ -201,9 +201,9 @@ MyAlloc (
printf (
"\nMyAlloc(Size=%u, File=%s, Line=%u)"
"\nInvalid parameter(s).\n",
- (UINT32)Size,
+ (unsigned)Size,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -214,9 +214,9 @@ MyAlloc (
printf (
"\nMyAlloc(Size=%u, File=%s, Line=%u)"
"\nInvalid parameter.\n",
- (UINT32)Size,
+ (unsigned)Size,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -238,9 +238,9 @@ MyAlloc (
printf (
"\nMyAlloc(Size=%u, File=%s, Line=%u)"
"\nOut of memory.\n",
- (UINT32)Size,
+ (unsigned)Size,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -315,9 +315,9 @@ MyRealloc (
"\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
"\nInvalid parameter(s).\n",
Ptr,
- (UINT32)Size,
+ (unsigned)Size,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -328,9 +328,9 @@ MyRealloc (
"\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
"\nInvalid parameter.\n",
Ptr,
- (UINT32)Size,
+ (unsigned)Size,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -349,9 +349,9 @@ MyRealloc (
"\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
"\nCould not find buffer.\n",
Ptr,
- (UINT32)Size,
+ (unsigned)Size,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -421,7 +421,7 @@ MyFree (
"\nInvalid parameter(s).\n",
Ptr,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -433,7 +433,7 @@ MyFree (
"\nInvalid parameter.\n",
Ptr,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -453,7 +453,7 @@ MyFree (
"\nCalled before memory allocated.\n",
Ptr,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -486,7 +486,7 @@ MyFree (
"\nNot found.\n",
Ptr,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
diff --git a/BaseTools/Source/C/Common/ParseGuidedSectionTools.c b/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
index 02d0b11..b643cde 100644
--- a/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
+++ b/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
@@ -122,6 +122,7 @@ Returns:
GUID_SEC_TOOL_ENTRY *NewGuidTool;
FirstGuidTool = NULL;
+ LastGuidTool = NULL;
while (TRUE) {
NextLine = ReadMemoryFileLine (InputFile);
diff --git a/BaseTools/Source/C/Common/ParseInf.c b/BaseTools/Source/C/Common/ParseInf.c
index 8305f14..b39c5bd 100644
--- a/BaseTools/Source/C/Common/ParseInf.c
+++ b/BaseTools/Source/C/Common/ParseInf.c
@@ -379,10 +379,10 @@ Returns:
--*/
{
INT32 Index;
- UINT32 Data1;
- UINT32 Data2;
- UINT32 Data3;
- UINT16 Data4[8];
+ unsigned Data1;
+ unsigned Data2;
+ unsigned Data3;
+ unsigned Data4[8];
if (AsciiGuidBuffer == NULL || GuidBuffer == NULL) {
return EFI_INVALID_PARAMETER;
@@ -416,7 +416,7 @@ Returns:
//
Index = sscanf (
AsciiGuidBuffer,
- "%08x-%04x-%04x-%02hx%02hx-%02hx%02hx%02hx%02hx%02hx%02hx",
+ "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
&Data1,
&Data2,
&Data3,
diff --git a/BaseTools/Source/C/Common/SimpleFileParsing.c b/BaseTools/Source/C/Common/SimpleFileParsing.c
index 52ec129..5a7111c 100644
--- a/BaseTools/Source/C/Common/SimpleFileParsing.c
+++ b/BaseTools/Source/C/Common/SimpleFileParsing.c
@@ -536,7 +536,7 @@ Returns:
--*/
{
- UINT32 Val;
+ unsigned Val;
SkipWhiteSpace (&mGlobals.SourceFile);
if (EndOfFile (&mGlobals.SourceFile)) {
@@ -554,7 +554,7 @@ Returns:
mGlobals.SourceFile.FileBufferPtr += 2;
sscanf (mGlobals.SourceFile.FileBufferPtr, "%x", &Val);
- *Value = Val;
+ *Value = (UINT32) Val;
while (isxdigit (mGlobals.SourceFile.FileBufferPtr[0])) {
mGlobals.SourceFile.FileBufferPtr++;
}
@@ -634,7 +634,7 @@ Returns:
// depth.
//
if (mGlobals.VerboseFile) {
- fprintf (stdout, "%*cProcessing file '%s'\n", (INT32)NestDepth * 2, ' ', SourceFile->FileName);
+ fprintf (stdout, "%*cProcessing file '%s'\n", (int)NestDepth * 2, ' ', SourceFile->FileName);
fprintf (stdout, "Parent source file = '%s'\n", ParentSourceFile->FileName);
}
@@ -642,7 +642,7 @@ Returns:
// Make sure we didn't exceed our maximum nesting depth
//
if (NestDepth > MAX_NEST_DEPTH) {
- Error (NULL, 0, 3001, "Not Supported", "%s exceeeds max nesting depth (%d)", SourceFile->FileName, NestDepth);
+ Error (NULL, 0, 3001, "Not Supported", "%s exceeeds max nesting depth (%u)", SourceFile->FileName, (unsigned) NestDepth);
Status = STATUS_ERROR;
goto Finish;
}
@@ -698,7 +698,7 @@ Returns:
fseek (SourceFile->Fptr, 0, SEEK_END);
SourceFile->FileSize = ftell (SourceFile->Fptr);
if (mGlobals.VerboseFile) {
- printf ("FileSize = %d (0x%X)\n", (INT32)SourceFile->FileSize, (UINT32)SourceFile->FileSize);
+ printf ("FileSize = %u (0x%X)\n", (unsigned) SourceFile->FileSize, (unsigned) SourceFile->FileSize);
}
fseek (SourceFile->Fptr, 0, SEEK_SET);
@@ -819,7 +819,7 @@ Returns:
}
printf ("'\n");
- printf ("FileSize = %d (0x%X)\n", (INT32)SourceFile->FileSize, (UINT32)SourceFile->FileSize);
+ printf ("FileSize = %u (0x%X)\n", (unsigned)SourceFile->FileSize, (unsigned)SourceFile->FileSize);
RewindFile (SourceFile);
}
}
@@ -1282,7 +1282,7 @@ Returns:
--*/
{
- UINT32 Value32;
+ unsigned Value32;
UINT32 Index;
FILE_POSITION FPos;
CHAR8 TempString[20];