Handle the case where the WAVE magic number was already read in a non-seekable
authorSam Lantinga
Tue, 11 Sep 2001 18:52:45 +0000
changeset 17102e27b705645
parent 170 9427fb48592a
child 172 37e3ca9254c7
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
...
src/audio/SDL_wave.c
     1.1 --- a/src/audio/SDL_wave.c	Tue Sep 04 23:22:23 2001 +0000
     1.2 +++ b/src/audio/SDL_wave.c	Tue Sep 11 18:52:45 2001 +0000
     1.3 @@ -434,7 +434,13 @@
     1.4  	/* Check the magic header */
     1.5  	RIFFchunk	= SDL_ReadLE32(src);
     1.6  	wavelen		= SDL_ReadLE32(src);
     1.7 -	WAVEmagic	= SDL_ReadLE32(src);
     1.8 +	if ( wavelen == WAVE ) { /* The RIFFchunk has already been read */
     1.9 +		WAVEmagic = wavelen;
    1.10 +		wavelen   = RIFFchunk;
    1.11 +		RIFFchunk = RIFF;
    1.12 +	} else {
    1.13 +		WAVEmagic = SDL_ReadLE32(src);
    1.14 +	}
    1.15  	if ( (RIFFchunk != RIFF) || (WAVEmagic != WAVE) ) {
    1.16  		SDL_SetError("Unrecognized file type (not WAVE)");
    1.17  		was_error = 1;