Fixed bug #215
authorSam Lantinga <slouken@libsdl.org>
Sun, 07 May 2006 03:40:06 +0000
changeset 1769290b5baf2fca
parent 1768 814f9f2c7a33
child 1770 1632155c67e5
Fixed bug #215

The current SVN trunk is missing the SDLCALL specifier at numerous locations.

It has to be added for all (possibly user provided) callbacks.

I stumbled over this while creating a makefile for the OpenWatcom compiler for
Win32.
include/SDL_stdinc.h
src/audio/SDL_audio.c
src/audio/SDL_audio_c.h
src/audio/SDL_audiocvt.c
src/events/SDL_events.c
src/file/SDL_rwops.c
src/main/win32/SDL_win32_main.c
src/thread/SDL_thread.c
src/thread/win32/SDL_systhread.c
src/video/wincommon/SDL_wingl.c
test/loopwave.c
test/testerror.c
test/testhread.c
test/testlock.c
test/testsem.c
test/testtimer.c
test/testwm.c
test/threadwin.c
test/torturethread.c
     1.1 --- a/include/SDL_stdinc.h	Fri May 05 05:50:26 2006 +0000
     1.2 +++ b/include/SDL_stdinc.h	Sun May 07 03:40:06 2006 +0000
     1.3 @@ -168,6 +168,8 @@
     1.4  # elif defined(_MSC_VER)
     1.5  #  include <malloc.h>
     1.6  #  define alloca _alloca
     1.7 +# elif defined(__WATCOMC__)
     1.8 +#  include <malloc.h>
     1.9  # elif defined(__AIX__)
    1.10    #pragma alloca
    1.11  # else
     2.1 --- a/src/audio/SDL_audio.c	Fri May 05 05:50:26 2006 +0000
     2.2 +++ b/src/audio/SDL_audio.c	Sun May 07 03:40:06 2006 +0000
     2.3 @@ -120,13 +120,13 @@
     2.4  #endif
     2.5  
     2.6  /* The general mixing thread function */
     2.7 -int SDL_RunAudio(void *audiop)
     2.8 +int SDLCALL SDL_RunAudio(void *audiop)
     2.9  {
    2.10  	SDL_AudioDevice *audio = (SDL_AudioDevice *)audiop;
    2.11  	Uint8 *stream;
    2.12  	int    stream_len;
    2.13  	void  *udata;
    2.14 -	void (*fill)(void *userdata,Uint8 *stream, int len);
    2.15 +	void (SDLCALL *fill)(void *userdata,Uint8 *stream, int len);
    2.16  	int    silence;
    2.17  #if SDL_AUDIO_DRIVER_AHI
    2.18  	int started = 0;
     3.1 --- a/src/audio/SDL_audio_c.h	Fri May 05 05:50:26 2006 +0000
     3.2 +++ b/src/audio/SDL_audio_c.h	Sun May 07 03:40:06 2006 +0000
     3.3 @@ -31,4 +31,4 @@
     3.4  extern void SDL_CalculateAudioSpec(SDL_AudioSpec *spec);
     3.5  
     3.6  /* The actual mixing thread function */
     3.7 -extern int SDL_RunAudio(void *audiop);
     3.8 +extern int SDLCALL SDL_RunAudio(void *audiop);
     4.1 --- a/src/audio/SDL_audiocvt.c	Fri May 05 05:50:26 2006 +0000
     4.2 +++ b/src/audio/SDL_audiocvt.c	Sun May 07 03:40:06 2006 +0000
     4.3 @@ -27,7 +27,7 @@
     4.4  
     4.5  
     4.6  /* Effectively mix right and left channels into a single channel */
     4.7 -void SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format)
     4.8 +void SDLCALL SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format)
     4.9  {
    4.10  	int i;
    4.11  	Sint32 sample;
    4.12 @@ -169,7 +169,7 @@
    4.13  }
    4.14  
    4.15  /* Discard top 4 channels */
    4.16 -void SDL_ConvertStrip(SDL_AudioCVT *cvt, Uint16 format)
    4.17 +void SDLCALL SDL_ConvertStrip(SDL_AudioCVT *cvt, Uint16 format)
    4.18  {
    4.19  	int i;
    4.20  	Sint32 lsample, rsample;
    4.21 @@ -285,7 +285,7 @@
    4.22  
    4.23  
    4.24  /* Discard top 2 channels of 6 */
    4.25 -void SDL_ConvertStrip_2(SDL_AudioCVT *cvt, Uint16 format)
    4.26 +void SDLCALL SDL_ConvertStrip_2(SDL_AudioCVT *cvt, Uint16 format)
    4.27  {
    4.28  	int i;
    4.29  	Sint32 lsample, rsample;
    4.30 @@ -400,7 +400,7 @@
    4.31  }
    4.32  
    4.33  /* Duplicate a mono channel to both stereo channels */
    4.34 -void SDL_ConvertStereo(SDL_AudioCVT *cvt, Uint16 format)
    4.35 +void SDLCALL SDL_ConvertStereo(SDL_AudioCVT *cvt, Uint16 format)
    4.36  {
    4.37  	int i;
    4.38  
    4.39 @@ -438,7 +438,7 @@
    4.40  
    4.41  
    4.42  /* Duplicate a stereo channel to a pseudo-5.1 stream */
    4.43 -void SDL_ConvertSurround(SDL_AudioCVT *cvt, Uint16 format)
    4.44 +void SDLCALL SDL_ConvertSurround(SDL_AudioCVT *cvt, Uint16 format)
    4.45  {
    4.46  	int i;
    4.47  
    4.48 @@ -615,7 +615,7 @@
    4.49  
    4.50  
    4.51  /* Duplicate a stereo channel to a pseudo-4.0 stream */
    4.52 -void SDL_ConvertSurround_4(SDL_AudioCVT *cvt, Uint16 format)
    4.53 +void SDLCALL SDL_ConvertSurround_4(SDL_AudioCVT *cvt, Uint16 format)
    4.54  {
    4.55  	int i;
    4.56  
    4.57 @@ -768,7 +768,7 @@
    4.58  
    4.59  
    4.60  /* Convert 8-bit to 16-bit - LSB */
    4.61 -void SDL_Convert16LSB(SDL_AudioCVT *cvt, Uint16 format)
    4.62 +void SDLCALL SDL_Convert16LSB(SDL_AudioCVT *cvt, Uint16 format)
    4.63  {
    4.64  	int i;
    4.65  	Uint8 *src, *dst;
    4.66 @@ -791,7 +791,7 @@
    4.67  	}
    4.68  }
    4.69  /* Convert 8-bit to 16-bit - MSB */
    4.70 -void SDL_Convert16MSB(SDL_AudioCVT *cvt, Uint16 format)
    4.71 +void SDLCALL SDL_Convert16MSB(SDL_AudioCVT *cvt, Uint16 format)
    4.72  {
    4.73  	int i;
    4.74  	Uint8 *src, *dst;
    4.75 @@ -815,7 +815,7 @@
    4.76  }
    4.77  
    4.78  /* Convert 16-bit to 8-bit */
    4.79 -void SDL_Convert8(SDL_AudioCVT *cvt, Uint16 format)
    4.80 +void SDLCALL SDL_Convert8(SDL_AudioCVT *cvt, Uint16 format)
    4.81  {
    4.82  	int i;
    4.83  	Uint8 *src, *dst;
    4.84 @@ -841,7 +841,7 @@
    4.85  }
    4.86  
    4.87  /* Toggle signed/unsigned */
    4.88 -void SDL_ConvertSign(SDL_AudioCVT *cvt, Uint16 format)
    4.89 +void SDLCALL SDL_ConvertSign(SDL_AudioCVT *cvt, Uint16 format)
    4.90  {
    4.91  	int i;
    4.92  	Uint8 *data;
    4.93 @@ -870,7 +870,7 @@
    4.94  }
    4.95  
    4.96  /* Toggle endianness */
    4.97 -void SDL_ConvertEndian(SDL_AudioCVT *cvt, Uint16 format)
    4.98 +void SDLCALL SDL_ConvertEndian(SDL_AudioCVT *cvt, Uint16 format)
    4.99  {
   4.100  	int i;
   4.101  	Uint8 *data, tmp;
   4.102 @@ -892,7 +892,7 @@
   4.103  }
   4.104  
   4.105  /* Convert rate up by multiple of 2 */
   4.106 -void SDL_RateMUL2(SDL_AudioCVT *cvt, Uint16 format)
   4.107 +void SDLCALL SDL_RateMUL2(SDL_AudioCVT *cvt, Uint16 format)
   4.108  {
   4.109  	int i;
   4.110  	Uint8 *src, *dst;
   4.111 @@ -930,7 +930,7 @@
   4.112  
   4.113  
   4.114  /* Convert rate up by multiple of 2, for stereo */
   4.115 -void SDL_RateMUL2_c2(SDL_AudioCVT *cvt, Uint16 format)
   4.116 +void SDLCALL SDL_RateMUL2_c2(SDL_AudioCVT *cvt, Uint16 format)
   4.117  {
   4.118  	int i;
   4.119  	Uint8 *src, *dst;
   4.120 @@ -973,7 +973,7 @@
   4.121  }
   4.122  
   4.123  /* Convert rate up by multiple of 2, for quad */
   4.124 -void SDL_RateMUL2_c4(SDL_AudioCVT *cvt, Uint16 format)
   4.125 +void SDLCALL SDL_RateMUL2_c4(SDL_AudioCVT *cvt, Uint16 format)
   4.126  {
   4.127  	int i;
   4.128  	Uint8 *src, *dst;
   4.129 @@ -1029,7 +1029,7 @@
   4.130  
   4.131  
   4.132  /* Convert rate up by multiple of 2, for 5.1 */
   4.133 -void SDL_RateMUL2_c6(SDL_AudioCVT *cvt, Uint16 format)
   4.134 +void SDLCALL SDL_RateMUL2_c6(SDL_AudioCVT *cvt, Uint16 format)
   4.135  {
   4.136  	int i;
   4.137  	Uint8 *src, *dst;
   4.138 @@ -1096,7 +1096,7 @@
   4.139  }
   4.140  
   4.141  /* Convert rate down by multiple of 2 */
   4.142 -void SDL_RateDIV2(SDL_AudioCVT *cvt, Uint16 format)
   4.143 +void SDLCALL SDL_RateDIV2(SDL_AudioCVT *cvt, Uint16 format)
   4.144  {
   4.145  	int i;
   4.146  	Uint8 *src, *dst;
   4.147 @@ -1131,7 +1131,7 @@
   4.148  
   4.149  
   4.150  /* Convert rate down by multiple of 2, for stereo */
   4.151 -void SDL_RateDIV2_c2(SDL_AudioCVT *cvt, Uint16 format)
   4.152 +void SDLCALL SDL_RateDIV2_c2(SDL_AudioCVT *cvt, Uint16 format)
   4.153  {
   4.154  	int i;
   4.155  	Uint8 *src, *dst;
   4.156 @@ -1169,7 +1169,7 @@
   4.157  
   4.158  
   4.159  /* Convert rate down by multiple of 2, for quad */
   4.160 -void SDL_RateDIV2_c4(SDL_AudioCVT *cvt, Uint16 format)
   4.161 +void SDLCALL SDL_RateDIV2_c4(SDL_AudioCVT *cvt, Uint16 format)
   4.162  {
   4.163  	int i;
   4.164  	Uint8 *src, *dst;
   4.165 @@ -1212,7 +1212,7 @@
   4.166  }
   4.167  
   4.168  /* Convert rate down by multiple of 2, for 5.1 */
   4.169 -void SDL_RateDIV2_c6(SDL_AudioCVT *cvt, Uint16 format)
   4.170 +void SDLCALL SDL_RateDIV2_c6(SDL_AudioCVT *cvt, Uint16 format)
   4.171  {
   4.172  	int i;
   4.173  	Uint8 *src, *dst;
   4.174 @@ -1261,7 +1261,7 @@
   4.175  }
   4.176  
   4.177  /* Very slow rate conversion routine */
   4.178 -void SDL_RateSLOW(SDL_AudioCVT *cvt, Uint16 format)
   4.179 +void SDLCALL SDL_RateSLOW(SDL_AudioCVT *cvt, Uint16 format)
   4.180  {
   4.181  	double ipos;
   4.182  	int i, clen;
   4.183 @@ -1474,7 +1474,7 @@
   4.184  		Uint32 hi_rate, lo_rate;
   4.185  		int len_mult;
   4.186  		double len_ratio;
   4.187 -		void (*rate_cvt)(SDL_AudioCVT *cvt, Uint16 format);
   4.188 +		void (SDLCALL *rate_cvt)(SDL_AudioCVT *cvt, Uint16 format);
   4.189  
   4.190  		if ( src_rate > dst_rate ) {
   4.191  			hi_rate = src_rate;
     5.1 --- a/src/events/SDL_events.c	Fri May 05 05:50:26 2006 +0000
     5.2 +++ b/src/events/SDL_events.c	Sun May 07 03:40:06 2006 +0000
     5.3 @@ -87,7 +87,7 @@
     5.4  #include <time.h>
     5.5  #endif
     5.6  
     5.7 -static int SDL_GobbleEvents(void *unused)
     5.8 +static int SDLCALL SDL_GobbleEvents(void *unused)
     5.9  {
    5.10  	event_thread = SDL_ThreadID();
    5.11  
     6.1 --- a/src/file/SDL_rwops.c	Fri May 05 05:50:26 2006 +0000
     6.2 +++ b/src/file/SDL_rwops.c	Sun May 07 03:40:06 2006 +0000
     6.3 @@ -43,7 +43,7 @@
     6.4  #define INVALID_SET_FILE_POINTER 0xFFFFFFFF
     6.5  #endif
     6.6  
     6.7 -static int win32_file_open(SDL_RWops *context, const char *filename, const char *mode)
     6.8 +static int SDLCALL win32_file_open(SDL_RWops *context, const char *filename, const char *mode)
     6.9  {
    6.10  #ifndef _WIN32_WCE
    6.11  	UINT	old_error_mode;
    6.12 @@ -108,7 +108,7 @@
    6.13  	
    6.14  	return 0; /* ok */
    6.15  }
    6.16 -static int win32_file_seek(SDL_RWops *context, int offset, int whence)
    6.17 +static int SDLCALL win32_file_seek(SDL_RWops *context, int offset, int whence)
    6.18  {
    6.19  	DWORD win32whence;
    6.20  	int   file_pos;
    6.21 @@ -138,7 +138,7 @@
    6.22  	SDL_Error(SDL_EFSEEK);
    6.23  	return -1; /* error */
    6.24  }
    6.25 -static int win32_file_read(SDL_RWops *context, void *ptr, int size, int maxnum)
    6.26 +static int SDLCALL win32_file_read(SDL_RWops *context, void *ptr, int size, int maxnum)
    6.27  {
    6.28  	
    6.29  	int		total_bytes; 
    6.30 @@ -156,7 +156,7 @@
    6.31  	nread = byte_read/size;
    6.32  	return nread;
    6.33  }
    6.34 -static int win32_file_write(SDL_RWops *context, const void *ptr, int size, int num)
    6.35 +static int SDLCALL win32_file_write(SDL_RWops *context, const void *ptr, int size, int num)
    6.36  {
    6.37  	
    6.38  	int		total_bytes; 
    6.39 @@ -183,7 +183,7 @@
    6.40  	nwritten = byte_written/size;
    6.41  	return nwritten;
    6.42  }
    6.43 -static int win32_file_close(SDL_RWops *context)
    6.44 +static int SDLCALL win32_file_close(SDL_RWops *context)
    6.45  {
    6.46  	
    6.47  	if ( context ) {								
    6.48 @@ -201,7 +201,7 @@
    6.49  
    6.50  /* Functions to read/write stdio file pointers */
    6.51  
    6.52 -static int stdio_seek(SDL_RWops *context, int offset, int whence)
    6.53 +static int SDLCALL stdio_seek(SDL_RWops *context, int offset, int whence)
    6.54  {
    6.55  	if ( fseek(context->hidden.stdio.fp, offset, whence) == 0 ) {
    6.56  		return(ftell(context->hidden.stdio.fp));
    6.57 @@ -210,7 +210,7 @@
    6.58  		return(-1);
    6.59  	}
    6.60  }
    6.61 -static int stdio_read(SDL_RWops *context, void *ptr, int size, int maxnum)
    6.62 +static int SDLCALL stdio_read(SDL_RWops *context, void *ptr, int size, int maxnum)
    6.63  {
    6.64  	size_t nread;
    6.65  
    6.66 @@ -220,7 +220,7 @@
    6.67  	}
    6.68  	return(nread);
    6.69  }
    6.70 -static int stdio_write(SDL_RWops *context, const void *ptr, int size, int num)
    6.71 +static int SDLCALL stdio_write(SDL_RWops *context, const void *ptr, int size, int num)
    6.72  {
    6.73  	size_t nwrote;
    6.74  
    6.75 @@ -230,7 +230,7 @@
    6.76  	}
    6.77  	return(nwrote);
    6.78  }
    6.79 -static int stdio_close(SDL_RWops *context)
    6.80 +static int SDLCALL stdio_close(SDL_RWops *context)
    6.81  {
    6.82  	if ( context ) {
    6.83  		if ( context->hidden.stdio.autoclose ) {
    6.84 @@ -245,7 +245,7 @@
    6.85  
    6.86  /* Functions to read/write memory pointers */
    6.87  
    6.88 -static int mem_seek(SDL_RWops *context, int offset, int whence)
    6.89 +static int SDLCALL mem_seek(SDL_RWops *context, int offset, int whence)
    6.90  {
    6.91  	Uint8 *newpos;
    6.92  
    6.93 @@ -272,7 +272,7 @@
    6.94  	context->hidden.mem.here = newpos;
    6.95  	return(context->hidden.mem.here-context->hidden.mem.base);
    6.96  }
    6.97 -static int mem_read(SDL_RWops *context, void *ptr, int size, int maxnum)
    6.98 +static int SDLCALL mem_read(SDL_RWops *context, void *ptr, int size, int maxnum)
    6.99  {
   6.100  	size_t total_bytes;
   6.101  	size_t mem_available;
   6.102 @@ -292,7 +292,7 @@
   6.103  
   6.104  	return (total_bytes / size);
   6.105  }
   6.106 -static int mem_write(SDL_RWops *context, const void *ptr, int size, int num)
   6.107 +static int SDLCALL mem_write(SDL_RWops *context, const void *ptr, int size, int num)
   6.108  {
   6.109  	if ( (context->hidden.mem.here + (num*size)) > context->hidden.mem.stop ) {
   6.110  		num = (context->hidden.mem.stop-context->hidden.mem.here)/size;
   6.111 @@ -301,12 +301,12 @@
   6.112  	context->hidden.mem.here += num*size;
   6.113  	return(num);
   6.114  }
   6.115 -static int mem_writeconst(SDL_RWops *context, const void *ptr, int size, int num)
   6.116 +static int SDLCALL mem_writeconst(SDL_RWops *context, const void *ptr, int size, int num)
   6.117  {
   6.118  	SDL_SetError("Can't write to read-only memory");
   6.119  	return(-1);
   6.120  }
   6.121 -static int mem_close(SDL_RWops *context)
   6.122 +static int SDLCALL mem_close(SDL_RWops *context)
   6.123  {
   6.124  	if ( context ) {
   6.125  		SDL_FreeRW(context);
     7.1 --- a/src/main/win32/SDL_win32_main.c	Fri May 05 05:50:26 2006 +0000
     7.2 +++ b/src/main/win32/SDL_win32_main.c	Sun May 07 03:40:06 2006 +0000
     7.3 @@ -121,8 +121,15 @@
     7.4  	return FALSE;
     7.5  }
     7.6  
     7.7 +/* SDL_Quit() shouldn't be used with atexit() directly because
     7.8 +   calling conventions may differ... */
     7.9 +static void cleanup(void)
    7.10 +{
    7.11 +	SDL_Quit();
    7.12 +}
    7.13 +
    7.14  /* Remove the output files if there was no output written */
    7.15 -static void __cdecl cleanup_output(void)
    7.16 +static void cleanup_output(void)
    7.17  {
    7.18  #ifndef NO_STDIO_REDIRECT
    7.19  	FILE *file;
    7.20 @@ -188,7 +195,7 @@
    7.21  	if ( bufp == NULL ) {
    7.22  		return OutOfMemory();
    7.23  	}
    7.24 -	SDL_strlcpy(bufp, appname, n);
    7.25 +	SDL_strlcpy(bufp, appname, n+1);
    7.26  	appname = bufp;
    7.27  
    7.28  	/* Load SDL dynamic link library */
    7.29 @@ -197,7 +204,7 @@
    7.30  		return(FALSE);
    7.31  	}
    7.32  	atexit(cleanup_output);
    7.33 -	atexit(SDL_Quit);
    7.34 +	atexit(cleanup);
    7.35  
    7.36  	/* Sam:
    7.37  	   We still need to pass in the application handle so that
     8.1 --- a/src/thread/SDL_thread.c	Fri May 05 05:50:26 2006 +0000
     8.2 +++ b/src/thread/SDL_thread.c	Sun May 07 03:40:06 2006 +0000
     8.3 @@ -168,7 +168,7 @@
     8.4  
     8.5  /* Arguments and callback to setup and run the user thread function */
     8.6  typedef struct {
     8.7 -	int (*func)(void *);
     8.8 +	int (SDLCALL *func)(void *);
     8.9  	void *data;
    8.10  	SDL_Thread *info;
    8.11  	SDL_sem *wait;
    8.12 @@ -177,7 +177,7 @@
    8.13  void SDL_RunThread(void *data)
    8.14  {
    8.15  	thread_args *args;
    8.16 -	int (*userfunc)(void *);
    8.17 +	int (SDLCALL *userfunc)(void *);
    8.18  	void *userdata;
    8.19  	int *statusloc;
    8.20  
    8.21 @@ -204,9 +204,9 @@
    8.22  
    8.23  #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
    8.24  #undef SDL_CreateThread
    8.25 -DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread)
    8.26 +DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread)
    8.27  #else
    8.28 -DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data)
    8.29 +DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data)
    8.30  #endif
    8.31  {
    8.32  	SDL_Thread *thread;
     9.1 --- a/src/thread/win32/SDL_systhread.c	Fri May 05 05:50:26 2006 +0000
     9.2 +++ b/src/thread/win32/SDL_systhread.c	Sun May 07 03:40:06 2006 +0000
     9.3 @@ -41,6 +41,15 @@
     9.4          unsigned (__stdcall *func)(void *), void *arg, 
     9.5          unsigned, unsigned *threadID);
     9.6  typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
     9.7 +#elif defined(__WATCOMC__)
     9.8 +/* This is for Watcom targets except OS2 */
     9.9 +#if __WATCOMC__ < 1240
    9.10 +#define __watcall
    9.11 +#endif
    9.12 +typedef unsigned long (__watcall *pfnSDL_CurrentBeginThread) (void *, unsigned,
    9.13 +        unsigned (__stdcall *func)(void *), void *arg, 
    9.14 +        unsigned, unsigned *threadID);
    9.15 +typedef void (__watcall *pfnSDL_CurrentEndThread)(unsigned code);
    9.16  #else
    9.17  typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
    9.18          unsigned (__stdcall *func)(void *), void *arg, 
    10.1 --- a/src/video/wincommon/SDL_wingl.c	Fri May 05 05:50:26 2006 +0000
    10.2 +++ b/src/video/wincommon/SDL_wingl.c	Sun May 07 03:40:06 2006 +0000
    10.3 @@ -177,7 +177,7 @@
    10.4  	int iAttribs[64];
    10.5  	int *iAttr;
    10.6  	float fAttribs[1] = { 0 };
    10.7 -	const GLubyte *(*glGetStringFunc)(GLenum);
    10.8 +	const GLubyte *(WINAPI *glGetStringFunc)(GLenum);
    10.9  	const char *wglext;
   10.10  
   10.11  	/* load the gl driver from a default path */
    11.1 --- a/test/loopwave.c	Fri May 05 05:50:26 2006 +0000
    11.2 +++ b/test/loopwave.c	Sun May 07 03:40:06 2006 +0000
    11.3 @@ -32,7 +32,7 @@
    11.4  }
    11.5  
    11.6  
    11.7 -void fillerup(void *unused, Uint8 *stream, int len)
    11.8 +void SDLCALL fillerup(void *unused, Uint8 *stream, int len)
    11.9  {
   11.10  	Uint8 *waveptr;
   11.11  	int    waveleft;
    12.1 --- a/test/testerror.c	Fri May 05 05:50:26 2006 +0000
    12.2 +++ b/test/testerror.c	Sun May 07 03:40:06 2006 +0000
    12.3 @@ -17,7 +17,7 @@
    12.4  	exit(rc);
    12.5  }
    12.6  
    12.7 -int ThreadFunc(void *data)
    12.8 +int SDLCALL ThreadFunc(void *data)
    12.9  {
   12.10  	/* Set the child thread error string */
   12.11  	SDL_SetError("Thread %s (%d) had a problem: %s",
    13.1 --- a/test/testhread.c	Fri May 05 05:50:26 2006 +0000
    13.2 +++ b/test/testhread.c	Sun May 07 03:40:06 2006 +0000
    13.3 @@ -17,7 +17,7 @@
    13.4  	exit(rc);
    13.5  }
    13.6  
    13.7 -int ThreadFunc(void *data)
    13.8 +int SDLCALL ThreadFunc(void *data)
    13.9  {
   13.10  	printf("Started thread %s: My thread id is %u\n",
   13.11  				(char *)data, SDL_ThreadID());
    14.1 --- a/test/testlock.c	Fri May 05 05:50:26 2006 +0000
    14.2 +++ b/test/testlock.c	Sun May 07 03:40:06 2006 +0000
    14.3 @@ -5,7 +5,6 @@
    14.4  
    14.5  #include <signal.h>
    14.6  #include <stdio.h>
    14.7 -#include <stdlib.h>
    14.8  
    14.9  #include "SDL.h"
   14.10  #include "SDL_mutex.h"
   14.11 @@ -14,6 +13,7 @@
   14.12  static SDL_mutex *mutex = NULL;
   14.13  static Uint32 mainthread;
   14.14  static SDL_Thread *threads[6];
   14.15 +static volatile int doterminate = 0;
   14.16  
   14.17  /*
   14.18   * SDL_Quit() shouldn't be used with atexit() directly because
   14.19 @@ -31,8 +31,8 @@
   14.20  	
   14.21  void terminate(int sig)
   14.22  {
   14.23 -	printf("Process %u:  raising SIGTERM\n", SDL_ThreadID());
   14.24 -	raise(SIGTERM);
   14.25 +	signal(SIGINT, terminate);
   14.26 +	doterminate = 1;
   14.27  }
   14.28  void closemutex(int sig)
   14.29  {
   14.30 @@ -44,7 +44,7 @@
   14.31  	SDL_DestroyMutex(mutex);
   14.32  	exit(sig);
   14.33  }
   14.34 -int Run(void *data)
   14.35 +int SDLCALL Run(void *data)
   14.36  {
   14.37  	if ( SDL_ThreadID() == mainthread )
   14.38  		signal(SIGTERM, closemutex);
   14.39 @@ -63,6 +63,10 @@
   14.40  		}
   14.41  		/* If this sleep isn't done, then threads may starve */
   14.42  		SDL_Delay(10);
   14.43 +		if (SDL_ThreadID() == mainthread && doterminate) {
   14.44 +			printf("Process %u:  raising SIGTERM\n", SDL_ThreadID());
   14.45 +			raise(SIGTERM);
   14.46 +		}
   14.47  	}
   14.48  	return(0);
   14.49  }
    15.1 --- a/test/testsem.c	Fri May 05 05:50:26 2006 +0000
    15.2 +++ b/test/testsem.c	Sun May 07 03:40:06 2006 +0000
    15.3 @@ -13,7 +13,7 @@
    15.4  static SDL_sem *sem;
    15.5  int alive = 1;
    15.6  
    15.7 -int ThreadFunc(void *data)
    15.8 +int SDLCALL ThreadFunc(void *data)
    15.9  {
   15.10  	int threadnum = (int)(uintptr_t)data;
   15.11  	while ( alive ) {
    16.1 --- a/test/testtimer.c	Fri May 05 05:50:26 2006 +0000
    16.2 +++ b/test/testtimer.c	Sun May 07 03:40:06 2006 +0000
    16.3 @@ -12,13 +12,13 @@
    16.4  
    16.5  static int ticks = 0;
    16.6  
    16.7 -static Uint32 ticktock(Uint32 interval)
    16.8 +static Uint32 SDLCALL ticktock(Uint32 interval)
    16.9  {
   16.10  	++ticks;
   16.11  	return(interval);
   16.12  }
   16.13  
   16.14 -static Uint32 callback(Uint32 interval, void *param)
   16.15 +static Uint32 SDLCALL callback(Uint32 interval, void *param)
   16.16  {
   16.17    printf("Timer %d : param = %d\n", interval, (int)(uintptr_t)param);
   16.18    return interval;
    17.1 --- a/test/testwm.c	Fri May 05 05:50:26 2006 +0000
    17.2 +++ b/test/testwm.c	Sun May 07 03:40:06 2006 +0000
    17.3 @@ -168,7 +168,7 @@
    17.4  	SDL_PushEvent(&event);
    17.5  }
    17.6  
    17.7 -int FilterEvents(const SDL_Event *event)
    17.8 +int SDLCALL FilterEvents(const SDL_Event *event)
    17.9  {
   17.10  	static int reallyquit = 0;
   17.11  
    18.1 --- a/test/threadwin.c	Fri May 05 05:50:26 2006 +0000
    18.2 +++ b/test/threadwin.c	Sun May 07 03:40:06 2006 +0000
    18.3 @@ -77,7 +77,7 @@
    18.4  	return(icon);
    18.5  }
    18.6  
    18.7 -int FilterEvents(const SDL_Event *event)
    18.8 +int SDLCALL FilterEvents(const SDL_Event *event)
    18.9  {
   18.10  	static int reallyquit = 0;
   18.11  
   18.12 @@ -127,7 +127,7 @@
   18.13  	}
   18.14  }
   18.15  
   18.16 -int HandleMouse(void *unused)
   18.17 +int SDLCALL HandleMouse(void *unused)
   18.18  {
   18.19  	SDL_Event events[10];
   18.20  	int i, found;
   18.21 @@ -164,7 +164,7 @@
   18.22  	return(0);
   18.23  }
   18.24  
   18.25 -int HandleKeyboard(void *unused)
   18.26 +int SDLCALL HandleKeyboard(void *unused)
   18.27  {
   18.28  	SDL_Event events[10];
   18.29  	int i, found;
    19.1 --- a/test/torturethread.c	Fri May 05 05:50:26 2006 +0000
    19.2 +++ b/test/torturethread.c	Sun May 07 03:40:06 2006 +0000
    19.3 @@ -20,14 +20,14 @@
    19.4  	exit(rc);
    19.5  }
    19.6  
    19.7 -int SubThreadFunc(void *data) {
    19.8 +int SDLCALL SubThreadFunc(void *data) {
    19.9  	while(! *(int volatile *)data) {
   19.10  		; /*SDL_Delay(10);*/  /* do nothing */
   19.11  	}
   19.12  	return 0;
   19.13  }
   19.14  
   19.15 -int ThreadFunc(void *data) {
   19.16 +int SDLCALL ThreadFunc(void *data) {
   19.17  	SDL_Thread *sub_threads[NUMTHREADS];
   19.18  	int flags[NUMTHREADS];
   19.19  	int i;