/** @file\r
+Generic but simple file parsing routines.\r
\r
-Copyright (c) 2004 - 2008, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
+Copyright (c) 2004 - 2016, 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
http://opensource.org/licenses/bsd-license.php \r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
\r
-Module Name:\r
-\r
- SimpleFileParsing.c \r
-\r
-Abstract:\r
-\r
- Generic but simple file parsing routines.\r
-\r
--*/\r
\r
#include <stdio.h>\r
#include <stdlib.h>\r
#include <ctype.h>\r
\r
+#include "CommonLib.h"\r
#include "EfiUtilityMsgs.h"\r
#include "SimpleFileParsing.h"\r
\r
}\r
\r
if ((Len = t_strcmp (mGlobals.SourceFile.FileBufferPtr, Str)) > 0) {\r
- if (isalnum (mGlobals.SourceFile.FileBufferPtr[Len])) {\r
+ if (isalnum ((int)mGlobals.SourceFile.FileBufferPtr[Len])) {\r
return FALSE;\r
}\r
\r
\r
--*/\r
{\r
- UINT32 Val;\r
+ int Val;\r
\r
SkipWhiteSpace (&mGlobals.SourceFile);\r
if (EndOfFile (&mGlobals.SourceFile)) {\r
return FALSE;\r
}\r
\r
- if (isdigit (mGlobals.SourceFile.FileBufferPtr[0])) {\r
+ if (isdigit ((int)mGlobals.SourceFile.FileBufferPtr[0])) {\r
//\r
// Check for hex value\r
//\r
if ((mGlobals.SourceFile.FileBufferPtr[0] == T_CHAR_0) && (mGlobals.SourceFile.FileBufferPtr[1] == T_CHAR_LC_X)) {\r
- if (!isxdigit (mGlobals.SourceFile.FileBufferPtr[2])) {\r
+ if (!isxdigit ((int)mGlobals.SourceFile.FileBufferPtr[2])) {\r
return FALSE;\r
}\r
\r
mGlobals.SourceFile.FileBufferPtr += 2;\r
sscanf (mGlobals.SourceFile.FileBufferPtr, "%x", &Val);\r
- *Value = Val;\r
- while (isxdigit (mGlobals.SourceFile.FileBufferPtr[0])) {\r
+ *Value = (UINT32) Val;\r
+ while (isxdigit ((int)mGlobals.SourceFile.FileBufferPtr[0])) {\r
mGlobals.SourceFile.FileBufferPtr++;\r
}\r
\r
return TRUE;\r
} else {\r
*Value = atoi (mGlobals.SourceFile.FileBufferPtr);\r
- while (isdigit (mGlobals.SourceFile.FileBufferPtr[0])) {\r
+ while (isdigit ((int)mGlobals.SourceFile.FileBufferPtr[0])) {\r
mGlobals.SourceFile.FileBufferPtr++;\r
}\r
\r
// depth.\r
//\r
if (mGlobals.VerboseFile) {\r
- fprintf (stdout, "%*cProcessing file '%s'\n", (INT32)NestDepth * 2, ' ', SourceFile->FileName);\r
+ fprintf (stdout, "%*cProcessing file '%s'\n", (int)NestDepth * 2, ' ', SourceFile->FileName);\r
fprintf (stdout, "Parent source file = '%s'\n", ParentSourceFile->FileName);\r
}\r
\r
// Make sure we didn't exceed our maximum nesting depth\r
//\r
if (NestDepth > MAX_NEST_DEPTH) {\r
- Error (NULL, 0, 3001, "Not Supported", "%s exceeeds max nesting depth (%d)", SourceFile->FileName, NestDepth);\r
+ Error (NULL, 0, 3001, "Not Supported", "%s exceeeds max nesting depth (%u)", SourceFile->FileName, (unsigned) NestDepth);\r
Status = STATUS_ERROR;\r
goto Finish;\r
}\r
// Try to open the file locally, and if that fails try along our include paths.\r
//\r
strcpy (FoundFileName, SourceFile->FileName);\r
- if ((SourceFile->Fptr = fopen (FoundFileName, "rb")) == NULL) {\r
+ if ((SourceFile->Fptr = fopen (LongFilePath (FoundFileName), "rb")) == NULL) {\r
return STATUS_ERROR;\r
}\r
//\r
fseek (SourceFile->Fptr, 0, SEEK_END);\r
SourceFile->FileSize = ftell (SourceFile->Fptr);\r
if (mGlobals.VerboseFile) {\r
- printf ("FileSize = %d (0x%X)\n", (INT32)SourceFile->FileSize, (UINT32)SourceFile->FileSize);\r
+ printf ("FileSize = %u (0x%X)\n", (unsigned) SourceFile->FileSize, (unsigned) SourceFile->FileSize);\r
}\r
\r
fseek (SourceFile->Fptr, 0, SEEK_SET);\r
}\r
\r
printf ("'\n");\r
- printf ("FileSize = %d (0x%X)\n", (INT32)SourceFile->FileSize, (UINT32)SourceFile->FileSize);\r
+ printf ("FileSize = %u (0x%X)\n", (unsigned)SourceFile->FileSize, (unsigned)SourceFile->FileSize);\r
RewindFile (SourceFile);\r
}\r
}\r
UINT32 Len;\r
Len = 0;\r
while (!EndOfFile (&mGlobals.SourceFile) && (BufferLen > 0)) {\r
- if (isxdigit (mGlobals.SourceFile.FileBufferPtr[0])) {\r
+ if (isxdigit ((int)mGlobals.SourceFile.FileBufferPtr[0])) {\r
*Buffer = mGlobals.SourceFile.FileBufferPtr[0];\r
Buffer++;\r
Len++;\r
\r
--*/\r
{\r
- UINT32 Value32;\r
+ INT32 Value32;\r
UINT32 Index;\r
FILE_POSITION FPos;\r
CHAR8 TempString[20];\r