# HG changeset patch # User Sam Lantinga # Date 1000234365 0 # Node ID 02e27b705645523f9bf1747cefc41f18a5234103 # Parent 9427fb48592a4eef053b3e90f882332b60dbb464 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 ... diff -r 9427fb48592a -r 02e27b705645 src/audio/SDL_wave.c --- a/src/audio/SDL_wave.c Tue Sep 04 23:22:23 2001 +0000 +++ b/src/audio/SDL_wave.c Tue Sep 11 18:52:45 2001 +0000 @@ -434,7 +434,13 @@ /* Check the magic header */ RIFFchunk = 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) ) { SDL_SetError("Unrecognized file type (not WAVE)"); was_error = 1;