From 1a207a686cd1a1de63a7047506021c4a04229abd Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 21 Oct 2017 01:32:12 -0700 Subject: [PATCH] Fixed compiling on Windows --- effect_position.c | 4 ++-- effect_stereoreverse.c | 32 ++++++++++++++++---------------- mixer.c | 2 +- music_flac.c | 2 +- music_mikmod.c | 2 +- music_ogg.c | 17 +++++------------ music_wav.c | 5 ++++- 7 files changed, 30 insertions(+), 34 deletions(-) diff --git a/effect_position.c b/effect_position.c index cf37f897..3ec3a4ea 100644 --- a/effect_position.c +++ b/effect_position.c @@ -1405,7 +1405,7 @@ static void _Eff_position_f32sys_c4(int chan, void *stream, int len, void *udata float swapr = ((*(ptr+1) * args->right_f) * args->distance_f); float swaplr = ((*(ptr+2) * args->left_rear_f) * args->distance_f); float swaprr = ((*(ptr+3) * args->right_rear_f) * args->distance_f); - switch (args->room_angle) { + switch (args->room_angle) { case 0: *(ptr++) = swapl; *(ptr++) = swapr; @@ -1430,7 +1430,7 @@ static void _Eff_position_f32sys_c4(int chan, void *stream, int len, void *udata *(ptr++) = swaprr; *(ptr++) = swapr; break; - } + } } } static void _Eff_position_f32sys_c6(int chan, void *stream, int len, void *udata) diff --git a/effect_stereoreverse.c b/effect_stereoreverse.c index 0ccd00db..e495e716 100644 --- a/effect_stereoreverse.c +++ b/effect_stereoreverse.c @@ -59,13 +59,13 @@ static void _Eff_reversestereo32(int chan, void *stream, int len, void *udata) { /* 16 bits * 2 channels. */ Uint32 *ptr = (Uint32 *) stream; - Uint32 tmp; + Uint32 tmp; int i; for (i = 0; i < len; i += 2 * sizeof (Uint32), ptr += 2) { - tmp = ptr[0]; - ptr[0] = ptr[1]; - ptr[1] = tmp; + tmp = ptr[0]; + ptr[0] = ptr[1]; + ptr[1] = tmp; } } @@ -111,18 +111,18 @@ int Mix_SetReverseStereo(int channel, int flip) Mix_QuerySpec(NULL, &format, &channels); if (channels == 2) { - int bits = (format & 0xFF); - switch (bits) { - case 8: + int bits = (format & 0xFF); + switch (bits) { + case 8: f = _Eff_reversestereo8; - break; - case 16: + break; + case 16: f = _Eff_reversestereo16; - break; - case 32: + break; + case 32: f = _Eff_reversestereo32; - break; - default: + break; + default: Mix_SetError("Unsupported audio format"); return(0); } @@ -133,9 +133,9 @@ int Mix_SetReverseStereo(int channel, int flip) return(Mix_RegisterEffect(channel, f, NULL, NULL)); } } else { - Mix_SetError("Trying to reverse stereo on a non-stereo stream"); - return(0); - } + Mix_SetError("Trying to reverse stereo on a non-stereo stream"); + return(0); + } return(1); } diff --git a/mixer.c b/mixer.c index 547b67cf..38eb461b 100644 --- a/mixer.c +++ b/mixer.c @@ -592,7 +592,7 @@ static SDL_AudioSpec *Mix_LoadMusic_RW(Mix_MusicType music_type, SDL_RWops *src, if (interface->Play) { interface->Play(music, 1); - } + } playing = SDL_TRUE; while (playing) { diff --git a/music_flac.c b/music_flac.c index 94461335..babba16c 100644 --- a/music_flac.c +++ b/music_flac.c @@ -250,7 +250,7 @@ static FLAC__StreamDecoderWriteStatus flac_write_music_cb( { FLAC_Music *music = (FLAC_Music *)client_data; Sint16 *data; - int i, j, channels; + unsigned int i, j, channels; int shift_amount = 0; if (!music->stream) { diff --git a/music_mikmod.c b/music_mikmod.c index b847dc5d..c3d272fb 100644 --- a/music_mikmod.c +++ b/music_mikmod.c @@ -247,7 +247,7 @@ typedef struct int LMM_Seek(struct MREADER *mr,long to,int dir) { - Sint64 offset = to; + Sint64 offset = to; LMM_MREADER* lmmmr = (LMM_MREADER*)mr; if (dir == SEEK_SET) { offset += lmmmr->offset; diff --git a/music_ogg.c b/music_ogg.c index a6e2e735..f54cdda1 100644 --- a/music_ogg.c +++ b/music_ogg.c @@ -92,20 +92,13 @@ static int OGG_Load(void) FUNCTION_LOADER(ov_comment, vorbis_comment *(*)(OggVorbis_File *,int)) FUNCTION_LOADER(ov_open_callbacks, int (*)(void *, OggVorbis_File *, const char *, long, ov_callbacks)) FUNCTION_LOADER(ov_pcm_total, ogg_int64_t (*)(OggVorbis_File *,int)) - FUNCTION_LOADER(ov_read, #ifdef OGG_USE_TREMOR - long (*)(OggVorbis_File *,char *,int,int *) + FUNCTION_LOADER(ov_read, long (*)(OggVorbis_File *,char *,int,int *)) + FUNCTION_LOADER(ov_time_seek, long (*)(OggVorbis_File *,ogg_int64_t)) #else - long (*)(OggVorbis_File *,char *,int,int,int,int,int *) + FUNCTION_LOADER(ov_read, long (*)(OggVorbis_File *,char *,int,int,int,int,int *)) + FUNCTION_LOADER(ov_time_seek, int (*)(OggVorbis_File *,double)) #endif - ) - FUNCTION_LOADER(ov_time_seek, -#ifdef OGG_USE_TREMOR - long (*)(OggVorbis_File *,ogg_int64_t) -#else - int (*)(OggVorbis_File *,double) -#endif - ) FUNCTION_LOADER(ov_pcm_seek, int (*)(OggVorbis_File *,ogg_int64_t)) FUNCTION_LOADER(ov_pcm_tell, ogg_int64_t (*)(OggVorbis_File *)) } @@ -365,7 +358,7 @@ static int OGG_GetSome(void *context, void *data, int bytes, SDL_bool *done) pcmPos = vorbis.ov_pcm_tell(&music->vf); if ((music->loop == 1) && (pcmPos >= music->loop_end)) { - amount -= ((pcmPos - music->loop_end) * music->channels) * (long)sizeof(Sint16); + amount -= (int)((pcmPos - music->loop_end) * music->channels) * sizeof(Sint16); result = vorbis.ov_pcm_seek(&music->vf, music->loop_start); if (result < 0) { set_ov_error("ov_pcm_seek", result); diff --git a/music_wav.c b/music_wav.c index 41491dbf..f4e12c7e 100644 --- a/music_wav.c +++ b/music_wav.c @@ -184,7 +184,10 @@ static int WAV_Play(void *context, int play_count) loop->current_play_count = loop->initial_play_count; } music->play_count = play_count; - return SDL_RWseek(music->src, music->start, RW_SEEK_SET); + if (SDL_RWseek(music->src, music->start, RW_SEEK_SET) < 0) { + return -1; + } + return 0; } /* Play some of a stream previously started with WAV_Play() */