[Scummvm-devel] ReadStream::ioFailed/EOF - StdioStream::read

sunmax at libero.it sunmax at libero.it
Sun Feb 22 20:35:05 CET 2009


Hi there,

> > you mentioned at the beginning POS > SIZE never succeeds.
> 
> I don't understand what you mean. If you set a flag, you don't have
> to check POS > SIZE anymore, but you can directly check that flag.

Yes, you still have: when you originally set the flag you need
to check for a condition (either POS > SIZE or POS >= SIZE).

What I meant for "mirroring" is that instead of checking again,
I just return the flag. Unluckily some bits and pieces of
ScummVM don't try to read past the file and expect the EOF to
be true. Which can only succeeds if we -don't- use the flag,
which is not updated in this case: we are at the EOF, but
nobody tried to read beyond it. So I had to revert that to
the original behaviour, which makes ioFailed fail cause it
sees EOS as an error.


> For more detailed feedback, please send your current file

the ioFailed is the one in ReadStream (common/stream.h)

    /**
     * DEPRECATED
     * Default implementation for backward compatibility
     */
    virtual bool ioFailed() { return (eos() || err());

See?

Used by indy4, unzip, etc. There are 2 conditions:

 eos : which I interpret as we are at the end of file

 err : "  "  we tried to read past the end of file

The eos part is causing the failures.

See my fileio.cpp attached. It's WIP.

Thanks!
 -max
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fileio.cpp
Type: text/x-c++src
Size: 8010 bytes
Desc: not available
URL: <http://lists.scummvm.org/pipermail/scummvm-devel/attachments/20090222/10604fb0/attachment.cpp>


More information about the Scummvm-devel mailing list