From 067f0c8482ead7ce7ec4db049a9e701a1839a2eb Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 5 Nov 2016 03:53:59 -0400 Subject: [PATCH] Patched to compile on C89 compilers. --- src/audio/SDL_audiocvt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index 665e4e95e..4b97c56a5 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -258,7 +258,10 @@ SDL_BuildAudioTypeCVTToFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat src_fmt) } if (!SDL_AUDIO_ISFLOAT(src_fmt)) { + const Uint16 src_bitsize = SDL_AUDIO_BITSIZE(src_fmt); + const Uint16 dst_bitsize = 32; SDL_AudioFilter filter = NULL; + switch (src_fmt & ~SDL_AUDIO_MASK_ENDIAN) { case AUDIO_S8: filter = SDL_Convert_S8_to_F32; break; case AUDIO_U8: filter = SDL_Convert_U8_to_F32; break; @@ -271,8 +274,6 @@ SDL_BuildAudioTypeCVTToFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat src_fmt) return SDL_SetError("No conversion available for these formats"); } - const Uint16 src_bitsize = SDL_AUDIO_BITSIZE(src_fmt); - const Uint16 dst_bitsize = 32; cvt->filters[cvt->filter_index++] = filter; if (src_bitsize < dst_bitsize) { const int mult = (dst_bitsize / src_bitsize); @@ -281,6 +282,7 @@ SDL_BuildAudioTypeCVTToFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat src_fmt) } else if (src_bitsize > dst_bitsize) { cvt->len_ratio /= (src_bitsize / dst_bitsize); } + retval = 1; /* added a converter. */ }