[Scummvm-devel] Major "bug" / misfeature in the Stream system

Max Horn max at quendi.de
Sat Sep 13 19:28:06 CEST 2008


Hi folks,

I just commited a big patch which modified the signature of our Stream  
(sub)classes a bit. Also, I tried to add some more extensive comments.

As a result, some externally developed engines, as well as some ports,  
my experience slight hiccups, which however should be easy to fix:  
Essentially, some things changed from uint32 to int32 and two methods  
now return a bool instead of being void. Specifically:


* the following SeekableReadStream methods changed their signature:
   pos() -> now returns int32 instead of uint32 (-1 can indicate error)
   size() -> now returns int32 instead of uint32 (-1 can indicate error)
   seek() -> now returns a bool (true if no error occured)

* the following WriteStream methods changed their signature:
   flush() -> now returns a bool (true if no error occured)


Also, as previously announced, this is planned:

* The following methods will change in behavior (eos & error  
handling); we need to clarify their docs for this, i guess
   read() -> different EOS handling: only set EOS after we failed to  
read bytes due to EOS; not just because there are no more waiting bytes.
   seek() -> specified to reset EOS flag, but *not* error flag
   ...


* We'll add two new methods:  err & clearErr; wjp is working on this.


For reference, the following Stream implementations may be affected:
   - StdioStream
   - all custom "stdio stream" clones
   - all custom save file impls
   - CompressedInSaveFile & CompressedOutSaveFile
     in backends/saves/compressed/compressed-saves.cpp
     -> aditionally, those could be turned into generic stream wrappers
   - MemoryStreams, BufferedStreams, SubStreams...
   - "ArjFile" in common/file.h  (should be changed to an Archive  
anyway)
   - "DataStream" in engines/gob/dataio.*
   - "ScummFile" and subclasses in engines/scumm/file*.h/.cpp
   - "Chunk" and subclasses in engines/scumm/smush/chunk.*
   - "Archive" in engines/parallaction/disk*.*
   - various savefile impls in backends/platform/: dc, ds, ps2 -- more?


Cheers,
Max




More information about the Scummvm-devel mailing list