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
...
This commit is contained in:
Sam Lantinga 2001-09-11 18:52:45 +00:00
parent f61baca1b7
commit c91c0751a6

View File

@ -434,7 +434,13 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
/* 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;