[ scummvm-Bugs-2095303 ] COMMON: readLine_NEW fails to read last line in file
SourceForge.net
noreply at sourceforge.net
Fri Sep 5 18:23:14 CEST 2008
Bugs item #2095303, was opened at 2008-09-05 19:23
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=418820&aid=2095303&group_id=37116
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Ori Avtalion (salty-horse)
Assigned to: Nobody/Anonymous (nobody)
Summary: COMMON: readLine_NEW fails to read last line in file
Initial Comment:
Using latest svn r34343.
If the last "line" in a file doesn't end with a newline, readLine_NEW will return 0 instead of the real data.
In my case, I am opening a file with Common::File::open() and calling readLine_NEW on it.
Suppose the last characters of the file are 'a', 'b' followed by EOF.
readLine_NEW will execute "c = readByte();" in common/stream.cpp:166 twice.
After the third time, c will be '\0'.
It then gets to the check:
if (ioFailed() || (len == 0 && eos()))
return 0;
ioFailed() returns True and then 0 is returned, even if len > 0.
Maybe the real problem is ioFailed returning 'true' when nothing is actually failing.
It's set when readByte() calls File::read(&b, 1).
AFAIK, this doesn't actually cause any errors in existing engines. I've encountered it in my KoM engine.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=418820&aid=2095303&group_id=37116
More information about the Scummvm-tracker
mailing list