backported SDLCALL updates. (from 2.0 branch commit aef7a1784ffd). SDL-1.2
authorOzkan Sezer <sezeroz@gmail.com>
Sun, 07 Oct 2018 10:57:01 +0300
branchSDL-1.2
changeset 887e49459791ae8
parent 886 cb08fb0976e6
child 888 5e920f51a0e7
backported SDLCALL updates. (from 2.0 branch commit aef7a1784ffd).
SDL_mixer.h
effect_position.c
effect_stereoreverse.c
fluidsynth.c
mixer.c
music.c
playwave.c
     1.1 --- a/SDL_mixer.h	Sun Oct 07 10:15:50 2018 +0300
     1.2 +++ b/SDL_mixer.h	Sun Oct 07 10:57:01 2018 +0300
     1.3 @@ -200,19 +200,19 @@
     1.4     This can be used to provide real-time visual display of the audio stream
     1.5     or add a custom mixer filter for the stream data.
     1.6  */
     1.7 -extern DECLSPEC void SDLCALL Mix_SetPostMix(void (*mix_func)
     1.8 +extern DECLSPEC void SDLCALL Mix_SetPostMix(void (SDLCALL *mix_func)
     1.9                               (void *udata, Uint8 *stream, int len), void *arg);
    1.10  
    1.11  /* Add your own music player or additional mixer function.
    1.12     If 'mix_func' is NULL, the default music player is re-enabled.
    1.13   */
    1.14 -extern DECLSPEC void SDLCALL Mix_HookMusic(void (*mix_func)
    1.15 +extern DECLSPEC void SDLCALL Mix_HookMusic(void (SDLCALL *mix_func)
    1.16                            (void *udata, Uint8 *stream, int len), void *arg);
    1.17  
    1.18  /* Add your own callback when the music has finished playing.
    1.19     This callback is only called if the music finishes naturally.
    1.20   */
    1.21 -extern DECLSPEC void SDLCALL Mix_HookMusicFinished(void (*music_finished)(void));
    1.22 +extern DECLSPEC void SDLCALL Mix_HookMusicFinished(void (SDLCALL *music_finished)(void));
    1.23  
    1.24  /* Get a pointer to the user data for the current music hook */
    1.25  extern DECLSPEC void * SDLCALL Mix_GetMusicHookData(void);
    1.26 @@ -225,7 +225,7 @@
    1.27   *  inside the audio callback, or SDL_mixer will explicitly lock the audio
    1.28   *  before calling your callback.
    1.29   */
    1.30 -extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (*channel_finished)(int channel));
    1.31 +extern DECLSPEC void SDLCALL Mix_ChannelFinished(void (SDLCALL *channel_finished)(int channel));
    1.32  
    1.33  
    1.34  /* Special Effects API by ryan c. gordon. (icculus@icculus.org) */
    1.35 @@ -249,7 +249,7 @@
    1.36   *
    1.37   * DO NOT EVER call SDL_LockAudio() from your callback function!
    1.38   */
    1.39 -typedef void (*Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata);
    1.40 +typedef void (SDLCALL *Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata);
    1.41  
    1.42  /*
    1.43   * This is a callback that signifies that a channel has finished all its
    1.44 @@ -260,7 +260,7 @@
    1.45   *
    1.46   * DO NOT EVER call SDL_LockAudio() from your callback function!
    1.47   */
    1.48 -typedef void (*Mix_EffectDone_t)(int chan, void *udata);
    1.49 +typedef void (SDLCALL *Mix_EffectDone_t)(int chan, void *udata);
    1.50  
    1.51  
    1.52  /* Register a special effect function. At mixing time, the channel data is
    1.53 @@ -611,7 +611,7 @@
    1.54  /* Set/Get/Iterate SoundFonts paths to use by supported MIDI backends */
    1.55  extern DECLSPEC int SDLCALL Mix_SetSoundFonts(const char *paths);
    1.56  extern DECLSPEC const char* SDLCALL Mix_GetSoundFonts(void);
    1.57 -extern DECLSPEC int SDLCALL Mix_EachSoundFont(int (*function)(const char*, void*), void *data);
    1.58 +extern DECLSPEC int SDLCALL Mix_EachSoundFont(int (SDLCALL *function)(const char*, void*), void *data);
    1.59  
    1.60  /* Get the Mix_Chunk currently associated with a mixer channel
    1.61      Returns NULL if it's an invalid channel, or there's no chunk associated.
     2.1 --- a/effect_position.c	Sun Oct 07 10:15:50 2018 +0300
     2.2 +++ b/effect_position.c	Sun Oct 07 10:57:01 2018 +0300
     2.3 @@ -98,7 +98,7 @@
     2.4  
     2.5  
     2.6  /* This just frees up the callback-specific data. */
     2.7 -static void _Eff_PositionDone(int channel, void *udata)
     2.8 +static void SDLCALL _Eff_PositionDone(int channel, void *udata)
     2.9  {
    2.10      if (channel < 0) {
    2.11          if (pos_args_global != NULL) {
    2.12 @@ -114,7 +114,7 @@
    2.13  }
    2.14  
    2.15  
    2.16 -static void _Eff_position_u8(int chan, void *stream, int len, void *udata)
    2.17 +static void SDLCALL _Eff_position_u8(int chan, void *stream, int len, void *udata)
    2.18  {
    2.19      volatile position_args *args = (volatile position_args *) udata;
    2.20      Uint8 *ptr = (Uint8 *) stream;
    2.21 @@ -151,7 +151,7 @@
    2.22          ptr++;
    2.23      }
    2.24  }
    2.25 -static void _Eff_position_u8_c4(int chan, void *stream, int len, void *udata)
    2.26 +static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *udata)
    2.27  {
    2.28      volatile position_args *args = (volatile position_args *) udata;
    2.29      Uint8 *ptr = (Uint8 *) stream;
    2.30 @@ -235,7 +235,7 @@
    2.31  }
    2.32  
    2.33  
    2.34 -static void _Eff_position_u8_c6(int chan, void *stream, int len, void *udata)
    2.35 +static void SDLCALL _Eff_position_u8_c6(int chan, void *stream, int len, void *udata)
    2.36  {
    2.37      volatile position_args *args = (volatile position_args *) udata;
    2.38      Uint8 *ptr = (Uint8 *) stream;
    2.39 @@ -357,7 +357,7 @@
    2.40   *  in case the user has called Mix_SetPanning() or whatnot again while this
    2.41   *  callback is running.
    2.42   */
    2.43 -static void _Eff_position_table_u8(int chan, void *stream, int len, void *udata)
    2.44 +static void SDLCALL _Eff_position_table_u8(int chan, void *stream, int len, void *udata)
    2.45  {
    2.46      volatile position_args *args = (volatile position_args *) udata;
    2.47      Uint8 *ptr = (Uint8 *) stream;
    2.48 @@ -406,7 +406,7 @@
    2.49  }
    2.50  
    2.51  
    2.52 -static void _Eff_position_s8(int chan, void *stream, int len, void *udata)
    2.53 +static void SDLCALL _Eff_position_s8(int chan, void *stream, int len, void *udata)
    2.54  {
    2.55      volatile position_args *args = (volatile position_args *) udata;
    2.56      Sint8 *ptr = (Sint8 *) stream;
    2.57 @@ -438,7 +438,7 @@
    2.58          ptr++;
    2.59      }
    2.60  }
    2.61 -static void _Eff_position_s8_c4(int chan, void *stream, int len, void *udata)
    2.62 +static void SDLCALL _Eff_position_s8_c4(int chan, void *stream, int len, void *udata)
    2.63  {
    2.64      volatile position_args *args = (volatile position_args *) udata;
    2.65      Sint8 *ptr = (Sint8 *) stream;
    2.66 @@ -484,7 +484,7 @@
    2.67        }
    2.68      }
    2.69  }
    2.70 -static void _Eff_position_s8_c6(int chan, void *stream, int len, void *udata)
    2.71 +static void SDLCALL _Eff_position_s8_c6(int chan, void *stream, int len, void *udata)
    2.72  {
    2.73      volatile position_args *args = (volatile position_args *) udata;
    2.74      Sint8 *ptr = (Sint8 *) stream;
    2.75 @@ -551,7 +551,7 @@
    2.76   *  in case the user has called Mix_SetPanning() or whatnot again while this
    2.77   *  callback is running.
    2.78   */
    2.79 -static void _Eff_position_table_s8(int chan, void *stream, int len, void *udata)
    2.80 +static void SDLCALL _Eff_position_table_s8(int chan, void *stream, int len, void *udata)
    2.81  {
    2.82      volatile position_args *args = (volatile position_args *) udata;
    2.83      Sint8 *ptr = (Sint8 *) stream;
    2.84 @@ -601,7 +601,7 @@
    2.85  
    2.86  /* !!! FIXME : Optimize the code for 16-bit samples? */
    2.87  
    2.88 -static void _Eff_position_u16lsb(int chan, void *stream, int len, void *udata)
    2.89 +static void SDLCALL _Eff_position_u16lsb(int chan, void *stream, int len, void *udata)
    2.90  {
    2.91      volatile position_args *args = (volatile position_args *) udata;
    2.92      Uint16 *ptr = (Uint16 *) stream;
    2.93 @@ -626,7 +626,7 @@
    2.94  	}
    2.95      }
    2.96  }
    2.97 -static void _Eff_position_u16lsb_c4(int chan, void *stream, int len, void *udata)
    2.98 +static void SDLCALL _Eff_position_u16lsb_c4(int chan, void *stream, int len, void *udata)
    2.99  {
   2.100      volatile position_args *args = (volatile position_args *) udata;
   2.101      Uint16 *ptr = (Uint16 *) stream;
   2.102 @@ -675,7 +675,7 @@
   2.103  	}
   2.104      }
   2.105  }
   2.106 -static void _Eff_position_u16lsb_c6(int chan, void *stream, int len, void *udata)
   2.107 +static void SDLCALL _Eff_position_u16lsb_c6(int chan, void *stream, int len, void *udata)
   2.108  {
   2.109      volatile position_args *args = (volatile position_args *) udata;
   2.110      Uint16 *ptr = (Uint16 *) stream;
   2.111 @@ -739,7 +739,7 @@
   2.112      }
   2.113  }
   2.114  
   2.115 -static void _Eff_position_s16lsb(int chan, void *stream, int len, void *udata)
   2.116 +static void SDLCALL _Eff_position_s16lsb(int chan, void *stream, int len, void *udata)
   2.117  {
   2.118      /* 16 signed bits (lsb) * 2 channels. */
   2.119      volatile position_args *args = (volatile position_args *) udata;
   2.120 @@ -768,7 +768,7 @@
   2.121  	}
   2.122      }
   2.123  }
   2.124 -static void _Eff_position_s16lsb_c4(int chan, void *stream, int len, void *udata)
   2.125 +static void SDLCALL _Eff_position_s16lsb_c4(int chan, void *stream, int len, void *udata)
   2.126  {
   2.127      /* 16 signed bits (lsb) * 4 channels. */
   2.128      volatile position_args *args = (volatile position_args *) udata;
   2.129 @@ -813,7 +813,7 @@
   2.130      }
   2.131  }
   2.132  
   2.133 -static void _Eff_position_s16lsb_c6(int chan, void *stream, int len, void *udata)
   2.134 +static void SDLCALL _Eff_position_s16lsb_c6(int chan, void *stream, int len, void *udata)
   2.135  {
   2.136      /* 16 signed bits (lsb) * 6 channels. */
   2.137      volatile position_args *args = (volatile position_args *) udata;
   2.138 @@ -870,7 +870,7 @@
   2.139      }
   2.140  }
   2.141  
   2.142 -static void _Eff_position_u16msb(int chan, void *stream, int len, void *udata)
   2.143 +static void SDLCALL _Eff_position_u16msb(int chan, void *stream, int len, void *udata)
   2.144  {
   2.145      /* 16 signed bits (lsb) * 2 channels. */
   2.146      volatile position_args *args = (volatile position_args *) udata;
   2.147 @@ -896,7 +896,7 @@
   2.148  	}
   2.149      }
   2.150  }
   2.151 -static void _Eff_position_u16msb_c4(int chan, void *stream, int len, void *udata)
   2.152 +static void SDLCALL _Eff_position_u16msb_c4(int chan, void *stream, int len, void *udata)
   2.153  {
   2.154      /* 16 signed bits (lsb) * 4 channels. */
   2.155      volatile position_args *args = (volatile position_args *) udata;
   2.156 @@ -946,7 +946,7 @@
   2.157  	}
   2.158      }
   2.159  }
   2.160 -static void _Eff_position_u16msb_c6(int chan, void *stream, int len, void *udata)
   2.161 +static void SDLCALL _Eff_position_u16msb_c6(int chan, void *stream, int len, void *udata)
   2.162  {
   2.163      /* 16 signed bits (lsb) * 6 channels. */
   2.164      volatile position_args *args = (volatile position_args *) udata;
   2.165 @@ -1011,7 +1011,7 @@
   2.166      }
   2.167  }
   2.168  
   2.169 -static void _Eff_position_s16msb(int chan, void *stream, int len, void *udata)
   2.170 +static void SDLCALL _Eff_position_s16msb(int chan, void *stream, int len, void *udata)
   2.171  {
   2.172      /* 16 signed bits (lsb) * 2 channels. */
   2.173      volatile position_args *args = (volatile position_args *) udata;
   2.174 @@ -1027,7 +1027,7 @@
   2.175          *(ptr++) = (Sint16) SDL_SwapBE16(swapr);
   2.176      }
   2.177  }
   2.178 -static void _Eff_position_s16msb_c4(int chan, void *stream, int len, void *udata)
   2.179 +static void SDLCALL _Eff_position_s16msb_c4(int chan, void *stream, int len, void *udata)
   2.180  {
   2.181      /* 16 signed bits (lsb) * 4 channels. */
   2.182      volatile position_args *args = (volatile position_args *) udata;
   2.183 @@ -1071,7 +1071,7 @@
   2.184  	}
   2.185      }
   2.186  }
   2.187 -static void _Eff_position_s16msb_c6(int chan, void *stream, int len, void *udata)
   2.188 +static void SDLCALL _Eff_position_s16msb_c6(int chan, void *stream, int len, void *udata)
   2.189  {
   2.190      /* 16 signed bits (lsb) * 6 channels. */
   2.191      volatile position_args *args = (volatile position_args *) udata;
     3.1 --- a/effect_stereoreverse.c	Sun Oct 07 10:15:50 2018 +0300
     3.2 +++ b/effect_stereoreverse.c	Sun Oct 07 10:57:01 2018 +0300
     3.3 @@ -55,7 +55,7 @@
     3.4   * Stereo reversal effect...this one's pretty straightforward...
     3.5   */
     3.6  
     3.7 -static void _Eff_reversestereo16(int chan, void *stream, int len, void *udata)
     3.8 +static void SDLCALL _Eff_reversestereo16(int chan, void *stream, int len, void *udata)
     3.9  {
    3.10      /* 16 bits * 2 channels. */
    3.11      Uint32 *ptr = (Uint32 *) stream;
    3.12 @@ -67,7 +67,7 @@
    3.13  }
    3.14  
    3.15  
    3.16 -static void _Eff_reversestereo8(int chan, void *stream, int len, void *udata)
    3.17 +static void SDLCALL _Eff_reversestereo8(int chan, void *stream, int len, void *udata)
    3.18  {
    3.19      /* 8 bits * 2 channels. */
    3.20      Uint32 *ptr = (Uint32 *) stream;
     4.1 --- a/fluidsynth.c	Sun Oct 07 10:15:50 2018 +0300
     4.2 +++ b/fluidsynth.c	Sun Oct 07 10:57:01 2018 +0300
     4.3 @@ -34,7 +34,7 @@
     4.4  static Uint8 channels;
     4.5  static int freq;
     4.6  
     4.7 -int fluidsynth_check_soundfont(const char *path, void *data)
     4.8 +int SDLCALL fluidsynth_check_soundfont(const char *path, void *data)
     4.9  {
    4.10  	FILE *file = fopen(path, "r");
    4.11  
    4.12 @@ -47,7 +47,7 @@
    4.13  	}
    4.14  }
    4.15  
    4.16 -int fluidsynth_load_soundfont(const char *path, void *data)
    4.17 +int SDLCALL fluidsynth_load_soundfont(const char *path, void *data)
    4.18  {
    4.19  	/* If this fails, it's too late to try Timidity so pray that at least one works. */
    4.20  	fluidsynth.fluid_synth_sfload((fluid_synth_t*) data, path, 1);
     5.1 --- a/mixer.c	Sun Oct 07 10:15:50 2018 +0300
     5.2 +++ b/mixer.c	Sun Oct 07 10:57:01 2018 +0300
     5.3 @@ -86,11 +86,11 @@
     5.4  
     5.5  
     5.6  /* Support for hooking into the mixer callback system */
     5.7 -static void (*mix_postmix)(void *udata, Uint8 *stream, int len) = NULL;
     5.8 +static void (SDLCALL *mix_postmix)(void *udata, Uint8 *stream, int len) = NULL;
     5.9  static void *mix_postmix_data = NULL;
    5.10  
    5.11  /* rcg07062001 callback to alert when channels are done playing. */
    5.12 -static void (*channel_done_callback)(int channel) = NULL;
    5.13 +static void (SDLCALL *channel_done_callback)(int channel) = NULL;
    5.14  
    5.15  /* Music function declarations */
    5.16  extern int open_music(SDL_AudioSpec *mixer);
    5.17 @@ -98,8 +98,8 @@
    5.18  
    5.19  /* Support for user defined music functions, plus the default one */
    5.20  extern int volatile music_active;
    5.21 -extern void music_mixer(void *udata, Uint8 *stream, int len);
    5.22 -static void (*mix_music)(void *udata, Uint8 *stream, int len) = music_mixer;
    5.23 +extern void SDLCALL music_mixer(void *udata, Uint8 *stream, int len);
    5.24 +static void (SDLCALL *mix_music)(void *udata, Uint8 *stream, int len) = music_mixer;
    5.25  static void *music_data = NULL;
    5.26  
    5.27  /* rcg06042009 report available decoders at runtime. */
    5.28 @@ -760,7 +760,7 @@
    5.29     This can be used to provide real-time visual display of the audio stream
    5.30     or add a custom mixer filter for the stream data.
    5.31  */
    5.32 -void Mix_SetPostMix(void (*mix_func)
    5.33 +void Mix_SetPostMix(void (SDLCALL *mix_func)
    5.34                      (void *udata, Uint8 *stream, int len), void *arg)
    5.35  {
    5.36  	SDL_LockAudio();
    5.37 @@ -772,7 +772,7 @@
    5.38  /* Add your own music player or mixer function.
    5.39     If 'mix_func' is NULL, the default music player is re-enabled.
    5.40   */
    5.41 -void Mix_HookMusic(void (*mix_func)(void *udata, Uint8 *stream, int len),
    5.42 +void Mix_HookMusic(void (SDLCALL *mix_func)(void *udata, Uint8 *stream, int len),
    5.43                                                                  void *arg)
    5.44  {
    5.45  	SDL_LockAudio();
    5.46 @@ -791,7 +791,7 @@
    5.47  	return(music_data);
    5.48  }
    5.49  
    5.50 -void Mix_ChannelFinished(void (*channel_finished)(int channel))
    5.51 +void Mix_ChannelFinished(void (SDLCALL *channel_finished)(int channel))
    5.52  {
    5.53  	SDL_LockAudio();
    5.54  	channel_done_callback = channel_finished;
     6.1 --- a/music.c	Sun Oct 07 10:15:50 2018 +0300
     6.2 +++ b/music.c	Sun Oct 07 10:57:01 2018 +0300
     6.3 @@ -181,9 +181,9 @@
     6.4  
     6.5  
     6.6  /* Support for hooking when the music has finished */
     6.7 -static void (*music_finished_hook)(void) = NULL;
     6.8 +static void (SDLCALL *music_finished_hook)(void) = NULL;
     6.9  
    6.10 -void Mix_HookMusicFinished(void (*music_finished)(void))
    6.11 +void Mix_HookMusicFinished(void (SDLCALL *music_finished)(void))
    6.12  {
    6.13  	SDL_LockAudio();
    6.14  	music_finished_hook = music_finished;
    6.15 @@ -231,7 +231,7 @@
    6.16  
    6.17  
    6.18  /* Mixing function */
    6.19 -void music_mixer(void *udata, Uint8 *stream, int len)
    6.20 +void SDLCALL music_mixer(void *udata, Uint8 *stream, int len)
    6.21  {
    6.22  	int left = 0;
    6.23  
    6.24 @@ -1567,7 +1567,7 @@
    6.25  	}
    6.26  }
    6.27  
    6.28 -int Mix_EachSoundFont(int (*function)(const char*, void*), void *data)
    6.29 +int Mix_EachSoundFont(int (SDLCALL *function)(const char*, void*), void *data)
    6.30  {
    6.31  	char *context, *path, *paths;
    6.32  	const char* cpaths = Mix_GetSoundFonts();
     7.1 --- a/playwave.c	Sun Oct 07 10:15:50 2018 +0300
     7.2 +++ b/playwave.c	Sun Oct 07 10:57:01 2018 +0300
     7.3 @@ -134,7 +134,7 @@
     7.4  
     7.5  #ifdef TEST_MIX_CHANNELFINISHED  /* rcg06072001 */
     7.6  static volatile int channel_is_done = 0;
     7.7 -static void channel_complete_callback(int chan)
     7.8 +static void SDLCALL channel_complete_callback (int chan)
     7.9  {
    7.10  	Mix_Chunk *done_chunk = Mix_GetChunk(chan);
    7.11  	fprintf(stderr, "We were just alerted that Mixer channel #%d is done.\n", chan);