aboutsummaryrefslogtreecommitdiff
path: root/sound/decoders
diff options
context:
space:
mode:
authorJohannes Schickel2010-02-03 08:58:52 +0000
committerJohannes Schickel2010-02-03 08:58:52 +0000
commitc040eeca448394a607767a4f9020493aa50efea4 (patch)
tree97350d3948e69f40ff02b8bc86f7df8af72d9d0f /sound/decoders
parent5115c94f351e476f51763f256ca98023c84be6bd (diff)
downloadscummvm-rg350-c040eeca448394a607767a4f9020493aa50efea4.tar.gz
scummvm-rg350-c040eeca448394a607767a4f9020493aa50efea4.tar.bz2
scummvm-rg350-c040eeca448394a607767a4f9020493aa50efea4.zip
- Return 0 in makeVorbisStream and makeFlacStream, in case creating the stream failed.
- Add a TODO in the MP3 code for the same behavior. svn-id: r47841
Diffstat (limited to 'sound/decoders')
-rw-r--r--sound/decoders/flac.cpp8
-rw-r--r--sound/decoders/mp3.cpp1
-rw-r--r--sound/decoders/vorbis.cpp8
3 files changed, 15 insertions, 2 deletions
diff --git a/sound/decoders/flac.cpp b/sound/decoders/flac.cpp
index 93233e2cb5..a75873be64 100644
--- a/sound/decoders/flac.cpp
+++ b/sound/decoders/flac.cpp
@@ -729,7 +729,13 @@ void FlacInputStream::callWrapError(const ::FLAC__SeekableStreamDecoder *decoder
SeekableAudioStream *makeFlacStream(
Common::SeekableReadStream *stream,
DisposeAfterUse::Flag disposeAfterUse) {
- return new FlacInputStream(stream, disposeAfterUse);
+ SeekableAudioStream *s = new FlacInputStream(stream, disposeAfterUse);
+ if (s && s->endOfData()) {
+ delete s;
+ return 0;
+ } else {
+ return s;
+ }
}
} // End of namespace Audio
diff --git a/sound/decoders/mp3.cpp b/sound/decoders/mp3.cpp
index 3d183dc403..3791ad7a20 100644
--- a/sound/decoders/mp3.cpp
+++ b/sound/decoders/mp3.cpp
@@ -338,6 +338,7 @@ int MP3InputStream::readBuffer(int16 *buffer, const int numSamples) {
SeekableAudioStream *makeMP3Stream(
Common::SeekableReadStream *stream,
DisposeAfterUse::Flag disposeAfterUse) {
+ // TODO: Properly check whether creating the MP3 stream succeeded.
return new MP3InputStream(stream, disposeAfterUse);
}
diff --git a/sound/decoders/vorbis.cpp b/sound/decoders/vorbis.cpp
index 5899eaa1fd..5334240a90 100644
--- a/sound/decoders/vorbis.cpp
+++ b/sound/decoders/vorbis.cpp
@@ -244,7 +244,13 @@ bool VorbisInputStream::refill() {
SeekableAudioStream *makeVorbisStream(
Common::SeekableReadStream *stream,
DisposeAfterUse::Flag disposeAfterUse) {
- return new VorbisInputStream(stream, disposeAfterUse);
+ SeekableAudioStream *s = new VorbisInputStream(stream, disposeAfterUse);
+ if (s && s->endOfData()) {
+ delete s;
+ return 0;
+ } else {
+ return s;
+ }
}
} // End of namespace Audio