From a21b5b30181ee3f63037fc5735966029e2c1fda2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 8 Jun 2019 19:09:43 -0700 Subject: [PATCH] Fixed build --- src/audio/SDL_audiocvt.c | 6 +++--- src/audio/SDL_wave.c | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index 49abe1d9cc101..3d0e22e350e6f 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -722,7 +722,7 @@ SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format int paddingsamples; float *padding; - if (requestedpadding < INT32_MAX / chans) { + if (requestedpadding < SDL_MAX_SINT32 / chans) { paddingsamples = requestedpadding * chans; } else { paddingsamples = 0; @@ -899,9 +899,9 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt, return SDL_SetError("Source rate is equal to or less than zero"); } else if (dst_rate <= 0) { return SDL_SetError("Destination rate is equal to or less than zero"); - } else if (src_rate >= INT32_MAX / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { + } else if (src_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { return SDL_SetError("Source rate is too high"); - } else if (dst_rate >= INT32_MAX / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { + } else if (dst_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { return SDL_SetError("Destination rate is too high"); } diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c index 5c3b964416ae0..ac2dfc1ed7617 100644 --- a/src/audio/SDL_wave.c +++ b/src/audio/SDL_wave.c @@ -641,7 +641,9 @@ MS_ADPCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len) size_t bytesleft, outputsize; WaveChunk *chunk = &file->chunk; ADPCM_DecoderState state = {0}; - MS_ADPCM_ChannelState cstate[2] = {0}; + MS_ADPCM_ChannelState cstate[2]; + + SDL_memset(cstate, 0, sizeof(cstate)); if (chunk->size != chunk->length) { /* Could not read everything. Recalculate number of sample frames. */ @@ -2075,7 +2077,9 @@ SDL_AudioSpec * SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len) { int result; - WaveFile file = {0}; + WaveFile file; + + SDL_zero(file); /* Make sure we are passed a valid data source */ if (src == NULL) {