aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2009-07-14 18:24:20 +0000
committerMax Horn2009-07-14 18:24:20 +0000
commit6b98c4c4e7a23089a6cccba573a1c3afd909f52d (patch)
tree7bca862b8b3035e1b9ff054f67b8c83c891265c8 /sound
parent96abaaea6d06dae9bc1a48dc3b3afc936a92468b (diff)
downloadscummvm-rg350-6b98c4c4e7a23089a6cccba573a1c3afd909f52d.tar.gz
scummvm-rg350-6b98c4c4e7a23089a6cccba573a1c3afd909f52d.tar.bz2
scummvm-rg350-6b98c4c4e7a23089a6cccba573a1c3afd909f52d.zip
Got rid of some more ioFailed uses (also fixed a potential leak in graphics/font.cpp, and handle eos correctly in the FLAC code)
svn-id: r42488
Diffstat (limited to 'sound')
-rw-r--r--sound/flac.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/flac.cpp b/sound/flac.cpp
index 5b6a04b726..bb633b8352 100644
--- a/sound/flac.cpp
+++ b/sound/flac.cpp
@@ -402,21 +402,23 @@ int FlacInputStream::readBuffer(int16 *buffer, const int numSamples) {
}
inline ::FLAC__SeekableStreamDecoderReadStatus FlacInputStream::callbackRead(FLAC__byte buffer[], FLAC_size_t *bytes) {
- if (*bytes == 0)
+ if (*bytes == 0) {
#ifdef LEGACY_FLAC
return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; /* abort to avoid a deadlock */
#else
return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */
#endif
+ }
const uint32 bytesRead = _inStream->read(buffer, *bytes);
- if (bytesRead == 0 && _inStream->ioFailed())
+ if (bytesRead == 0) {
#ifdef LEGACY_FLAC
- return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR;
+ return _inStream->eos() ? FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK : FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR;
#else
- return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+ return _inStream->eos() ? FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM : FLAC__STREAM_DECODER_READ_STATUS_ABORT;
#endif
+ }
*bytes = static_cast<uint>(bytesRead);
#ifdef LEGACY_FLAC