Commit Graph

96 Commits

Author SHA1 Message Date
Alexander Tkachev
7a89caac84 COMMON: Add WriteStream::pos()
It returns int32, because some complex streams are derived from both
WriteStream and ReadStream, and in ReadStream pos() returns int32,
because -1 means an error.

I had to change MemoryStream's uint32 to int32, which is probably not so
good.
2016-08-04 14:36:21 +06:00
Johannes Schickel
eb4d1a6925 COMMON: Add missing readUint64/readSint64 to ReadStreamEndian. 2015-01-04 21:09:32 +01:00
Eugene Sandulenko
7865c78211 COMMON: Put more 64-bit stuff under HAVE_INT64 2015-01-04 20:47:12 +01:00
Adrian Astley
d497b45b1c COMMON: Fix typo that caused uint64 reads to return a uint32 2014-12-21 03:58:58 -06:00
Adrian Astley
c58f714610 COMMON: Add support for endian-safe reading/writing of int64 2014-09-16 13:49:27 -05:00
Einar Johan Trøan Sømåen
b7c5ce879f COMMON: Fix some Doxygen comments that seem wrong. 2014-08-29 03:28:00 +02:00
Johannes Schickel
854e22b38b COMMON: Make GPL headers consistent in themselves. 2014-02-18 02:39:33 +01:00
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