mirror of
https://github.com/yawut/SDL.git
synced 2026-04-25 15:58:04 -05:00
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:
parent
f61baca1b7
commit
c91c0751a6
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user