diff options
author | Simon Howard | 2008-09-23 23:12:03 +0000 |
---|---|---|
committer | Simon Howard | 2008-09-23 23:12:03 +0000 |
commit | fb176d6121a9313cd98cd015045d239ddfef3994 (patch) | |
tree | ca696ac4195e62bc46ba88c8500fd16eb87e1594 /src/doom/deh_io.c | |
parent | 350fe185784d6d0350ed8b675630440ff425a6ca (diff) | |
parent | 5bab2a788da04bd8aaa65891cb3fc7240d56a9b7 (diff) | |
download | chocolate-doom-fb176d6121a9313cd98cd015045d239ddfef3994.tar.gz chocolate-doom-fb176d6121a9313cd98cd015045d239ddfef3994.tar.bz2 chocolate-doom-fb176d6121a9313cd98cd015045d239ddfef3994.zip |
Merge updates from trunk.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1266
Diffstat (limited to 'src/doom/deh_io.c')
-rw-r--r-- | src/doom/deh_io.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/doom/deh_io.c b/src/doom/deh_io.c index 77cc40a1..3386a6fa 100644 --- a/src/doom/deh_io.c +++ b/src/doom/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; } } |