src/audio/SDL_wave.c
changeset 171 02e27b705645
parent 0 74212992fb08
child 252 e8157fcb3114
--- 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;