Fixed corrupted reads due to CRLF->LF conversion; newlines in fprintf()s

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2326 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2006-04-26 00:13:59 +00:00
parent e25c800649
commit 5b2c9cc123
+3 -3
View File
@@ -115,7 +115,7 @@ Alist_New_FromFile (uio_Stream *f)
return NULL; return NULL;
} }
ReadResFile (data, 1, flen, f); flen = ReadResFile (data, 1, flen, f);
data[flen] = '\0'; data[flen] = '\0';
m = Alist_New_FromString (data); m = Alist_New_FromString (data);
@@ -161,12 +161,12 @@ Alist_New_FromString (char *d)
while ((i < len) && (d[i] != '=') && while ((i < len) && (d[i] != '=') &&
(d[i] != '\n') && (d[i] != '#')) i++; (d[i] != '\n') && (d[i] != '#')) i++;
if (i >= len) { /* Bare key at EOF */ if (i >= len) { /* Bare key at EOF */
fprintf (stderr, "Warning: Bare keyword at EOF"); fprintf (stderr, "Warning: Bare keyword at EOF\n");
break; break;
} }
/* Comments here mean incomplete line too */ /* Comments here mean incomplete line too */
if (d[i] != '=') { if (d[i] != '=') {
fprintf (stderr, "Warning: Key without value"); fprintf (stderr, "Warning: Key without value\n");
while ((i < len) && (d[i] != '\n')) i++; while ((i < len) && (d[i] != '\n')) i++;
if (i >= len) break; if (i >= len) break;
continue; /* Back to keyword search */ continue; /* Back to keyword search */