Commit Graph

89 Commits

Author SHA1 Message Date
Johannes Schickel
b4d0a8ba66 JANITORIAL: Enforce "} // End of namespace" with a single space after }. 2013-01-26 19:38:02 +01:00
Max Horn
904739cc00 COMMON: Document that Stream API is meant to imitate ISO C FILE semantics 2011-05-18 13:06:41 +02:00
strangerke
69b1485a22 GIT: Clean up: Suppress SVN tags, now useless 2011-05-12 01:16:22 +02:00
Ori Avtalion
9414d7a6e2 JANITORIAL: Reduce header dependencies in shared code
Some backends may break as I only compiled SDL
2011-04-28 15:08:58 +03:00
Matthew Hoops
34db1820eb COMMON: Add an isBE() function to get the endianness of a ReadStreamEndian
svn-id: r54500
2010-11-26 15:06:25 +00:00
Max Horn
1cc80de1d9 COMMON: Add SeekableReadStreamEndian class
svn-id: r54445
2010-11-23 22:33:10 +00:00
Max Horn
12d5151ff4 COMMON: Remove default value for endianess in ReadStreamEndian subclasses
svn-id: r54441
2010-11-23 22:27:20 +00:00
Max Horn
382982d6e3 COMMON: Add ReadStreamEndian mixin class
svn-id: r54438
2010-11-23 22:26:27 +00:00
Max Horn
2180b2d6b5 COMMON: Split common/stream.h into several headers
svn-id: r54385
2010-11-19 17:03:07 +00:00
Max Horn
9fb1e2b17e COMMON: Change wrapBufferedWriteStream() to always disposes wrapped stream
This is the only we need right now, and it saves a few bytes per
instance. The template approach I used before has the drawback that it
increases the binary size, which negates the benefit. Thanks to LordHoto
for pointing this out.

svn-id: r54344
2010-11-18 20:27:15 +00:00
Max Horn
152e52d015 COMMON: Make implementation of Buffered*Stream classes internal
svn-id: r54326
2010-11-18 17:02:51 +00:00
Max Horn
4707b610fc COMMON: Fix incorrect use of assert() macro
The assert() macro may be compiled to be empty. In that case, its
arguments are *NOT* evaluated. Hence, things like
  assert(doSomething())
must not be used whenever doSomething() has important side effects.

Also document BufferedWriteStream::flushBuffer() and explain why it
exists parallel to BufferedWriteStream::flush().

svn-id: r54322
2010-11-18 16:08:56 +00:00
Jordi Vilalta Prat
8388e0dfea JANITORAL: Clean trailing whitespaces.
svn-id: r53160
2010-10-12 02:18:11 +00:00
Yotam Barnoy
94b41f5d2e COMMON: remove virtual functions from BufferedStreams
As Max pointed out to me, they don't work as expected when called from constructors/destructors.

svn-id: r52724
2010-09-14 14:57:30 +00:00
Willem Jan Palenstijn
9dfb24851c COMMON: Remove dangerous virtual keywords.
See r52722.

svn-id: r52723
2010-09-14 14:18:25 +00:00
Willem Jan Palenstijn
05c2cc4d1d COMMON: Fix eos handling in BufferedReadStream
This makes it pass the test added in r52382.

svn-id: r52389
2010-08-25 14:43:42 +00:00
Yotam Barnoy
4368d3c574 COMMON: fixed EOS handling in BufferedReadStream and BufferedSeekableReadStream
EOS problem was causing Discworld to crash and zip files not to load on the PSP.

svn-id: r52377
2010-08-25 09:14:41 +00:00
Yotam Barnoy
efdbb076a2 COMMON: implemented BufferedWriteStream and fixed bug in BufferedReadStream
I need the write buffering for the new version of the PSP streams and thought the simplest way to implement it would be along the lines of BufferedReadStream. Sadly, I found a nasty little bug in BRS but that's taken care of.
Also, I adapted these streams for target-specific memory allocation by using virtual functions for allocation/deallocation.

svn-id: r52325
2010-08-24 11:18:48 +00:00
Eugene Sandulenko
024f492137 Added seek() method to MemoryWriteStreamDynamic.
If it deserves a separate class, shout.

svn-id: r49750
2010-06-15 10:34:14 +00:00
Max Horn
bbaf98127d correct typo
svn-id: r49270
2010-05-27 20:59:15 +00:00
Max Horn
0cf53b025d Move DisposeAfterUse::Flag from Common to global namespace, and into a new header common/types.h
svn-id: r47180
2010-01-08 22:07:35 +00:00
Matthew Hoops
85787988a0 Remove the getBeginOffset() hack from Common::SeekableReadStream and introduce QTPlayer::setChunkBeginOffset() to allow specifying what offset to use.
svn-id: r46786
2009-12-31 00:37:40 +00:00
Max Horn
d083e02215 Rename Common::Stream::readLine_NEW to readLine
svn-id: r46779
2009-12-30 23:00:55 +00:00
Max Horn
47f48dd912 spelling
svn-id: r46778
2009-12-30 23:00:22 +00:00
Eugene Sandulenko
fb8ecae7f1 Add Mohawk engine code. Part 2/3: common code changes.
svn-id: r46728
2009-12-29 23:20:23 +00:00
Max Horn
f692015301 Got rid of ReadStream::ioFailed()
svn-id: r46379
2009-12-15 08:18:57 +00:00
Max Horn
2bbf708dea Introduced new type Common::DisposeAfterUse::Flag
svn-id: r45233
2009-10-18 19:41:59 +00:00
Max Horn
1011508325 Slightly modified version of Patch #2838562: Improve endian.h and stream.h
svn-id: r44027
2009-09-11 08:55:47 +00:00
Matthew Hoops
05035fd8c3 Fix a new/free mismatch when creating a MemoryReadStream from a MemoryWriteStreamDynamic by changing MemoryWriteStreamDynamic to use malloc/free instead of new/delete[]. This could have affected ScummEngine_v4::prepareSavegame().
svn-id: r43918
2009-09-03 16:15:10 +00:00
Norbert Lange
54ef7a892b reverting changes from patch 43696 that shouldnt have been committed
svn-id: r43697
2009-08-24 13:08:21 +00:00
Norbert Lange
184aae3c8c Enable alternative palettse for Amiga Monkey Island - Patch ID: 2819787
use tables for palette colors instead of code with constants

