diff options
author | Oliver Kiehl | 2004-01-19 17:44:04 +0000 |
---|---|---|
committer | Oliver Kiehl | 2004-01-19 17:44:04 +0000 |
commit | 18799981aa8cba6e2fc5a1ed3127daeeb1881505 (patch) | |
tree | d08c9fb6aefa4d445d6ded5386f9cc242d20cac4 /simon | |
parent | 409c182b4ae3fe7d1b26204b5f8329834de1c9d9 (diff) | |
download | scummvm-rg350-18799981aa8cba6e2fc5a1ed3127daeeb1881505.tar.gz scummvm-rg350-18799981aa8cba6e2fc5a1ed3127daeeb1881505.tar.bz2 scummvm-rg350-18799981aa8cba6e2fc5a1ed3127daeeb1881505.zip |
fix mp3 and vorbis specific bug in which sound files could have been read
as zero-byte files in the case that two following offsets pointed to the
same file.
svn-id: r12509
Diffstat (limited to 'simon')
-rw-r--r-- | simon/sound.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/simon/sound.cpp b/simon/sound.cpp index 011027879b..1fca707b40 100644 --- a/simon/sound.cpp +++ b/simon/sound.cpp @@ -203,7 +203,11 @@ void MP3Sound::playSound(uint sound, PlayingSoundHandle *handle, byte flags) _file->seek(_offsets[sound], SEEK_SET); - uint32 size = _offsets[sound+1] - _offsets[sound]; + int i = 1; + while (_offsets[sound + i] == _offsets[sound]) + i++; + + uint32 size = _offsets[sound + i] - _offsets[sound]; _mixer->playMP3(handle, _file, size); } @@ -223,7 +227,11 @@ void VorbisSound::playSound(uint sound, PlayingSoundHandle *handle, byte flags) _file->seek(_offsets[sound], SEEK_SET); - uint32 size = _offsets[sound+1] - _offsets[sound]; + int i = 1; + while (_offsets[sound + i] == _offsets[sound]) + i++; + + uint32 size = _offsets[sound + i] - _offsets[sound]; _mixer->playVorbis(handle, _file, size); } |