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

This commit is contained in:
Sam Lantinga
2024-07-05 12:44:25 -07:00
parent c347bee7b8
commit e559b271b5

View File

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