summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2008-09-07 17:47:08 +0000
committerSimon Howard2008-09-07 17:47:08 +0000
commit93bbda69b51835fd9177deca0c706001ccb0a2a8 (patch)
treeb80e4f903a8c3ff221fc326f9a08f5981aa44fcc
parent74c5ffb989efc1cfb3243f314708ece4902e3bb7 (diff)
downloadchocolate-doom-93bbda69b51835fd9177deca0c706001ccb0a2a8.tar.gz
chocolate-doom-93bbda69b51835fd9177deca0c706001ccb0a2a8.tar.bz2
chocolate-doom-93bbda69b51835fd9177deca0c706001ccb0a2a8.zip
Strip out NUL characters from dehacked files; this makes the dehacked
patch with portal.wad load properly. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1208
-rw-r--r--src/deh_io.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/deh_io.c b/src/deh_io.c
index 77cc40a1..3386a6fa 100644
--- a/src/deh_io.c
+++ b/src/deh_io.c
@@ -142,7 +142,7 @@ char *DEH_ReadLine(deh_context_t *context)
int c;
int pos;
- for (pos=0; ; ++pos)
+ for (pos = 0;;)
{
c = DEH_GetChar(context);
@@ -153,11 +153,6 @@ char *DEH_ReadLine(deh_context_t *context)
return NULL;
}
- if (c == '\0')
- {
- return NULL;
- }
-
// cope with lines of any length: increase the buffer size
if (pos >= context->readbuffer_size)
@@ -172,9 +167,13 @@ char *DEH_ReadLine(deh_context_t *context)
context->readbuffer[pos] = '\0';
break;
}
- else
+ else if (c != '\0')
{
+ // normal character; don't allow NUL characters to be
+ // added.
+
context->readbuffer[pos] = (char) c;
+ ++pos;
}
}