Skip to content

Commit

Permalink
Specify SDLCALL as the calling convention for API callbacks.
Browse files Browse the repository at this point in the history
This is in parallel with bug #3745.
  • Loading branch information
sezero committed Oct 21, 2017
1 parent 283a34f commit a0ee3d7
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 54 deletions.
14 changes: 7 additions & 7 deletions SDL_mixer.h
Expand Up @@ -205,17 +205,17 @@ 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)(void *udata, Uint8 *stream, int len), void *arg);
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)(void *udata, Uint8 *stream, int len), void *arg);
extern DECLSPEC void SDLCALL Mix_HookMusic(void (SDLCALL *mix_func)(void *udata, Uint8 *stream, int len), void *arg);

/* Add your own callback for when the music has finished playing or when it is
* stopped from a call to Mix_HaltMusic.
*/
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);
Expand All @@ -228,7 +228,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) */
Expand All @@ -252,7 +252,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
Expand All @@ -263,7 +263,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
Expand Down Expand Up @@ -613,7 +613,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.
Expand Down
60 changes: 30 additions & 30 deletions effect_position.c
Expand Up @@ -99,7 +99,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) {
Expand All @@ -115,7 +115,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;
Expand Down Expand Up @@ -152,7 +152,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;
Expand Down Expand Up @@ -236,7 +236,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;
Expand Down Expand Up @@ -358,7 +358,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;
Expand Down Expand Up @@ -407,7 +407,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;
Expand Down Expand Up @@ -439,7 +439,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;
Expand Down Expand Up @@ -485,7 +485,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;
Expand Down Expand Up @@ -552,7 +552,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;
Expand Down Expand Up @@ -602,7 +602,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;
Expand All @@ -627,7 +627,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;
Expand Down Expand Up @@ -676,7 +676,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;
Expand Down Expand Up @@ -740,7 +740,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;
Expand Down Expand Up @@ -769,7 +769,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;
Expand Down Expand Up @@ -814,7 +814,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;
Expand Down Expand Up @@ -871,7 +871,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;
Expand All @@ -897,7 +897,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;
Expand Down Expand Up @@ -947,7 +947,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;
Expand Down Expand Up @@ -1012,7 +1012,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;
Expand All @@ -1028,7 +1028,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;
Expand Down Expand Up @@ -1072,7 +1072,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;
Expand Down Expand Up @@ -1130,7 +1130,7 @@ static void _Eff_position_s16msb_c6(int chan, void *stream, int len, void *udata
}
}

static void _Eff_position_s32lsb(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s32lsb(int chan, void *stream, int len, void *udata)
{
/* 32 signed bits (lsb) * 2 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down Expand Up @@ -1159,7 +1159,7 @@ static void _Eff_position_s32lsb(int chan, void *stream, int len, void *udata)
}
}
}
static void _Eff_position_s32lsb_c4(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s32lsb_c4(int chan, void *stream, int len, void *udata)
{
/* 32 signed bits (lsb) * 4 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down Expand Up @@ -1204,7 +1204,7 @@ static void _Eff_position_s32lsb_c4(int chan, void *stream, int len, void *udata
}
}

static void _Eff_position_s32lsb_c6(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s32lsb_c6(int chan, void *stream, int len, void *udata)
{
/* 32 signed bits (lsb) * 6 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down Expand Up @@ -1261,7 +1261,7 @@ static void _Eff_position_s32lsb_c6(int chan, void *stream, int len, void *udata
}
}

static void _Eff_position_s32msb(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s32msb(int chan, void *stream, int len, void *udata)
{
/* 32 signed bits (lsb) * 2 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand All @@ -1277,7 +1277,7 @@ static void _Eff_position_s32msb(int chan, void *stream, int len, void *udata)
*(ptr++) = (Sint32) SDL_SwapBE32(swapr);
}
}
static void _Eff_position_s32msb_c4(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s32msb_c4(int chan, void *stream, int len, void *udata)
{
/* 32 signed bits (lsb) * 4 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down Expand Up @@ -1321,7 +1321,7 @@ static void _Eff_position_s32msb_c4(int chan, void *stream, int len, void *udata
}
}
}
static void _Eff_position_s32msb_c6(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_s32msb_c6(int chan, void *stream, int len, void *udata)
{
/* 32 signed bits (lsb) * 6 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down Expand Up @@ -1379,7 +1379,7 @@ static void _Eff_position_s32msb_c6(int chan, void *stream, int len, void *udata
}
}

static void _Eff_position_f32sys(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_f32sys(int chan, void *stream, int len, void *udata)
{
/* float * 2 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand All @@ -1393,7 +1393,7 @@ static void _Eff_position_f32sys(int chan, void *stream, int len, void *udata)
*(ptr++) = swapr;
}
}
static void _Eff_position_f32sys_c4(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_f32sys_c4(int chan, void *stream, int len, void *udata)
{
/* float * 4 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down Expand Up @@ -1433,7 +1433,7 @@ static void _Eff_position_f32sys_c4(int chan, void *stream, int len, void *udata
}
}
}
static void _Eff_position_f32sys_c6(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_position_f32sys_c6(int chan, void *stream, int len, void *udata)
{
/* float * 6 channels. */
volatile position_args *args = (volatile position_args *) udata;
Expand Down
6 changes: 3 additions & 3 deletions effect_stereoreverse.c
Expand Up @@ -55,7 +55,7 @@
* Stereo reversal effect...this one's pretty straightforward...
*/

static void _Eff_reversestereo32(int chan, void *stream, int len, void *udata)
static void SDLCALL _Eff_reversestereo32(int chan, void *stream, int len, void *udata)
{
/* 16 bits * 2 channels. */
Uint32 *ptr = (Uint32 *) stream;
Expand All @@ -70,7 +70,7 @@ static void _Eff_reversestereo32(int chan, void *stream, int len, void *udata)
}


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;
Expand All @@ -82,7 +82,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;
Expand Down
12 changes: 6 additions & 6 deletions mixer.c
Expand Up @@ -79,14 +79,14 @@ 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;

/* Support for user defined music functions */
static void (*mix_music)(void *udata, Uint8 *stream, int len) = music_mixer;
static void (SDLCALL *mix_music)(void *udata, Uint8 *stream, int len) = music_mixer;
static void *music_data = NULL;

/* rcg06042009 report available decoders at runtime. */
Expand Down Expand Up @@ -857,7 +857,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)
{
Mix_LockAudio();
Expand All @@ -869,7 +869,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)
{
Mix_LockAudio();
Expand All @@ -888,7 +888,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))
{
Mix_LockAudio();
channel_done_callback = channel_finished;
Expand Down

0 comments on commit a0ee3d7

Please sign in to comment.