Skip to content

Commit

Permalink
Handle the case where the WAVE magic number was already read in a non…
Browse files Browse the repository at this point in the history
…-seekable

stream.  I don't know if the code works with non-seekable streams anyway, but
...
  • Loading branch information
slouken committed Sep 11, 2001
1 parent 1736896 commit c04171b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/audio/SDL_wave.c
Expand Up @@ -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;
Expand Down

0 comments on commit c04171b

Please sign in to comment.