aboutsummaryrefslogtreecommitdiff
path: root/common/stream.cpp
AgeCommit message (Collapse)Author
2018-05-10COMMON: Use nullptr instead of NULL or 0 where appropriateBastien Bouclet
2018-04-15JANITORIAL: Fix whitespaceAdrian Frühwirth
2017-01-14COMMON: Add ReadStream::readPascalString()Eugene Sandulenko
2016-10-26COMMON: Added debug method for printing out stream contentsEugene Sandulenko
2016-08-04COMMON: Add WriteStream::pos()Alexander Tkachev
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.
2014-02-18COMMON: Make GPL headers consistent in themselves.Johannes Schickel
2013-01-28Merge pull request #305 from giucam/bufferedseekableJohannes Schickel
Make BufferedSeekableReadStream use the buffer with SEEK_SET and SEEK_END
2013-01-28COMMON: Fix successive seeks in BufferedSeekableReadStream.Johannes Schickel
This fixes the failing test case added in da8eeb9dbed2102764b3ca0697d6882bae0402cc. Thanks to wjp for his input on this.
2013-01-26JANITORIAL: Use "End of anonymous namespace" as comment for anonymous ↵Johannes Schickel
namespaces.
2013-01-26JANITORIAL: Enforce "} // End of namespace" with a single space after }.Johannes Schickel
2013-01-26COMMON: Make BufferedSeekableReadStream use the buffer with SEEK_SET and ↵Giulio Camuffo
SEEK_END
2012-03-11COMMON: Rename SafeSubReadStream to SafeSeekableSubReadStream.Johannes Schickel
It actually inherits from SeekableSubReadStream, so it should be named accordingly.
2011-08-07COMMON: Add DisposablePtr<T>, which replaces many repeated implementations ↵Christoph Mallon
of a dispose flag.
2011-05-12GIT: Clean up: Suppress SVN tags, now uselessstrangerke
2011-05-06COMMON: Add a class SafeSubReadStreamSven Hesse
SafeSubReadStream is basically a SeekableSubReadStream that re-seek()s the parent stream before each read(). That way, more than one SafeSubReadStream of the same parent stream can be used safely at the same time, at the cost of increasing IO.
2011-04-28JANITORIAL: Reduce header dependencies in shared codeOri Avtalion
Some backends may break as I only compiled SDL
2011-04-19COMMON: Do not call ReadStream::eos in SubReadStream::read.Johannes Schickel
Instead I moved the call to ReadStream::eos into SubReadStream::eos. fuzzie pointed out that in certain cases this resulted in a lot of eos calls before. Those were rather needlessly, since checking the eos bit of the decorated stream in read does not give any advantage over checking it when the client code really wants to test the eos flag.
2010-11-23COMMON: Remove XOR decoding capability from MemoryReadStreamMax Horn
svn-id: r54436
2010-11-19COMMON: Split common/stream.h into several headersMax Horn
svn-id: r54385
2010-11-18COMMON: Change wrapBufferedWriteStream() to always disposes wrapped streamMax Horn
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-18COMMON: Turn BufferedWriteStream into a template class, with ↵Max Horn
disposeParentStream as param svn-id: r54336
2010-11-18COMMON: Make implementation of Buffered*Stream classes internalMax Horn
svn-id: r54326
2010-11-18COMMON: Fix incorrect use of assert() macroMax Horn
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-10-12JANITORAL: Clean trailing whitespaces.Jordi Vilalta Prat
svn-id: r53160
2010-09-14COMMON: remove virtual functions from BufferedStreamsYotam Barnoy
As Max pointed out to me, they don't work as expected when called from constructors/destructors. svn-id: r52724
2010-08-25COMMON: Fix eos handling in BufferedReadStreamWillem Jan Palenstijn
This makes it pass the test added in r52382. svn-id: r52389
2010-08-25COMMON: fixed EOS handling in BufferedReadStream and BufferedSeekableReadStreamYotam Barnoy
EOS problem was causing Discworld to crash and zip files not to load on the PSP. svn-id: r52377
2010-08-24COMMON: implemented BufferedWriteStream and fixed bug in BufferedReadStreamYotam Barnoy
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-06-15Fix spelling, cleanupMax Horn
svn-id: r49843
2010-06-15Added seek() method to MemoryWriteStreamDynamic.Eugene Sandulenko
If it deserves a separate class, shout. svn-id: r49750
2009-12-30Rename Common::Stream::readLine_NEW to readLineMax Horn
svn-id: r46779
2009-10-18Introduced new type Common::DisposeAfterUse::FlagMax Horn
svn-id: r45233
2009-09-30Fix code formatting (esp. 'if(' -> 'if (' etc., but also indention and other ↵Max Horn
things) svn-id: r44495
2009-05-04Fix valgrind warningEugene Sandulenko
svn-id: r40309
2009-03-05Fix for bug #2664460: Various SeekableReadStream::seek() implementations (as ↵Max Horn
well as our unit tests, ouch) handled SEEK_END incorrectly (using -offset instead of offset), contrary to what the docs said and what fseek does. Hopefully I found and fixed all affected parts, but still watch out for regressions svn-id: r39135
2008-12-22Fixed indentation and removed whitespaces at the end of lineJordi Vilalta Prat
svn-id: r35481
2008-12-03Get rid of readLine_OLD for goodMax Horn
svn-id: r35229
2008-09-14Big patch changing semantics of ReadStream::eos():Willem Jan Palenstijn
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-13Big patch changing the signature of various Stream methods (some ports may ↵Max Horn
need to be slightly tweaked to fix overloading errors/warnings) svn-id: r34514
2008-09-06Added some unit tests for Stream::readLine_NEW, and clarified that ↵Max Horn
readLine_NEW is essentially fgets in disguise svn-id: r34384
2008-09-03Fixed Stream::readLine implementation to match its doxygen commentMax Horn
svn-id: r34316
2008-09-03Renamed SeekableReadStream::readLine to SeekableReadStream::readLine_OLD; ↵Max Horn
added a new alternate SeekableReadStream::readLine() instead svn-id: r34315
2008-07-30Changed BufferedReadStream to not permanently decrease its buffer size at ↵Max Horn
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-29Added two new classes, BufferedReadStream & BufferedSeekableReadStream, as ↵Max Horn
proposed on scummvm-devel svn-id: r33419
2008-07-21Silence a warning which complains about using an uninitialized variable.Kari Salminen
svn-id: r33169
2008-07-20New SeekableReadStream::readLine_NEW() method, closely modelled after fgets, ↵Max Horn
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
2007-09-19Merged common/stdafx.h into common/scummsys.h. All referencing files have ↵Nicola Mettifogo
been updated. svn-id: r28966
2007-05-30Updated legal headers in source files, based on what Pidgin (the IM client ↵Max Horn
formerly knowns as Gaim) does; added new (incomplete) COPYRIGHT file; updated copyright dates in a few spots svn-id: r27024
2007-02-20Added new ReadStream::readStream method which can be used to read a portion ↵Max Horn
of an arbitrary ReadStream into a memory buffer wrapped by a MemoryReadStream svn-id: r25754
2007-02-19Enhance (Seekable)SubReadStream so be able to (optionally) dispose the ↵Max Horn
parent stream after it's been used (simplifies memory management for client code) svn-id: r25732