changeset 171:02e27b705645

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 ...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 11 Sep 2001 18:52:45 +0000
parents 9427fb48592a
children 37e3ca9254c7
files src/audio/SDL_wave.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/audio/SDL_wave.c	Tue Sep 04 23:22:23 2001 +0000
+++ b/src/audio/SDL_wave.c	Tue Sep 11 18:52:45 2001 +0000
@@ -434,7 +434,13 @@
 	/* 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;