Pārlūkot izejas kodu

Clear the wave format so the channel map is cleared before returning from SDL_LoadWAV_IO()

Sam Lantinga 9 mēneši atpakaļ
vecāks
revīzija
e559b271b5
1 mainītis faili ar 10 papildinājumiem un 3 dzēšanām
  1. 10 3
      src/audio/SDL_wave.c

+ 10 - 3
src/audio/SDL_wave.c

@@ -2080,6 +2080,16 @@ int SDL_LoadWAV_IO(SDL_IOStream *src, SDL_bool closeio, SDL_AudioSpec *spec, Uin
     int result = -1;
     WaveFile file;
 
+    if (spec) {
+        SDL_zerop(spec);
+    }
+    if (audio_buf) {
+        *audio_buf = NULL;
+    }
+    if (audio_len) {
+        *audio_len = 0;
+    }
+
     /* Make sure we are passed a valid data source */
     if (!src) {
         goto done;  /* Error may come from SDL_IOStream. */
@@ -2094,9 +2104,6 @@ int SDL_LoadWAV_IO(SDL_IOStream *src, SDL_bool closeio, SDL_AudioSpec *spec, Uin
         goto done;
     }
 
-    *audio_buf = NULL;
-    *audio_len = 0;
-
     SDL_zero(file);
     file.riffhint = WaveGetRiffSizeHint();
     file.trunchint = WaveGetTruncationHint();