From d7ca3ca7522cb5ec25b1f5459a20ff54675c740b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 7 May 2006 03:40:06 +0000 Subject: [PATCH] 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 | 2 ++ src/audio/SDL_audio.c | 4 +-- src/audio/SDL_audio_c.h | 2 +- src/audio/SDL_audiocvt.c | 42 ++++++++++++++++---------------- src/events/SDL_events.c | 2 +- src/file/SDL_rwops.c | 28 ++++++++++----------- src/main/win32/SDL_win32_main.c | 13 +++++++--- src/thread/SDL_thread.c | 8 +++--- src/thread/win32/SDL_systhread.c | 9 +++++++ src/video/wincommon/SDL_wingl.c | 2 +- test/loopwave.c | 2 +- test/testerror.c | 2 +- test/testhread.c | 2 +- test/testlock.c | 12 ++++++--- test/testsem.c | 2 +- test/testtimer.c | 4 +-- test/testwm.c | 2 +- test/threadwin.c | 6 ++--- test/torturethread.c | 4 +-- 19 files changed, 85 insertions(+), 63 deletions(-) diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index dd9af6cc0..71a48713f 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -168,6 +168,8 @@ extern DECLSPEC void SDLCALL SDL_free(void *mem); # elif defined(_MSC_VER) # include # define alloca _alloca +# elif defined(__WATCOMC__) +# include # elif defined(__AIX__) #pragma alloca # else diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index a7c8dded5..8ecee5afc 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -120,13 +120,13 @@ static int audio_configured = 0; #endif /* The general mixing thread function */ -int SDL_RunAudio(void *audiop) +int SDLCALL SDL_RunAudio(void *audiop) { SDL_AudioDevice *audio = (SDL_AudioDevice *)audiop; Uint8 *stream; int stream_len; void *udata; - void (*fill)(void *userdata,Uint8 *stream, int len); + void (SDLCALL *fill)(void *userdata,Uint8 *stream, int len); int silence; #if SDL_AUDIO_DRIVER_AHI int started = 0; diff --git a/src/audio/SDL_audio_c.h b/src/audio/SDL_audio_c.h index 98debed10..f5848959e 100644 --- a/src/audio/SDL_audio_c.h +++ b/src/audio/SDL_audio_c.h @@ -31,4 +31,4 @@ extern Uint16 SDL_NextAudioFormat(void); extern void SDL_CalculateAudioSpec(SDL_AudioSpec *spec); /* The actual mixing thread function */ -extern int SDL_RunAudio(void *audiop); +extern int SDLCALL SDL_RunAudio(void *audiop); diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index 9f5ae6d4d..3c361155e 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -27,7 +27,7 @@ /* Effectively mix right and left channels into a single channel */ -void SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format) { int i; Sint32 sample; @@ -169,7 +169,7 @@ void SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format) } /* Discard top 4 channels */ -void SDL_ConvertStrip(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_ConvertStrip(SDL_AudioCVT *cvt, Uint16 format) { int i; Sint32 lsample, rsample; @@ -285,7 +285,7 @@ void SDL_ConvertStrip(SDL_AudioCVT *cvt, Uint16 format) /* Discard top 2 channels of 6 */ -void SDL_ConvertStrip_2(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_ConvertStrip_2(SDL_AudioCVT *cvt, Uint16 format) { int i; Sint32 lsample, rsample; @@ -400,7 +400,7 @@ void SDL_ConvertStrip_2(SDL_AudioCVT *cvt, Uint16 format) } /* Duplicate a mono channel to both stereo channels */ -void SDL_ConvertStereo(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_ConvertStereo(SDL_AudioCVT *cvt, Uint16 format) { int i; @@ -438,7 +438,7 @@ void SDL_ConvertStereo(SDL_AudioCVT *cvt, Uint16 format) /* Duplicate a stereo channel to a pseudo-5.1 stream */ -void SDL_ConvertSurround(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_ConvertSurround(SDL_AudioCVT *cvt, Uint16 format) { int i; @@ -615,7 +615,7 @@ void SDL_ConvertSurround(SDL_AudioCVT *cvt, Uint16 format) /* Duplicate a stereo channel to a pseudo-4.0 stream */ -void SDL_ConvertSurround_4(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_ConvertSurround_4(SDL_AudioCVT *cvt, Uint16 format) { int i; @@ -768,7 +768,7 @@ void SDL_ConvertSurround_4(SDL_AudioCVT *cvt, Uint16 format) /* Convert 8-bit to 16-bit - LSB */ -void SDL_Convert16LSB(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_Convert16LSB(SDL_AudioCVT *cvt, Uint16 format) { int i; Uint8 *src, *dst; @@ -791,7 +791,7 @@ void SDL_Convert16LSB(SDL_AudioCVT *cvt, Uint16 format) } } /* Convert 8-bit to 16-bit - MSB */ -void SDL_Convert16MSB(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_Convert16MSB(SDL_AudioCVT *cvt, Uint16 format) { int i; Uint8 *src, *dst; @@ -815,7 +815,7 @@ void SDL_Convert16MSB(SDL_AudioCVT *cvt, Uint16 format) } /* Convert 16-bit to 8-bit */ -void SDL_Convert8(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_Convert8(SDL_AudioCVT *cvt, Uint16 format) { int i; Uint8 *src, *dst; @@ -841,7 +841,7 @@ void SDL_Convert8(SDL_AudioCVT *cvt, Uint16 format) } /* Toggle signed/unsigned */ -void SDL_ConvertSign(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_ConvertSign(SDL_AudioCVT *cvt, Uint16 format) { int i; Uint8 *data; @@ -870,7 +870,7 @@ void SDL_ConvertSign(SDL_AudioCVT *cvt, Uint16 format) } /* Toggle endianness */ -void SDL_ConvertEndian(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_ConvertEndian(SDL_AudioCVT *cvt, Uint16 format) { int i; Uint8 *data, tmp; @@ -892,7 +892,7 @@ void SDL_ConvertEndian(SDL_AudioCVT *cvt, Uint16 format) } /* Convert rate up by multiple of 2 */ -void SDL_RateMUL2(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_RateMUL2(SDL_AudioCVT *cvt, Uint16 format) { int i; Uint8 *src, *dst; @@ -930,7 +930,7 @@ void SDL_RateMUL2(SDL_AudioCVT *cvt, Uint16 format) /* Convert rate up by multiple of 2, for stereo */ -void SDL_RateMUL2_c2(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_RateMUL2_c2(SDL_AudioCVT *cvt, Uint16 format) { int i; Uint8 *src, *dst; @@ -973,7 +973,7 @@ void SDL_RateMUL2_c2(SDL_AudioCVT *cvt, Uint16 format) } /* Convert rate up by multiple of 2, for quad */ -void SDL_RateMUL2_c4(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_RateMUL2_c4(SDL_AudioCVT *cvt, Uint16 format) { int i; Uint8 *src, *dst; @@ -1029,7 +1029,7 @@ void SDL_RateMUL2_c4(SDL_AudioCVT *cvt, Uint16 format) /* Convert rate up by multiple of 2, for 5.1 */ -void SDL_RateMUL2_c6(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_RateMUL2_c6(SDL_AudioCVT *cvt, Uint16 format) { int i; Uint8 *src, *dst; @@ -1096,7 +1096,7 @@ void SDL_RateMUL2_c6(SDL_AudioCVT *cvt, Uint16 format) } /* Convert rate down by multiple of 2 */ -void SDL_RateDIV2(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_RateDIV2(SDL_AudioCVT *cvt, Uint16 format) { int i; Uint8 *src, *dst; @@ -1131,7 +1131,7 @@ void SDL_RateDIV2(SDL_AudioCVT *cvt, Uint16 format) /* Convert rate down by multiple of 2, for stereo */ -void SDL_RateDIV2_c2(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_RateDIV2_c2(SDL_AudioCVT *cvt, Uint16 format) { int i; Uint8 *src, *dst; @@ -1169,7 +1169,7 @@ void SDL_RateDIV2_c2(SDL_AudioCVT *cvt, Uint16 format) /* Convert rate down by multiple of 2, for quad */ -void SDL_RateDIV2_c4(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_RateDIV2_c4(SDL_AudioCVT *cvt, Uint16 format) { int i; Uint8 *src, *dst; @@ -1212,7 +1212,7 @@ void SDL_RateDIV2_c4(SDL_AudioCVT *cvt, Uint16 format) } /* Convert rate down by multiple of 2, for 5.1 */ -void SDL_RateDIV2_c6(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_RateDIV2_c6(SDL_AudioCVT *cvt, Uint16 format) { int i; Uint8 *src, *dst; @@ -1261,7 +1261,7 @@ void SDL_RateDIV2_c6(SDL_AudioCVT *cvt, Uint16 format) } /* Very slow rate conversion routine */ -void SDL_RateSLOW(SDL_AudioCVT *cvt, Uint16 format) +void SDLCALL SDL_RateSLOW(SDL_AudioCVT *cvt, Uint16 format) { double ipos; int i, clen; @@ -1474,7 +1474,7 @@ int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, Uint32 hi_rate, lo_rate; int len_mult; double len_ratio; - void (*rate_cvt)(SDL_AudioCVT *cvt, Uint16 format); + void (SDLCALL *rate_cvt)(SDL_AudioCVT *cvt, Uint16 format); if ( src_rate > dst_rate ) { hi_rate = src_rate; diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index ac038be54..1a51dbd7e 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -87,7 +87,7 @@ void SDL_Unlock_EventThread(void) #include #endif -static int SDL_GobbleEvents(void *unused) +static int SDLCALL SDL_GobbleEvents(void *unused) { event_thread = SDL_ThreadID(); diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index c4b2b1807..add218fd2 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -43,7 +43,7 @@ #define INVALID_SET_FILE_POINTER 0xFFFFFFFF #endif -static int win32_file_open(SDL_RWops *context, const char *filename, const char *mode) +static int SDLCALL win32_file_open(SDL_RWops *context, const char *filename, const char *mode) { #ifndef _WIN32_WCE UINT old_error_mode; @@ -108,7 +108,7 @@ static int win32_file_open(SDL_RWops *context, const char *filename, const char return 0; /* ok */ } -static int win32_file_seek(SDL_RWops *context, int offset, int whence) +static int SDLCALL win32_file_seek(SDL_RWops *context, int offset, int whence) { DWORD win32whence; int file_pos; @@ -138,7 +138,7 @@ static int win32_file_seek(SDL_RWops *context, int offset, int whence) SDL_Error(SDL_EFSEEK); return -1; /* error */ } -static int win32_file_read(SDL_RWops *context, void *ptr, int size, int maxnum) +static int SDLCALL win32_file_read(SDL_RWops *context, void *ptr, int size, int maxnum) { int total_bytes; @@ -156,7 +156,7 @@ static int win32_file_read(SDL_RWops *context, void *ptr, int size, int maxnum) nread = byte_read/size; return nread; } -static int win32_file_write(SDL_RWops *context, const void *ptr, int size, int num) +static int SDLCALL win32_file_write(SDL_RWops *context, const void *ptr, int size, int num) { int total_bytes; @@ -183,7 +183,7 @@ static int win32_file_write(SDL_RWops *context, const void *ptr, int size, int n nwritten = byte_written/size; return nwritten; } -static int win32_file_close(SDL_RWops *context) +static int SDLCALL win32_file_close(SDL_RWops *context) { if ( context ) { @@ -201,7 +201,7 @@ static int win32_file_close(SDL_RWops *context) /* Functions to read/write stdio file pointers */ -static int stdio_seek(SDL_RWops *context, int offset, int whence) +static int SDLCALL stdio_seek(SDL_RWops *context, int offset, int whence) { if ( fseek(context->hidden.stdio.fp, offset, whence) == 0 ) { return(ftell(context->hidden.stdio.fp)); @@ -210,7 +210,7 @@ static int stdio_seek(SDL_RWops *context, int offset, int whence) return(-1); } } -static int stdio_read(SDL_RWops *context, void *ptr, int size, int maxnum) +static int SDLCALL stdio_read(SDL_RWops *context, void *ptr, int size, int maxnum) { size_t nread; @@ -220,7 +220,7 @@ static int stdio_read(SDL_RWops *context, void *ptr, int size, int maxnum) } return(nread); } -static int stdio_write(SDL_RWops *context, const void *ptr, int size, int num) +static int SDLCALL stdio_write(SDL_RWops *context, const void *ptr, int size, int num) { size_t nwrote; @@ -230,7 +230,7 @@ static int stdio_write(SDL_RWops *context, const void *ptr, int size, int num) } return(nwrote); } -static int stdio_close(SDL_RWops *context) +static int SDLCALL stdio_close(SDL_RWops *context) { if ( context ) { if ( context->hidden.stdio.autoclose ) { @@ -245,7 +245,7 @@ static int stdio_close(SDL_RWops *context) /* Functions to read/write memory pointers */ -static int mem_seek(SDL_RWops *context, int offset, int whence) +static int SDLCALL mem_seek(SDL_RWops *context, int offset, int whence) { Uint8 *newpos; @@ -272,7 +272,7 @@ static int mem_seek(SDL_RWops *context, int offset, int whence) context->hidden.mem.here = newpos; return(context->hidden.mem.here-context->hidden.mem.base); } -static int mem_read(SDL_RWops *context, void *ptr, int size, int maxnum) +static int SDLCALL mem_read(SDL_RWops *context, void *ptr, int size, int maxnum) { size_t total_bytes; size_t mem_available; @@ -292,7 +292,7 @@ static int mem_read(SDL_RWops *context, void *ptr, int size, int maxnum) return (total_bytes / size); } -static int mem_write(SDL_RWops *context, const void *ptr, int size, int num) +static int SDLCALL mem_write(SDL_RWops *context, const void *ptr, int size, int num) { if ( (context->hidden.mem.here + (num*size)) > context->hidden.mem.stop ) { num = (context->hidden.mem.stop-context->hidden.mem.here)/size; @@ -301,12 +301,12 @@ static int mem_write(SDL_RWops *context, const void *ptr, int size, int num) context->hidden.mem.here += num*size; return(num); } -static int mem_writeconst(SDL_RWops *context, const void *ptr, int size, int num) +static int SDLCALL mem_writeconst(SDL_RWops *context, const void *ptr, int size, int num) { SDL_SetError("Can't write to read-only memory"); return(-1); } -static int mem_close(SDL_RWops *context) +static int SDLCALL mem_close(SDL_RWops *context) { if ( context ) { SDL_FreeRW(context); diff --git a/src/main/win32/SDL_win32_main.c b/src/main/win32/SDL_win32_main.c index 0acd87ed3..d78708f33 100644 --- a/src/main/win32/SDL_win32_main.c +++ b/src/main/win32/SDL_win32_main.c @@ -121,8 +121,15 @@ static BOOL OutOfMemory(void) return FALSE; } +/* SDL_Quit() shouldn't be used with atexit() directly because + calling conventions may differ... */ +static void cleanup(void) +{ + SDL_Quit(); +} + /* Remove the output files if there was no output written */ -static void __cdecl cleanup_output(void) +static void cleanup_output(void) { #ifndef NO_STDIO_REDIRECT FILE *file; @@ -188,7 +195,7 @@ int console_main(int argc, char *argv[]) if ( bufp == NULL ) { return OutOfMemory(); } - SDL_strlcpy(bufp, appname, n); + SDL_strlcpy(bufp, appname, n+1); appname = bufp; /* Load SDL dynamic link library */ @@ -197,7 +204,7 @@ int console_main(int argc, char *argv[]) return(FALSE); } atexit(cleanup_output); - atexit(SDL_Quit); + atexit(cleanup); /* Sam: We still need to pass in the application handle so that diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index ff594c3bf..09b07bb8f 100644 --- a/src/thread/SDL_thread.c +++ b/src/thread/SDL_thread.c @@ -168,7 +168,7 @@ SDL_error *SDL_GetErrBuf(void) /* Arguments and callback to setup and run the user thread function */ typedef struct { - int (*func)(void *); + int (SDLCALL *func)(void *); void *data; SDL_Thread *info; SDL_sem *wait; @@ -177,7 +177,7 @@ typedef struct { void SDL_RunThread(void *data) { thread_args *args; - int (*userfunc)(void *); + int (SDLCALL *userfunc)(void *); void *userdata; int *statusloc; @@ -204,9 +204,9 @@ void SDL_RunThread(void *data) #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD #undef SDL_CreateThread -DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread) +DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread) #else -DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data) +DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data) #endif { SDL_Thread *thread; diff --git a/src/thread/win32/SDL_systhread.c b/src/thread/win32/SDL_systhread.c index 2bee82c2d..67b176dfb 100644 --- a/src/thread/win32/SDL_systhread.c +++ b/src/thread/win32/SDL_systhread.c @@ -41,6 +41,15 @@ typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, unsigned (__stdcall *func)(void *), void *arg, unsigned, unsigned *threadID); typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code); +#elif defined(__WATCOMC__) +/* This is for Watcom targets except OS2 */ +#if __WATCOMC__ < 1240 +#define __watcall +#endif +typedef unsigned long (__watcall *pfnSDL_CurrentBeginThread) (void *, unsigned, + unsigned (__stdcall *func)(void *), void *arg, + unsigned, unsigned *threadID); +typedef void (__watcall *pfnSDL_CurrentEndThread)(unsigned code); #else typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned, unsigned (__stdcall *func)(void *), void *arg, diff --git a/src/video/wincommon/SDL_wingl.c b/src/video/wincommon/SDL_wingl.c index d54d12f0f..d98dbfeba 100644 --- a/src/video/wincommon/SDL_wingl.c +++ b/src/video/wincommon/SDL_wingl.c @@ -177,7 +177,7 @@ int WIN_GL_SetupWindow(_THIS) int iAttribs[64]; int *iAttr; float fAttribs[1] = { 0 }; - const GLubyte *(*glGetStringFunc)(GLenum); + const GLubyte *(WINAPI *glGetStringFunc)(GLenum); const char *wglext; /* load the gl driver from a default path */ diff --git a/test/loopwave.c b/test/loopwave.c index a0923384e..e685aee65 100644 --- a/test/loopwave.c +++ b/test/loopwave.c @@ -32,7 +32,7 @@ static void quit(int rc) } -void fillerup(void *unused, Uint8 *stream, int len) +void SDLCALL fillerup(void *unused, Uint8 *stream, int len) { Uint8 *waveptr; int waveleft; diff --git a/test/testerror.c b/test/testerror.c index 1d807bdbe..9211dfcec 100644 --- a/test/testerror.c +++ b/test/testerror.c @@ -17,7 +17,7 @@ static void quit(int rc) exit(rc); } -int ThreadFunc(void *data) +int SDLCALL ThreadFunc(void *data) { /* Set the child thread error string */ SDL_SetError("Thread %s (%d) had a problem: %s", diff --git a/test/testhread.c b/test/testhread.c index 168522742..f87f3745c 100644 --- a/test/testhread.c +++ b/test/testhread.c @@ -17,7 +17,7 @@ static void quit(int rc) exit(rc); } -int ThreadFunc(void *data) +int SDLCALL ThreadFunc(void *data) { printf("Started thread %s: My thread id is %u\n", (char *)data, SDL_ThreadID()); diff --git a/test/testlock.c b/test/testlock.c index 1c1514b63..bda4b55f2 100644 --- a/test/testlock.c +++ b/test/testlock.c @@ -5,7 +5,6 @@ #include #include -#include #include "SDL.h" #include "SDL_mutex.h" @@ -14,6 +13,7 @@ static SDL_mutex *mutex = NULL; static Uint32 mainthread; static SDL_Thread *threads[6]; +static volatile int doterminate = 0; /* * SDL_Quit() shouldn't be used with atexit() directly because @@ -31,8 +31,8 @@ void printid(void) void terminate(int sig) { - printf("Process %u: raising SIGTERM\n", SDL_ThreadID()); - raise(SIGTERM); + signal(SIGINT, terminate); + doterminate = 1; } void closemutex(int sig) { @@ -44,7 +44,7 @@ void closemutex(int sig) SDL_DestroyMutex(mutex); exit(sig); } -int Run(void *data) +int SDLCALL Run(void *data) { if ( SDL_ThreadID() == mainthread ) signal(SIGTERM, closemutex); @@ -63,6 +63,10 @@ int Run(void *data) } /* If this sleep isn't done, then threads may starve */ SDL_Delay(10); + if (SDL_ThreadID() == mainthread && doterminate) { + printf("Process %u: raising SIGTERM\n", SDL_ThreadID()); + raise(SIGTERM); + } } return(0); } diff --git a/test/testsem.c b/test/testsem.c index 699038985..9c0940eb9 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -13,7 +13,7 @@ static SDL_sem *sem; int alive = 1; -int ThreadFunc(void *data) +int SDLCALL ThreadFunc(void *data) { int threadnum = (int)(uintptr_t)data; while ( alive ) { diff --git a/test/testtimer.c b/test/testtimer.c index b00577f38..95608c120 100644 --- a/test/testtimer.c +++ b/test/testtimer.c @@ -12,13 +12,13 @@ static int ticks = 0; -static Uint32 ticktock(Uint32 interval) +static Uint32 SDLCALL ticktock(Uint32 interval) { ++ticks; return(interval); } -static Uint32 callback(Uint32 interval, void *param) +static Uint32 SDLCALL callback(Uint32 interval, void *param) { printf("Timer %d : param = %d\n", interval, (int)(uintptr_t)param); return interval; diff --git a/test/testwm.c b/test/testwm.c index a1a34f6cf..20d88fe80 100644 --- a/test/testwm.c +++ b/test/testwm.c @@ -168,7 +168,7 @@ void HotKey_Quit(void) SDL_PushEvent(&event); } -int FilterEvents(const SDL_Event *event) +int SDLCALL FilterEvents(const SDL_Event *event) { static int reallyquit = 0; diff --git a/test/threadwin.c b/test/threadwin.c index 20cd1bc91..c7ea5c8a7 100644 --- a/test/threadwin.c +++ b/test/threadwin.c @@ -77,7 +77,7 @@ SDL_Surface *LoadIconSurface(char *file, Uint8 **maskp) return(icon); } -int FilterEvents(const SDL_Event *event) +int SDLCALL FilterEvents(const SDL_Event *event) { static int reallyquit = 0; @@ -127,7 +127,7 @@ int FilterEvents(const SDL_Event *event) } } -int HandleMouse(void *unused) +int SDLCALL HandleMouse(void *unused) { SDL_Event events[10]; int i, found; @@ -164,7 +164,7 @@ int HandleMouse(void *unused) return(0); } -int HandleKeyboard(void *unused) +int SDLCALL HandleKeyboard(void *unused) { SDL_Event events[10]; int i, found; diff --git a/test/torturethread.c b/test/torturethread.c index d8b1935d5..cb18954d6 100644 --- a/test/torturethread.c +++ b/test/torturethread.c @@ -20,14 +20,14 @@ static void quit(int rc) exit(rc); } -int SubThreadFunc(void *data) { +int SDLCALL SubThreadFunc(void *data) { while(! *(int volatile *)data) { ; /*SDL_Delay(10);*/ /* do nothing */ } return 0; } -int ThreadFunc(void *data) { +int SDLCALL ThreadFunc(void *data) { SDL_Thread *sub_threads[NUMTHREADS]; int flags[NUMTHREADS]; int i;