Commit 2d9275e4 authored by Sam Lantinga's avatar Sam Lantinga

Handle the case where the WAVE magic number was already read in a non-seekable

stream.  I don't know if the code works with non-seekable streams anyway, but
...

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40172
parent 9eab0ea2
...@@ -434,7 +434,13 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc, ...@@ -434,7 +434,13 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
/* Check the magic header */ /* Check the magic header */
RIFFchunk = SDL_ReadLE32(src); RIFFchunk = SDL_ReadLE32(src);
wavelen = SDL_ReadLE32(src); wavelen = SDL_ReadLE32(src);
WAVEmagic = SDL_ReadLE32(src); if ( wavelen == WAVE ) { /* The RIFFchunk has already been read */
WAVEmagic = wavelen;
wavelen = RIFFchunk;
RIFFchunk = RIFF;
} else {
WAVEmagic = SDL_ReadLE32(src);
}
if ( (RIFFchunk != RIFF) || (WAVEmagic != WAVE) ) { if ( (RIFFchunk != RIFF) || (WAVEmagic != WAVE) ) {
SDL_SetError("Unrecognized file type (not WAVE)"); SDL_SetError("Unrecognized file type (not WAVE)");
was_error = 1; was_error = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment