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. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401728
This commit is contained in:
parent
cab8a203a7
commit
b4ba6518d6
19 changed files with 85 additions and 63 deletions
|
@ -168,6 +168,8 @@ extern DECLSPEC void SDLCALL SDL_free(void *mem);
|
|||
# elif defined(_MSC_VER)
|
||||
# include <malloc.h>
|
||||
# define alloca _alloca
|
||||
# elif defined(__WATCOMC__)
|
||||
# include <malloc.h>
|
||||
# elif defined(__AIX__)
|
||||
#pragma alloca
|
||||
# else
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -87,7 +87,7 @@ void SDL_Unlock_EventThread(void)
|
|||
#include <time.h>
|
||||
#endif
|
||||
|
||||
static int SDL_GobbleEvents(void *unused)
|
||||
static int SDLCALL SDL_GobbleEvents(void *unused)
|
||||
{
|
||||
event_thread = SDL_ThreadID();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue