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
This commit is contained in:
parent
9eab0ea201
commit
2d9275e49a
1 changed files with 7 additions and 1 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue