From 07bd38679c306a8bdeb94d117aa60f82ea2efafe Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sun, 7 Oct 2018 10:57:01 +0300 Subject: [PATCH] backported SDLCALL updates. (from 2.0 branch commit aef7a1784ffd). --- SDL_mixer.h | 14 +++++++------- effect_position.c | 42 +++++++++++++++++++++--------------------- effect_stereoreverse.c | 4 ++-- fluidsynth.c | 4 ++-- mixer.c | 14 +++++++------- music.c | 8 ++++---- playwave.c | 2 +- 7 files changed, 44 insertions(+), 44 deletions(-) diff --git a/SDL_mixer.h b/SDL_mixer.h index 30bef045..d24bd4ab 100644 --- a/SDL_mixer.h +++ b/SDL_mixer.h @@ -200,19 +200,19 @@ extern DECLSPEC Mix_MusicType SDLCALL Mix_GetMusicType(const Mix_Music *music); This can be used to provide real-time visual display of the audio stream or add a custom mixer filter for the stream data. */ -extern DECLSPEC void SDLCALL Mix_SetPostMix(void (*mix_func) +extern DECLSPEC void SDLCALL Mix_SetPostMix(void (SDLCALL *mix_func) (void *udata, Uint8 *stream, int len), void *arg); /* Add your own music player or additional mixer function. If 'mix_func' is NULL, the default music player is re-enabled. */ -extern DECLSPEC void SDLCALL Mix_HookMusic(void (*mix_func) +extern DECLSPEC void SDLCALL Mix_HookMusic(void (SDLCALL *mix_func) (void *udata, Uint8 *stream, int len), void *arg); /* Add your own callback when the music has finished playing. This callback is only called if the music finishes naturally. */ -extern DECLSPEC void SDLCALL Mix_HookMusicFinished(void (*music_finished)(void)); +extern DECLSPEC void SDLCALL Mix_HookMusicFinished(void (SDLCALL *music_finished)(void)); /* Get a pointer to the user data for the current music hook */ extern DECLSPEC void * SDLCALL Mix_GetMusicHookData(void); @@ -225,7 +225,7 @@ extern DECLSPEC void * SDLCALL Mix_GetMusicHookData(void); * inside the audio callback, or SDL_mixer will explicitly lock the audio * before calling your callback. */ -extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (*channel_finished)(int channel)); +extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (SDLCALL *channel_finished)(int channel)); /* Special Effects API by ryan c. gordon. (icculus@icculus.org) */ @@ -249,7 +249,7 @@ extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (*channel_finished)(int ch * * DO NOT EVER call SDL_LockAudio() from your callback function! */ -typedef void (*Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata); +typedef void (SDLCALL *Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata); /* * This is a callback that signifies that a channel has finished all its @@ -260,7 +260,7 @@ typedef void (*Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata); * * DO NOT EVER call SDL_LockAudio() from your callback function! */ -typedef void (*Mix_EffectDone_t)(int chan, void *udata); +typedef void (SDLCALL *Mix_EffectDone_t)(int chan, void *udata); /* Register a special effect function. At mixing time, the channel data is @@ -611,7 +611,7 @@ extern DECLSPEC int SDLCALL Mix_GetSynchroValue(void); /* Set/Get/Iterate SoundFonts paths to use by supported MIDI backends */ extern DECLSPEC int SDLCALL Mix_SetSoundFonts(const char *paths); extern DECLSPEC const char* SDLCALL Mix_GetSoundFonts(void); -extern DECLSPEC int SDLCALL Mix_EachSoundFont(int (*function)(const char*, void*), void *data); +extern DECLSPEC int SDLCALL Mix_EachSoundFont(int (SDLCALL *function)(const char*, void*), void *data); /* Get the Mix_Chunk currently associated with a mixer channel Returns NULL if it's an invalid channel, or there's no chunk associated. diff --git a/effect_position.c b/effect_position.c index f7208776..4206c86b 100644 --- a/effect_position.c +++ b/effect_position.c @@ -98,7 +98,7 @@ void _Eff_PositionDeinit(void) /* This just frees up the callback-specific data. */ -static void _Eff_PositionDone(int channel, void *udata) +static void SDLCALL _Eff_PositionDone(int channel, void *udata) { if (channel < 0) { if (pos_args_global != NULL) { @@ -114,7 +114,7 @@ static void _Eff_PositionDone(int channel, void *udata) } -static void _Eff_position_u8(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_u8(int chan, void *stream, int len, void *udata) { volatile position_args *args = (volatile position_args *) udata; Uint8 *ptr = (Uint8 *) stream; @@ -151,7 +151,7 @@ static void _Eff_position_u8(int chan, void *stream, int len, void *udata) ptr++; } } -static void _Eff_position_u8_c4(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *udata) { volatile position_args *args = (volatile position_args *) udata; Uint8 *ptr = (Uint8 *) stream; @@ -235,7 +235,7 @@ static void _Eff_position_u8_c4(int chan, void *stream, int len, void *udata) } -static void _Eff_position_u8_c6(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_u8_c6(int chan, void *stream, int len, void *udata) { volatile position_args *args = (volatile position_args *) udata; Uint8 *ptr = (Uint8 *) stream; @@ -357,7 +357,7 @@ static void _Eff_position_u8_c6(int chan, void *stream, int len, void *udata) * in case the user has called Mix_SetPanning() or whatnot again while this * callback is running. */ -static void _Eff_position_table_u8(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_table_u8(int chan, void *stream, int len, void *udata) { volatile position_args *args = (volatile position_args *) udata; Uint8 *ptr = (Uint8 *) stream; @@ -406,7 +406,7 @@ static void _Eff_position_table_u8(int chan, void *stream, int len, void *udata) } -static void _Eff_position_s8(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_s8(int chan, void *stream, int len, void *udata) { volatile position_args *args = (volatile position_args *) udata; Sint8 *ptr = (Sint8 *) stream; @@ -438,7 +438,7 @@ static void _Eff_position_s8(int chan, void *stream, int len, void *udata) ptr++; } } -static void _Eff_position_s8_c4(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_s8_c4(int chan, void *stream, int len, void *udata) { volatile position_args *args = (volatile position_args *) udata; Sint8 *ptr = (Sint8 *) stream; @@ -484,7 +484,7 @@ static void _Eff_position_s8_c4(int chan, void *stream, int len, void *udata) } } } -static void _Eff_position_s8_c6(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_s8_c6(int chan, void *stream, int len, void *udata) { volatile position_args *args = (volatile position_args *) udata; Sint8 *ptr = (Sint8 *) stream; @@ -551,7 +551,7 @@ static void _Eff_position_s8_c6(int chan, void *stream, int len, void *udata) * in case the user has called Mix_SetPanning() or whatnot again while this * callback is running. */ -static void _Eff_position_table_s8(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_table_s8(int chan, void *stream, int len, void *udata) { volatile position_args *args = (volatile position_args *) udata; Sint8 *ptr = (Sint8 *) stream; @@ -601,7 +601,7 @@ static void _Eff_position_table_s8(int chan, void *stream, int len, void *udata) /* !!! FIXME : Optimize the code for 16-bit samples? */ -static void _Eff_position_u16lsb(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_u16lsb(int chan, void *stream, int len, void *udata) { volatile position_args *args = (volatile position_args *) udata; Uint16 *ptr = (Uint16 *) stream; @@ -626,7 +626,7 @@ static void _Eff_position_u16lsb(int chan, void *stream, int len, void *udata) } } } -static void _Eff_position_u16lsb_c4(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_u16lsb_c4(int chan, void *stream, int len, void *udata) { volatile position_args *args = (volatile position_args *) udata; Uint16 *ptr = (Uint16 *) stream; @@ -675,7 +675,7 @@ static void _Eff_position_u16lsb_c4(int chan, void *stream, int len, void *udata } } } -static void _Eff_position_u16lsb_c6(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_u16lsb_c6(int chan, void *stream, int len, void *udata) { volatile position_args *args = (volatile position_args *) udata; Uint16 *ptr = (Uint16 *) stream; @@ -739,7 +739,7 @@ static void _Eff_position_u16lsb_c6(int chan, void *stream, int len, void *udata } } -static void _Eff_position_s16lsb(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_s16lsb(int chan, void *stream, int len, void *udata) { /* 16 signed bits (lsb) * 2 channels. */ volatile position_args *args = (volatile position_args *) udata; @@ -768,7 +768,7 @@ static void _Eff_position_s16lsb(int chan, void *stream, int len, void *udata) } } } -static void _Eff_position_s16lsb_c4(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_s16lsb_c4(int chan, void *stream, int len, void *udata) { /* 16 signed bits (lsb) * 4 channels. */ volatile position_args *args = (volatile position_args *) udata; @@ -813,7 +813,7 @@ static void _Eff_position_s16lsb_c4(int chan, void *stream, int len, void *udata } } -static void _Eff_position_s16lsb_c6(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_s16lsb_c6(int chan, void *stream, int len, void *udata) { /* 16 signed bits (lsb) * 6 channels. */ volatile position_args *args = (volatile position_args *) udata; @@ -870,7 +870,7 @@ static void _Eff_position_s16lsb_c6(int chan, void *stream, int len, void *udata } } -static void _Eff_position_u16msb(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_u16msb(int chan, void *stream, int len, void *udata) { /* 16 signed bits (lsb) * 2 channels. */ volatile position_args *args = (volatile position_args *) udata; @@ -896,7 +896,7 @@ static void _Eff_position_u16msb(int chan, void *stream, int len, void *udata) } } } -static void _Eff_position_u16msb_c4(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_u16msb_c4(int chan, void *stream, int len, void *udata) { /* 16 signed bits (lsb) * 4 channels. */ volatile position_args *args = (volatile position_args *) udata; @@ -946,7 +946,7 @@ static void _Eff_position_u16msb_c4(int chan, void *stream, int len, void *udata } } } -static void _Eff_position_u16msb_c6(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_u16msb_c6(int chan, void *stream, int len, void *udata) { /* 16 signed bits (lsb) * 6 channels. */ volatile position_args *args = (volatile position_args *) udata; @@ -1011,7 +1011,7 @@ static void _Eff_position_u16msb_c6(int chan, void *stream, int len, void *udata } } -static void _Eff_position_s16msb(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_s16msb(int chan, void *stream, int len, void *udata) { /* 16 signed bits (lsb) * 2 channels. */ volatile position_args *args = (volatile position_args *) udata; @@ -1027,7 +1027,7 @@ static void _Eff_position_s16msb(int chan, void *stream, int len, void *udata) *(ptr++) = (Sint16) SDL_SwapBE16(swapr); } } -static void _Eff_position_s16msb_c4(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_s16msb_c4(int chan, void *stream, int len, void *udata) { /* 16 signed bits (lsb) * 4 channels. */ volatile position_args *args = (volatile position_args *) udata; @@ -1071,7 +1071,7 @@ static void _Eff_position_s16msb_c4(int chan, void *stream, int len, void *udata } } } -static void _Eff_position_s16msb_c6(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_position_s16msb_c6(int chan, void *stream, int len, void *udata) { /* 16 signed bits (lsb) * 6 channels. */ volatile position_args *args = (volatile position_args *) udata; diff --git a/effect_stereoreverse.c b/effect_stereoreverse.c index a18ee9c0..e599e71c 100644 --- a/effect_stereoreverse.c +++ b/effect_stereoreverse.c @@ -55,7 +55,7 @@ * Stereo reversal effect...this one's pretty straightforward... */ -static void _Eff_reversestereo16(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_reversestereo16(int chan, void *stream, int len, void *udata) { /* 16 bits * 2 channels. */ Uint32 *ptr = (Uint32 *) stream; @@ -67,7 +67,7 @@ static void _Eff_reversestereo16(int chan, void *stream, int len, void *udata) } -static void _Eff_reversestereo8(int chan, void *stream, int len, void *udata) +static void SDLCALL _Eff_reversestereo8(int chan, void *stream, int len, void *udata) { /* 8 bits * 2 channels. */ Uint32 *ptr = (Uint32 *) stream; diff --git a/fluidsynth.c b/fluidsynth.c index 41978d18..717d8aad 100644 --- a/fluidsynth.c +++ b/fluidsynth.c @@ -34,7 +34,7 @@ static Uint16 format; static Uint8 channels; static int freq; -int fluidsynth_check_soundfont(const char *path, void *data) +int SDLCALL fluidsynth_check_soundfont(const char *path, void *data) { FILE *file = fopen(path, "r"); @@ -47,7 +47,7 @@ int fluidsynth_check_soundfont(const char *path, void *data) } } -int fluidsynth_load_soundfont(const char *path, void *data) +int SDLCALL fluidsynth_load_soundfont(const char *path, void *data) { /* If this fails, it's too late to try Timidity so pray that at least one works. */ fluidsynth.fluid_synth_sfload((fluid_synth_t*) data, path, 1); diff --git a/mixer.c b/mixer.c index 5173f9a5..833a2184 100644 --- a/mixer.c +++ b/mixer.c @@ -86,11 +86,11 @@ static int reserved_channels = 0; /* Support for hooking into the mixer callback system */ -static void (*mix_postmix)(void *udata, Uint8 *stream, int len) = NULL; +static void (SDLCALL *mix_postmix)(void *udata, Uint8 *stream, int len) = NULL; static void *mix_postmix_data = NULL; /* rcg07062001 callback to alert when channels are done playing. */ -static void (*channel_done_callback)(int channel) = NULL; +static void (SDLCALL *channel_done_callback)(int channel) = NULL; /* Music function declarations */ extern int open_music(SDL_AudioSpec *mixer); @@ -98,8 +98,8 @@ extern void close_music(void); /* Support for user defined music functions, plus the default one */ extern int volatile music_active; -extern void music_mixer(void *udata, Uint8 *stream, int len); -static void (*mix_music)(void *udata, Uint8 *stream, int len) = music_mixer; +extern void SDLCALL music_mixer(void *udata, Uint8 *stream, int len); +static void (SDLCALL *mix_music)(void *udata, Uint8 *stream, int len) = music_mixer; static void *music_data = NULL; /* rcg06042009 report available decoders at runtime. */ @@ -760,7 +760,7 @@ void Mix_FreeChunk(Mix_Chunk *chunk) This can be used to provide real-time visual display of the audio stream or add a custom mixer filter for the stream data. */ -void Mix_SetPostMix(void (*mix_func) +void Mix_SetPostMix(void (SDLCALL *mix_func) (void *udata, Uint8 *stream, int len), void *arg) { SDL_LockAudio(); @@ -772,7 +772,7 @@ void Mix_SetPostMix(void (*mix_func) /* Add your own music player or mixer function. If 'mix_func' is NULL, the default music player is re-enabled. */ -void Mix_HookMusic(void (*mix_func)(void *udata, Uint8 *stream, int len), +void Mix_HookMusic(void (SDLCALL *mix_func)(void *udata, Uint8 *stream, int len), void *arg) { SDL_LockAudio(); @@ -791,7 +791,7 @@ void *Mix_GetMusicHookData(void) return(music_data); } -void Mix_ChannelFinished(void (*channel_finished)(int channel)) +void Mix_ChannelFinished(void (SDLCALL *channel_finished)(int channel)) { SDL_LockAudio(); channel_done_callback = channel_finished; diff --git a/music.c b/music.c index 541769ef..dfc15d49 100644 --- a/music.c +++ b/music.c @@ -181,9 +181,9 @@ static void music_internal_halt(void); /* Support for hooking when the music has finished */ -static void (*music_finished_hook)(void) = NULL; +static void (SDLCALL *music_finished_hook)(void) = NULL; -void Mix_HookMusicFinished(void (*music_finished)(void)) +void Mix_HookMusicFinished(void (SDLCALL *music_finished)(void)) { SDL_LockAudio(); music_finished_hook = music_finished; @@ -231,7 +231,7 @@ static int music_halt_or_loop (void) /* Mixing function */ -void music_mixer(void *udata, Uint8 *stream, int len) +void SDLCALL music_mixer(void *udata, Uint8 *stream, int len) { int left = 0; @@ -1567,7 +1567,7 @@ const char* Mix_GetSoundFonts(void) } } -int Mix_EachSoundFont(int (*function)(const char*, void*), void *data) +int Mix_EachSoundFont(int (SDLCALL *function)(const char*, void*), void *data) { char *context, *path, *paths; const char* cpaths = Mix_GetSoundFonts(); diff --git a/playwave.c b/playwave.c index c0b73ef6..7d211541 100644 --- a/playwave.c +++ b/playwave.c @@ -134,7 +134,7 @@ static void test_versions(void) #ifdef TEST_MIX_CHANNELFINISHED /* rcg06072001 */ static volatile int channel_is_done = 0; -static void channel_complete_callback(int chan) +static void SDLCALL channel_complete_callback (int chan) { Mix_Chunk *done_chunk = Mix_GetChunk(chan); fprintf(stderr, "We were just alerted that Mixer channel #%d is done.\n", chan);