svn-id: r43696
2009-08-24 12:39:03 +00:00
Johannes Schickel
b0a5ec8947 - Add note about that modifing the parent stream will mess up SeekableSubReadStream and SeekableSubReadStreamEndian.
- Link to SubReadStream documentation from SeekableSubReadStream and SeekableSubReadStreamEndian.

svn-id: r43465
2009-08-17 10:48:03 +00:00
Max Horn
eedce48aa3 Removed redundant File::ioFailed() implementation; also turned ReadStream::ioFailed from a virtual into an inline method
svn-id: r42911
2009-07-29 21:39:16 +00:00
Max Horn
65b5d31814 COMMON: Removed Stream::ioFailed() and clearIOFailed(), as they are deprecated; however, retained ioFailed in SeekableReadStream and File for now (so for now this mainly affects WriteStream subclasses)
svn-id: r40725
2009-05-19 11:42:14 +00:00
Torbjörn Andersson
7d4618d165 Fixed typo.
svn-id: r40121
2009-04-24 17:19:20 +00:00
Max Horn
9cbed926cd Moved Tinsel::Serializer to Common::Serializer, so that I can use it in the SCI engine
svn-id: r39428
2009-03-15 20:30:57 +00:00
Jordi Vilalta Prat
b1999a2a16 Fixed indentation and removed whitespaces at the end of line
svn-id: r35481
2008-12-22 11:22:15 +00:00
Max Horn
abae99d645 Get rid of readLine_OLD for good
svn-id: r35229
2008-12-03 22:55:30 +00:00
Max Horn
15959faf3e Fix SubReadStream by initing _eos to false in the constructor (spotted thanks to our unit tests)
svn-id: r34555
2008-09-15 10:05:36 +00:00
Willem Jan Palenstijn
c8eeae8d4d Big patch changing semantics of ReadStream::eos():
eos() now only returns true _after_ trying to read past the end of the stream.

This has a large potential for regressions. Please test!

svn-id: r34549
2008-09-14 22:28:53 +00:00
Max Horn
6574b2ad18 Fixed a typo & clarified a comment
svn-id: r34541
2008-09-14 21:26:59 +00:00
Max Horn
655ce26b3f Big patch changing the signature of various Stream methods (some ports may need to be slightly tweaked to fix overloading errors/warnings)
svn-id: r34514
2008-09-13 16:51:46 +00:00
Max Horn
6cb09e311a Added some unit tests for Stream::readLine_NEW, and clarified that readLine_NEW is essentially fgets in disguise
svn-id: r34384
2008-09-06 16:46:28 +00:00
Max Horn
57e724bfc3 Renamed SeekableReadStream::readLine to SeekableReadStream::readLine_OLD; added a new alternate SeekableReadStream::readLine() instead
svn-id: r34315
2008-09-03 17:53:25 +00:00
Max Horn
99f546caad Moved the OutSaveFile::finalize method to WriteStream; implemented DumpFile::flush()
svn-id: r33604
2008-08-04 11:30:47 +00:00
Nicola Mettifogo
aa2ffe047b Reordered initialization order to kill a ton of warnings.
svn-id: r33452
2008-07-30 15:01:15 +00:00
Max Horn
1e2988b7f7 Changed BufferedReadStream to not permanently decrease its buffer size at the end of a stream (this would fail when using BufferedSeekableReadStream and then seeking back from the end); this also fixes a bug which let you seek back beyond the start of a stream (not that we currently support that in other streams)
svn-id: r33436
2008-07-30 07:39:41 +00:00
Max Horn
aaa4d104f7 Added two new classes, BufferedReadStream & BufferedSeekableReadStream, as proposed on scummvm-devel
svn-id: r33419
2008-07-29 17:42:19 +00:00
Max Horn
f7ec115f08 New SeekableReadStream::readLine_NEW() method, closely modelled after fgets, w/o the line length limitations of the old eekableReadStream::readLine() (which it will replace, after the feature freeze has been lifted)
svn-id: r33139
2008-07-20 16:47:52 +00:00
Filippos Karapetis
8cc1539315 Added eriktorbjorn's MemoryWriteStreamDynamic class - a stream that grows as it's written to
svn-id: r31498
2008-04-13 23:46:55 +00:00