diff options
author | Fabian Greffrath | 2015-04-21 07:46:16 +0200 |
---|---|---|
committer | Fabian Greffrath | 2015-04-21 07:46:16 +0200 |
commit | 51d5fc29b0b7cda79b593e499ff67a5960f6055b (patch) | |
tree | 93a4db9fd0c9824c9587a8799265b39bfe2a0968 /src/heretic/r_data.c | |
parent | ec72b141f47cd1a5b061f9bc87c1a02e2722be59 (diff) | |
download | chocolate-doom-51d5fc29b0b7cda79b593e499ff67a5960f6055b.tar.gz chocolate-doom-51d5fc29b0b7cda79b593e499ff67a5960f6055b.tar.bz2 chocolate-doom-51d5fc29b0b7cda79b593e499ff67a5960f6055b.zip |
deh: fix parsing of last lines in files without newline at EOF
Chocolate Doom fails to properly parse the last line in DEHACKED files
that are missing a newline character at the end of the file (which
might have been a common sickness to DOS editors).
This is, because DEH_GetChar() returns -1 at EOF and DEH_ReadLine() in
turn immediately returns NULL if the result of (DEH_GetChar() < 0),
regardless of the content of the readbuffer. It only returns a pointer
to the content of the readbuffer if DEH_GetChar() returns '\n' which
is, however, impossible if there is no such character before the file
ends.
Now DEH_ReadLine() only returns NULL if the readbuffer is empty at the
end of the file and returns a valid pointer else.
Fixes #531
Diffstat (limited to 'src/heretic/r_data.c')
0 files changed, 0 insertions, 0 deletions