diff options
author | lhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-10-10 17:03:48 +0000 |
---|---|---|
committer | lhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-10-10 17:03:48 +0000 |
commit | 2e7ddad2a07b15402a030bf712fd2b65139f0382 (patch) | |
tree | 51c48808cb8df2723d682f304eac732e66dfa43b /Tools/CCode | |
parent | a7593b363b6645ffddf5582fea77e8716f0cddf1 (diff) | |
download | edk2-platforms-2e7ddad2a07b15402a030bf712fd2b65139f0382.tar.xz |
Modified to strip leading white-space characters and ignore blank or comment only lines
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4080 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/CCode')
-rw-r--r-- | Tools/CCode/Source/FlashMap/Microcode.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Tools/CCode/Source/FlashMap/Microcode.c b/Tools/CCode/Source/FlashMap/Microcode.c index 23353254a4..84534e316f 100644 --- a/Tools/CCode/Source/FlashMap/Microcode.c +++ b/Tools/CCode/Source/FlashMap/Microcode.c @@ -30,6 +30,8 @@ Abstract: #define MAX_LINE_LEN 256
+#define STATUS_IGNORE 0xA
+
//
// Structure definition for a microcode header
//
@@ -120,6 +122,7 @@ Returns: {
char Line[MAX_LINE_LEN];
char *cptr;
+ unsigned int ctr;
Line[MAX_LINE_LEN - 1] = 0;
*Data = 0;
@@ -132,6 +135,17 @@ Returns: if (Line[MAX_LINE_LEN - 1] != 0) {
return STATUS_ERROR;
}
+
+ // Strip leading white-space characters (except carriage returns) from Line
+ //
+ if (isspace(Line[0]) && Line[0] != '\n') {
+ while (isspace(Line[0])) {
+ for (ctr = 0; ctr < strlen(Line); ctr++)
+ if (Line[ctr] != '\n')
+ Line[ctr] = Line[ctr + 1];
+ }
+ }
+
//
// Look for
// dd 000000001h ; comment
@@ -155,6 +169,12 @@ Returns: }
return STATUS_SUCCESS;
}
+ if (strlen(Line) == 1) {
+ return STATUS_IGNORE;
+ }
+ if (tolower(cptr[0]) == ';') {
+ return STATUS_IGNORE;
+ }
return STATUS_ERROR;
}
@@ -188,6 +208,7 @@ Returns: unsigned int Checksum;
char *Buffer;
char *Ptr;
+ char *OrigPtr;
unsigned int TotalSize;
Status = STATUS_ERROR;
@@ -212,6 +233,9 @@ Returns: if (Status == STATUS_SUCCESS) {
Size += sizeof (Data);
}
+ if (Status == STATUS_IGNORE) {
+ Status = STATUS_SUCCESS;
+ }
} while (Status == STATUS_SUCCESS);
//
// Error if no data.
@@ -237,12 +261,18 @@ Returns: //
fseek (InFptr, 0, SEEK_SET);
Ptr = Buffer;
+ OrigPtr = Ptr;
do {
+ OrigPtr = Ptr;
Status = MicrocodeReadData (InFptr, &Data);
if (Status == STATUS_SUCCESS) {
*(unsigned int *) Ptr = Data;
Ptr += sizeof (Data);
}
+ if (Status == STATUS_IGNORE) {
+ Ptr = OrigPtr;
+ Status = STATUS_SUCCESS;
+ }
} while (Status == STATUS_SUCCESS);
//
// Can't do much checking on the header because, per the spec, the
|