summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/C/Common
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-28 23:39:39 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-28 23:39:39 +0000
commit52302d4dee589a5df43a464420c9fe68ba83937d (patch)
tree2393f61b9e8975134e3cdfa0352d4c51a3b2ac8d /BaseTools/Source/C/Common
parentfe35c036354c4b6bf18c4699a45156f3965fae2a (diff)
downloadedk2-52302d4dee589a5df43a464420c9fe68ba83937d.tar.gz
edk2-52302d4dee589a5df43a464420c9fe68ba83937d.tar.bz2
edk2-52302d4dee589a5df43a464420c9fe68ba83937d.zip
Sync EDKII BaseTools to BaseTools project r1903.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10123 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/C/Common')
-rw-r--r--BaseTools/Source/C/Common/EfiUtilityMsgs.c35
-rw-r--r--BaseTools/Source/C/Common/EfiUtilityMsgs.h11
-rw-r--r--BaseTools/Source/C/Common/ParseInf.c70
3 files changed, 64 insertions, 52 deletions
diff --git a/BaseTools/Source/C/Common/EfiUtilityMsgs.c b/BaseTools/Source/C/Common/EfiUtilityMsgs.c
index 68cf02469e..0e7608d1cf 100644
--- a/BaseTools/Source/C/Common/EfiUtilityMsgs.c
+++ b/BaseTools/Source/C/Common/EfiUtilityMsgs.c
@@ -46,18 +46,6 @@ STATIC INT8 mPrintLimitsSet = 0;
STATIC
VOID
-PrintMessage (
- CHAR8 *Type,
- CHAR8 *FileName,
- UINT32 LineNumber,
- UINT32 MessageCode,
- CHAR8 *Text,
- CHAR8 *MsgFmt,
- va_list List
- );
-
-STATIC
-VOID
PrintLimitExceeded (
VOID
);
@@ -151,12 +139,6 @@ Notes:
va_start (List, MsgFmt);
PrintMessage ("ERROR", FileName, LineNumber, MessageCode, Text, MsgFmt, List);
va_end (List);
- //
- // Set status accordingly
- //
- if (mStatus < STATUS_ERROR) {
- mStatus = STATUS_ERROR;
- }
}
VOID
@@ -211,12 +193,6 @@ Returns:
va_start (List, MsgFmt);
PrintMessage ("ERROR", mSourceFileName, mSourceFileLineNum, MessageCode, Text, MsgFmt, List);
va_end (List);
- //
- // Set status accordingly
- //
- if (mStatus < STATUS_ERROR) {
- mStatus = STATUS_ERROR;
- }
}
VOID
@@ -396,7 +372,6 @@ Returns:
va_end (List);
}
-STATIC
VOID
PrintMessage (
CHAR8 *Type,
@@ -517,6 +492,15 @@ Notes:
sprintf (Line, "%s", mUtilityName);
}
}
+
+ if (strcmp (Type, "ERROR") == 0) {
+ //
+ // Set status accordingly for ERROR information.
+ //
+ if (mStatus < STATUS_ERROR) {
+ mStatus = STATUS_ERROR;
+ }
+ }
}
//
@@ -545,6 +529,7 @@ Notes:
vsprintf (Line2, MsgFmt, List);
fprintf (stdout, " %s\n", Line2);
}
+
}
STATIC
diff --git a/BaseTools/Source/C/Common/EfiUtilityMsgs.h b/BaseTools/Source/C/Common/EfiUtilityMsgs.h
index 40e6e170ae..8986a592d7 100644
--- a/BaseTools/Source/C/Common/EfiUtilityMsgs.h
+++ b/BaseTools/Source/C/Common/EfiUtilityMsgs.h
@@ -71,6 +71,17 @@ SetUtilityName (
;
VOID
+PrintMessage (
+ CHAR8 *Type,
+ CHAR8 *FileName,
+ UINT32 LineNumber,
+ UINT32 MessageCode,
+ CHAR8 *Text,
+ CHAR8 *MsgFmt,
+ va_list List
+ );
+
+VOID
Error (
CHAR8 *FileName,
UINT32 LineNumber,
diff --git a/BaseTools/Source/C/Common/ParseInf.c b/BaseTools/Source/C/Common/ParseInf.c
index cd10da9b2d..2ce25be86f 100644
--- a/BaseTools/Source/C/Common/ParseInf.c
+++ b/BaseTools/Source/C/Common/ParseInf.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2004 - 2008, Intel Corporation
+Copyright (c) 2004 - 2010, Intel Corporation
All rights reserved. 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
@@ -484,13 +484,14 @@ Returns:
--*/
{
UINT8 Index;
- UINT64 HexNumber;
+ UINT64 Value;
CHAR8 CurrentChar;
//
// Initialize the result
//
- HexNumber = 0;
+ Value = 0;
+ Index = 0;
//
// Check input paramter
@@ -498,50 +499,65 @@ Returns:
if (AsciiString == NULL || ReturnValue == NULL) {
return EFI_INVALID_PARAMETER;
}
+ while (AsciiString[Index] == ' ') {
+ Index ++;
+ }
+
//
// Add each character to the result
//
- if (IsHex || (AsciiString[0] == '0' && (AsciiString[1] == 'x' || AsciiString[1] == 'X'))) {
- //
- // Verify string is a hex number
- //
- for (Index = 2; Index < strlen (AsciiString); Index++) {
- if (isxdigit ((int)AsciiString[Index]) == 0) {
- return EFI_ABORTED;
- }
- }
+ if (IsHex || (AsciiString[Index] == '0' && (AsciiString[Index + 1] == 'x' || AsciiString[Index + 1] == 'X'))) {
//
// Convert the hex string.
//
- for (Index = 2; AsciiString[Index] != '\0'; Index++) {
+ for (Index = Index + 2; AsciiString[Index] != '\0'; Index++) {
CurrentChar = AsciiString[Index];
- HexNumber *= 16;
+ if (CurrentChar == ' ') {
+ break;
+ }
+ //
+ // Verify Hex string
+ //
+ if (isxdigit ((int)CurrentChar) == 0) {
+ return EFI_ABORTED;
+ }
+ //
+ // Add hex value
+ //
+ Value *= 16;
if (CurrentChar >= '0' && CurrentChar <= '9') {
- HexNumber += CurrentChar - '0';
+ Value += CurrentChar - '0';
} else if (CurrentChar >= 'a' && CurrentChar <= 'f') {
- HexNumber += CurrentChar - 'a' + 10;
+ Value += CurrentChar - 'a' + 10;
} else if (CurrentChar >= 'A' && CurrentChar <= 'F') {
- HexNumber += CurrentChar - 'A' + 10;
- } else {
- //
- // Unrecognized character
- //
- return EFI_ABORTED;
+ Value += CurrentChar - 'A' + 10;
}
}
- *ReturnValue = HexNumber;
+ *ReturnValue = Value;
} else {
//
- // Verify string is a number
+ // Convert dec string is a number
//
- for (Index = 0; Index < strlen (AsciiString); Index++) {
- if (isdigit ((int)AsciiString[Index]) == 0) {
+ for (; Index < strlen (AsciiString); Index++) {
+ CurrentChar = AsciiString[Index];
+ if (CurrentChar == ' ') {
+ break;
+ }
+ //
+ // Verify Dec string
+ //
+ if (isdigit ((int)CurrentChar) == 0) {
return EFI_ABORTED;
}
+ //
+ // Add dec value
+ //
+ Value = Value * 10;
+ Value += CurrentChar - '0';
}
- *ReturnValue = atol (AsciiString);
+ *ReturnValue = Value;
}
return EFI_SUCCESS;