# HG changeset patch # User Sam Lantinga # Date 1139304558 0 # Node ID 604d73db6802659f255e02f62586ac02eb19dcd7 # Parent c687f06c7473b8448f0f77418b45c3e2e161c529 Removed uses of stdlib.h and string.h diff -r c687f06c7473 -r 604d73db6802 src/SDL.c --- a/src/SDL.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/SDL.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,9 +27,9 @@ #endif #include "SDL.h" +#include "SDL_stdlib.h" #include "SDL_endian.h" #include "SDL_fatal.h" -#include "SDL_stdlib.h" #ifndef DISABLE_VIDEO #include "SDL_leaks.h" #endif diff -r c687f06c7473 -r 604d73db6802 src/SDL_error.c --- a/src/SDL_error.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/SDL_error.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,9 +22,9 @@ /* Simple error handling in SDL */ -#include "SDL_types.h" #include "SDL_stdlib.h" #include "SDL_string.h" +#include "SDL_types.h" #include "SDL_error.h" #include "SDL_error_c.h" #ifndef DISABLE_THREADS diff -r c687f06c7473 -r 604d73db6802 src/audio/SDL_audiodev.c --- a/src/audio/SDL_audiodev.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/SDL_audiodev.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,13 +24,12 @@ #if defined(unix) || defined(__unix__) || defined(__riscos__) -#include -#include #include #include #include -#include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audiodev_c.h" #ifndef _PATH_DEV_DSP @@ -80,7 +79,8 @@ instance = 1; do { /* Don't use errno ENOENT - it may not be thread-safe */ - sprintf(audiopath, "%s%d", audiodev, instance++); + SDL_snprintf(audiopath, SDL_arraysize(audiopath), + "%s%d", audiodev, instance++); exists = 0; if ( stat(audiopath, &sb) == 0 ) { exists = 1; @@ -100,11 +100,11 @@ /* Get the name of the audio device we use for output */ -#include #include #include -#include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audiodev_c.h" #ifndef _PATH_DEV_DSP @@ -158,7 +158,7 @@ cycle = 0; while( devsettings[cycle][0] != '\0' ) { - sprintf( audiopath, + SDL_snprintf( audiopath, SDL_arraysize(audiopath), _PATH_DEV_DSP, devsettings[cycle][0], devsettings[cycle][1], diff -r c687f06c7473 -r 604d73db6802 src/audio/SDL_audiomem.c --- a/src/audio/SDL_audiomem.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/SDL_audiomem.c Tue Feb 07 09:29:18 2006 +0000 @@ -31,8 +31,8 @@ #include #endif +#include "SDL_stdlib.h" #include "SDL_audiomem.h" -#include "SDL_stdlib.h" /* Allocate memory that will be shared between threads (freed on exit) */ void *SDL_AllocAudioMem(int size) diff -r c687f06c7473 -r 604d73db6802 src/audio/SDL_wave.c --- a/src/audio/SDL_wave.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/SDL_wave.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,10 +24,10 @@ /* Microsoft WAVE file loading routines */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_audio.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_wave.h" #include "SDL_endian.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/alsa/SDL_alsa_audio.c --- a/src/audio/alsa/SDL_alsa_audio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/alsa/SDL_alsa_audio.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,16 +24,11 @@ /* Allow access to a raw mixing buffer */ -#include -#include -#include -#include -#include -#include -#include #include -#include +#include /* For kill() */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_error.h" #include "SDL_audiomem.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/amigaos/SDL_ahiaudio.h --- a/src/audio/amigaos/SDL_ahiaudio.h Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/amigaos/SDL_ahiaudio.h Tue Feb 07 09:29:18 2006 +0000 @@ -30,8 +30,6 @@ #else #include #endif -#include -#include #include #include "mydebug.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/arts/SDL_artsaudio.c --- a/src/audio/arts/SDL_artsaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/arts/SDL_artsaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,14 +22,8 @@ /* Allow access to a raw mixing buffer */ -#include -#include -#include -#include -#include -#include -#include - +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_error.h" #include "SDL_audiomem.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/baudio/SDL_beaudio.cc --- a/src/audio/baudio/SDL_beaudio.cc Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/baudio/SDL_beaudio.cc Tue Feb 07 09:29:18 2006 +0000 @@ -22,15 +22,14 @@ /* Allow access to the audio stream on BeOS */ -#include -#include -#include #include #include "SDL_BeApp.h" extern "C" { +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_audio_c.h" #include "SDL_sysaudio.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/dart/SDL_dart.c --- a/src/audio/dart/SDL_dart.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/dart/SDL_dart.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,10 +22,8 @@ /* Allow access to a raw mixing buffer */ -#include -#include -#include - +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_types.h" #include "SDL_error.h" #include "SDL_timer.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/dc/SDL_dcaudio.c --- a/src/audio/dc/SDL_dcaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/dc/SDL_dcaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,10 +23,6 @@ /* Output dreamcast aica */ -#include -#include -#include -#include #include #include #include @@ -34,6 +30,8 @@ #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_error.h" #include "SDL_audiomem.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/disk/SDL_diskaudio.c --- a/src/audio/disk/SDL_diskaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/disk/SDL_diskaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -25,9 +25,7 @@ /* Output raw audio data to a file. */ -#include #include -#include #include #include #include @@ -36,6 +34,8 @@ #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_error.h" #include "SDL_audiomem.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/dma/SDL_dmaaudio.c --- a/src/audio/dma/SDL_dmaaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/dma/SDL_dmaaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,9 +22,7 @@ /* Allow access to a raw mixing buffer */ -#include #include -#include #include #include #include @@ -46,6 +44,8 @@ #define MAP_FAILED ((Uint8 *)-1) #endif +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_error.h" #include "SDL_audiomem.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/dmedia/SDL_irixaudio.c --- a/src/audio/dmedia/SDL_irixaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/dmedia/SDL_irixaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,8 +23,8 @@ /* Allow access to a raw mixing buffer (For IRIX 6.5 and higher) */ /* patch for IRIX 5 by Georg Schwarz 18/07/2004 */ -#include - +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_endian.h" #include "SDL_timer.h" #include "SDL_audio.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/dsp/SDL_dspaudio.c --- a/src/audio/dsp/SDL_dspaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/dsp/SDL_dspaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -25,9 +25,7 @@ /* Allow access to a raw mixing buffer */ -#include -#include -#include +#include /* For perror() ... should we really do this? */ #include #include #include @@ -43,6 +41,8 @@ #include #endif +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_error.h" #include "SDL_audiomem.h" @@ -303,7 +303,6 @@ #endif if ( ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0 ) { perror("SNDCTL_DSP_SETFRAGMENT"); - fprintf(stderr, "Warning: Couldn't set audio fragment size\n"); } #ifdef DEBUG_AUDIO { audio_buf_info info; diff -r c687f06c7473 -r 604d73db6802 src/audio/esd/SDL_esdaudio.c --- a/src/audio/esd/SDL_esdaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/esd/SDL_esdaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,15 +24,12 @@ #ifdef ESD_SUPPORT -#include -#include -#include #include -#include -#include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_error.h" #include "SDL_audiomem.h" @@ -257,7 +254,7 @@ FILE *fp; static char temp[BUFSIZ]; - sprintf(temp, "/proc/%d/cmdline", getpid()); + SDL_snprintf(temp, SDL_arraysize(temp), "/proc/%d/cmdline", getpid()); fp = fopen(temp, "r"); if ( fp != NULL ) { if ( fgets(temp, sizeof(temp)-1, fp) ) { diff -r c687f06c7473 -r 604d73db6802 src/audio/macosx/SDL_coreaudio.c --- a/src/audio/macosx/SDL_coreaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/macosx/SDL_coreaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,11 +22,8 @@ #include -#include -#include -#include -#include - +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_endian.h" #include "SDL_audio.h" #include "SDL_audio_c.h" @@ -113,8 +110,10 @@ /* No SDL conversion should be needed here, ever, since we accept any input format in OpenAudio, and leave the conversion to CoreAudio. */ + /* assert(!this->convert.needed); assert(this->spec.channels == ioData->mNumberChannels); + */ remaining = ioData->mDataByteSize; ptr = ioData->mData; @@ -270,8 +269,7 @@ /* Allocate a sample buffer */ bufferOffset = bufferSize = this->spec.size; buffer = SDL_malloc(bufferSize); - assert(buffer); - + /* Finally, start processing of the audio unit */ result = AudioOutputUnitStart (outputAudioUnit); CHECK_RESULT("AudioOutputUnitStart") diff -r c687f06c7473 -r 604d73db6802 src/audio/macrom/SDL_romaudio.c --- a/src/audio/macrom/SDL_romaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/macrom/SDL_romaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -30,9 +30,6 @@ # include #endif -#include -#include - #if !defined(NewSndCallBackUPP) && (UNIVERSAL_INTERFACES_VERSION < 0x0335) #if !defined(NewSndCallBackProc) /* avoid circular redefinition... */ #define NewSndCallBackUPP NewSndCallBackProc @@ -42,6 +39,8 @@ #endif #endif +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_endian.h" #include "SDL_audio.h" #include "SDL_audio_c.h" @@ -455,7 +454,7 @@ /* allocate the 2 double-back buffers */ for ( i=0; i<2; ++i ) { - audio_buf[i] = calloc(1, sizeof(SndDoubleBuffer)+spec->size); + audio_buf[i] = SDL_calloc(1, sizeof(SndDoubleBuffer)+spec->size); if ( audio_buf[i] == NULL ) { SDL_OutOfMemory(); return(-1); diff -r c687f06c7473 -r 604d73db6802 src/audio/mint/SDL_mintaudio_dma8.c --- a/src/audio/mint/SDL_mintaudio_dma8.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/mint/SDL_mintaudio_dma8.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,15 +27,13 @@ Patrice Mandin */ -#include -#include -#include - /* Mint includes */ #include #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_endian.h" #include "SDL_audio.h" #include "SDL_audio_c.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/mint/SDL_mintaudio_gsxb.c --- a/src/audio/mint/SDL_mintaudio_gsxb.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/mint/SDL_mintaudio_gsxb.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,15 +27,13 @@ Patrice Mandin */ -#include -#include -#include - /* Mint includes */ #include #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_endian.h" #include "SDL_audio.h" #include "SDL_audio_c.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/mint/SDL_mintaudio_mcsn.c --- a/src/audio/mint/SDL_mintaudio_mcsn.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/mint/SDL_mintaudio_mcsn.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,9 +27,6 @@ Patrice Mandin */ -#include -#include -#include #include /* Mint includes */ @@ -37,6 +34,8 @@ #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_endian.h" #include "SDL_audio.h" #include "SDL_audio_c.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/mint/SDL_mintaudio_stfa.c --- a/src/audio/mint/SDL_mintaudio_stfa.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/mint/SDL_mintaudio_stfa.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,15 +27,13 @@ Patrice Mandin */ -#include -#include -#include - /* Mint includes */ #include #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_endian.h" #include "SDL_audio.h" #include "SDL_audio_c.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/mint/SDL_mintaudio_xbios.c --- a/src/audio/mint/SDL_mintaudio_xbios.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/mint/SDL_mintaudio_xbios.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,9 +27,6 @@ Patrice Mandin, Didier Méquignon */ -#include -#include -#include #include #include @@ -38,6 +35,8 @@ #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_endian.h" #include "SDL_audio.h" #include "SDL_audio_c.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/mme/SDL_mmeaudio.c --- a/src/audio/mme/SDL_mmeaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/mme/SDL_mmeaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -91,7 +91,7 @@ int len; char errbuf[MAXERRORLENGTH]; - sprintf(errbuf, "%s: ", function); + SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: ", function); len = SDL_strlen(errbuf); waveOutGetErrorText(code, errbuf+len, MAXERRORLENGTH-len); SDL_SetError("%s",errbuf); diff -r c687f06c7473 -r 604d73db6802 src/audio/mme/SDL_mmeaudio.h --- a/src/audio/mme/SDL_mmeaudio.h Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/mme/SDL_mmeaudio.h Tue Feb 07 09:29:18 2006 +0000 @@ -22,9 +22,6 @@ /* Allow access to a raw mixing buffer */ -#include -#include -#include #include #include "SDL_audio.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/nas/SDL_nasaudio.c --- a/src/audio/nas/SDL_nasaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/nas/SDL_nasaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -26,13 +26,11 @@ /* Allow access to a raw mixing buffer */ -#include -#include -#include -#include #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_error.h" #include "SDL_audiomem.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/nto/SDL_nto_audio.c --- a/src/audio/nto/SDL_nto_audio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/nto/SDL_nto_audio.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,9 +20,6 @@ slouken@libsdl.org */ -#include -#include -#include #include #include #include @@ -34,6 +31,8 @@ #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_error.h" #include "SDL_audiomem.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/openbsd/SDL_openbsdaudio.c --- a/src/audio/openbsd/SDL_openbsdaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/openbsd/SDL_openbsdaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -25,19 +25,17 @@ * vedge@vedge.com.ar. */ -#include -#include -#include #include #include #include -#include #include #include #include #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_error.h" #include "SDL_audiomem.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/paudio/SDL_paudio.c --- a/src/audio/paudio/SDL_paudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/paudio/SDL_paudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,9 +24,6 @@ /* Allow access to a raw mixing buffer */ -#include -#include -#include #include #include #include @@ -34,6 +31,8 @@ #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_error.h" #include "SDL_audiomem.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/sun/SDL_sunaudio.c --- a/src/audio/sun/SDL_sunaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/sun/SDL_sunaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,11 +22,8 @@ /* Allow access to a raw mixing buffer */ -#include -#include #include #include -#include #ifdef __NetBSD__ #include #include @@ -39,6 +36,8 @@ #endif #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_endian.h" #include "SDL_audio.h" #include "SDL_audiomem.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/ums/SDL_umsaudio.c --- a/src/audio/ums/SDL_umsaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/ums/SDL_umsaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,9 +24,6 @@ /* Allow access to a raw mixing buffer */ -#include -#include -#include #include #include #include @@ -36,6 +33,8 @@ #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_error.h" #include "SDL_audio_c.h" diff -r c687f06c7473 -r 604d73db6802 src/audio/windib/SDL_dibaudio.c --- a/src/audio/windib/SDL_dibaudio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/windib/SDL_dibaudio.c Tue Feb 07 09:29:18 2006 +0000 @@ -25,11 +25,11 @@ #include "SDL_windows.h" #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_audio.h" #include "SDL_mutex.h" #include "SDL_timer.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_audio_c.h" #include "SDL_dibaudio.h" #if defined(_WIN32_WCE) && (_WIN32_WCE < 300) diff -r c687f06c7473 -r 604d73db6802 src/audio/windx5/SDL_dx5audio.c --- a/src/audio/windx5/SDL_dx5audio.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/audio/windx5/SDL_dx5audio.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,12 +22,12 @@ /* Allow access to a raw mixing buffer */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_types.h" #include "SDL_error.h" #include "SDL_timer.h" #include "SDL_audio.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_audio_c.h" #include "SDL_dx5audio.h" diff -r c687f06c7473 -r 604d73db6802 src/cdrom/SDL_cdrom.c --- a/src/cdrom/SDL_cdrom.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/SDL_cdrom.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,10 +22,10 @@ /* This is the CD-audio control API for Simple DirectMedia Layer */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_cdrom.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_syscdrom.h" #if !defined(macintosh) diff -r c687f06c7473 -r 604d73db6802 src/cdrom/aix/SDL_syscdrom.c --- a/src/cdrom/aix/SDL_syscdrom.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/aix/SDL_syscdrom.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,11 +27,8 @@ #define DEBUG_CDROM 1 #include -#include #include #include -#include -#include #include #include @@ -43,6 +40,8 @@ #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_cdrom.h" #include "SDL_syscdrom.h" diff -r c687f06c7473 -r 604d73db6802 src/cdrom/beos/SDL_syscdrom.cc --- a/src/cdrom/beos/SDL_syscdrom.cc Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/beos/SDL_syscdrom.cc Tue Feb 07 09:29:18 2006 +0000 @@ -25,10 +25,7 @@ */ #include -#include #include -#include -#include #include #include @@ -36,6 +33,8 @@ #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_cdrom.h" extern "C" { diff -r c687f06c7473 -r 604d73db6802 src/cdrom/bsdi/SDL_syscdrom.c --- a/src/cdrom/bsdi/SDL_syscdrom.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/bsdi/SDL_syscdrom.c Tue Feb 07 09:29:18 2006 +0000 @@ -29,18 +29,16 @@ */ #include -#include #include #include -#include -#include -#include #include #include #include #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_cdrom.h" #include "SDL_syscdrom.h" @@ -303,7 +301,7 @@ char *insert; exists = 1; for ( j=checklist[i][1]; exists; ++j ) { - sprintf(drive, "/dev/%sc", &checklist[i][3]); + SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%sc", &checklist[i][3]); insert = SDL_strchr(drive, '?'); if ( insert != NULL ) { *insert = j; @@ -323,7 +321,7 @@ } } } else { - sprintf(drive, "/dev/%s", checklist[i]); + SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s", checklist[i]); if ( CheckDrive(drive, &stbuf) > 0 ) { AddDrive(drive, &stbuf); } diff -r c687f06c7473 -r 604d73db6802 src/cdrom/dc/SDL_syscdrom.c --- a/src/cdrom/dc/SDL_syscdrom.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/dc/SDL_syscdrom.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,8 +22,6 @@ /* Functions for system-level CD-ROM audio control */ -#include -#include #include #include diff -r c687f06c7473 -r 604d73db6802 src/cdrom/freebsd/SDL_syscdrom.c --- a/src/cdrom/freebsd/SDL_syscdrom.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/freebsd/SDL_syscdrom.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,15 +23,14 @@ /* Functions for system-level CD-ROM audio control */ #include -#include #include #include -#include -#include #include #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_cdrom.h" #include "SDL_syscdrom.h" @@ -189,7 +188,7 @@ char *insert; exists = 1; for ( j=checklist[i][1]; exists; ++j ) { - sprintf(drive, "/dev/%sc", &checklist[i][3]); + SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%sc", &checklist[i][3]); insert = SDL_strchr(drive, '?'); if ( insert != NULL ) { *insert = j; @@ -209,7 +208,7 @@ } } } else { - sprintf(drive, "/dev/%s", checklist[i]); + SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s", checklist[i]); if ( CheckDrive(drive, &stbuf) > 0 ) { AddDrive(drive, &stbuf); } diff -r c687f06c7473 -r 604d73db6802 src/cdrom/linux/SDL_syscdrom.c --- a/src/cdrom/linux/SDL_syscdrom.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/linux/SDL_syscdrom.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,12 +23,9 @@ /* Functions for system-level CD-ROM audio control */ #include -#include #include #include #include -#include -#include #include #include #ifdef __linux__ @@ -83,6 +80,8 @@ #endif #endif /* USE_MNTENT */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_cdrom.h" #include "SDL_syscdrom.h" @@ -336,7 +335,7 @@ char *insert; exists = 1; for ( j=checklist[i][1]; exists; ++j ) { - sprintf(drive, "/dev/%s", &checklist[i][3]); + SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s", &checklist[i][3]); insert = SDL_strchr(drive, '?'); if ( insert != NULL ) { *insert = j; @@ -359,7 +358,7 @@ } } } else { - sprintf(drive, "/dev/%s", checklist[i]); + SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s", checklist[i]); #ifdef DEBUG_CDROM fprintf(stderr, "Checking possible CD-ROM drive: %s\n", drive); #endif diff -r c687f06c7473 -r 604d73db6802 src/cdrom/macosx/AudioFileReaderThread.c --- a/src/cdrom/macosx/AudioFileReaderThread.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/macosx/AudioFileReaderThread.c Tue Feb 07 09:29:18 2006 +0000 @@ -546,7 +546,7 @@ { if (afm != NULL) { if (afm->mFileBuffer) { - free (afm->mFileBuffer); + free(afm->mFileBuffer); } SDL_free(afm); @@ -594,7 +594,7 @@ afm->mBufferOffset = inChunkSize; afm->mChunkSize = inChunkSize; afm->mFileLength = inFileLength; - afm->mFileBuffer = (char*) malloc (afm->mChunkSize * 2); + afm->mFileBuffer = (char*) SDL_malloc(afm->mChunkSize * 2); FSGetForkPosition(afm->mForkRefNum, &afm->mAudioDataOffset); assert (afm->mFileBuffer != NULL); return afm; diff -r c687f06c7473 -r 604d73db6802 src/cdrom/macosx/SDLOSXCAGuard.c --- a/src/cdrom/macosx/SDLOSXCAGuard.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/macosx/SDLOSXCAGuard.c Tue Feb 07 09:29:18 2006 +0000 @@ -68,12 +68,19 @@ // Includes //============================================================================= +/* #include #include #include +*/ +#include "SDL_stdlib.h" +#include "SDL_string.h" //#define NDEBUG 1 +/* #include +*/ +#define assert(X) #include "SDLOSXCAGuard.h" diff -r c687f06c7473 -r 604d73db6802 src/cdrom/macosx/SDL_syscdrom.c --- a/src/cdrom/macosx/SDL_syscdrom.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/macosx/SDL_syscdrom.c Tue Feb 07 09:29:18 2006 +0000 @@ -58,7 +58,7 @@ return 0; /* Allocate memory for tracks */ - tracks[cdrom->id] = (FSRef*) calloc (1, sizeof(**tracks) * cdrom->numtracks); + tracks[cdrom->id] = (FSRef*) SDL_calloc (1, sizeof(**tracks) * cdrom->numtracks); if (tracks[cdrom->id] == NULL) { SDL_OutOfMemory (); return -1; @@ -203,14 +203,14 @@ } /* Allocate space for volumes */ - volumes = (FSVolumeRefNum*) calloc (1, sizeof(*volumes) * SDL_numcds); + volumes = (FSVolumeRefNum*) SDL_calloc (1, sizeof(*volumes) * SDL_numcds); if (volumes == NULL) { SDL_OutOfMemory (); return -1; } /* Allocate space for tracks */ - tracks = (FSRef**) calloc (1, sizeof(*tracks) * (SDL_numcds + 1)); + tracks = (FSRef**) SDL_calloc (1, sizeof(*tracks) * (SDL_numcds + 1)); if (tracks == NULL) { SDL_OutOfMemory (); return -1; diff -r c687f06c7473 -r 604d73db6802 src/cdrom/mint/SDL_syscdrom.c --- a/src/cdrom/mint/SDL_syscdrom.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/mint/SDL_syscdrom.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,9 +27,6 @@ */ #include -#include -#include -#include #include #include diff -r c687f06c7473 -r 604d73db6802 src/cdrom/openbsd/SDL_syscdrom.c --- a/src/cdrom/openbsd/SDL_syscdrom.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/openbsd/SDL_syscdrom.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,16 +24,15 @@ #include #include -#include #include #include -#include -#include #include #include #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_cdrom.h" #include "SDL_syscdrom.h" @@ -198,7 +197,7 @@ char *insert; exists = 1; for ( j=checklist[i][1]; exists; ++j ) { - sprintf(drive, "/dev/%s", &checklist[i][3]); + SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s", &checklist[i][3]); insert = SDL_strchr(drive, '?'); if ( insert != NULL ) { *insert = j; @@ -218,7 +217,7 @@ } } } else { - sprintf(drive, "/dev/%s", checklist[i]); + SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s", checklist[i]); if ( CheckDrive(drive, &stbuf) > 0 ) { AddDrive(drive, &stbuf); } diff -r c687f06c7473 -r 604d73db6802 src/cdrom/os2/SDL_syscdrom.c --- a/src/cdrom/os2/SDL_syscdrom.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/os2/SDL_syscdrom.c Tue Feb 07 09:29:18 2006 +0000 @@ -25,10 +25,9 @@ #define INCL_MCIOS2 #include #include -#include -#include -#include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_cdrom.h" #include "SDL_syscdrom.h" diff -r c687f06c7473 -r 604d73db6802 src/cdrom/osf/SDL_syscdrom.c --- a/src/cdrom/osf/SDL_syscdrom.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/osf/SDL_syscdrom.c Tue Feb 07 09:29:18 2006 +0000 @@ -31,12 +31,9 @@ #include #include #include -#include -#include -#include -#include -#include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_cdrom.h" #include "SDL_syscdrom.h" @@ -218,7 +215,7 @@ while (devent = readdir(devdir)) if (SDL_memcmp(checklist[i].name, devent->d_name, name_len) == 0) if (devent->d_name[devent->d_namlen-1] == 'c') { - sprintf(drive, "%s/%s", checklist[i].dir, devent->d_name); + SDL_snprintf(drive, SDL_arraysize(drive), "%s/%s", checklist[i].dir, devent->d_name); #ifdef DEBUG_CDROM fprintf(stderr, "Try to add drive: %s\n", drive); #endif diff -r c687f06c7473 -r 604d73db6802 src/cdrom/qnx/SDL_syscdrom.c --- a/src/cdrom/qnx/SDL_syscdrom.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/qnx/SDL_syscdrom.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,17 +23,16 @@ /* Functions for system-level CD-ROM audio control */ #include -#include #include #include #include -#include #include -#include #include #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_cdrom.h" #include "SDL_timer.h" @@ -218,7 +217,7 @@ for ( j=checklist[i][1]; exists; ++j ) { - sprintf(drive, "/dev/%s", &checklist[i][3]); + SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s", &checklist[i][3]); insert = SDL_strchr(drive, '?'); if (insert != NULL) { @@ -242,7 +241,7 @@ } else { - sprintf(drive, "/dev/%s", checklist[i]); + SDL_snprintf(drive, SDL_arraysize(drive), "/dev/%s", checklist[i]); if (CheckDrive(drive, &stbuf) > 0) { AddDrive(drive, &stbuf); diff -r c687f06c7473 -r 604d73db6802 src/cdrom/win32/SDL_syscdrom.c --- a/src/cdrom/win32/SDL_syscdrom.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/cdrom/win32/SDL_syscdrom.c Tue Feb 07 09:29:18 2006 +0000 @@ -25,10 +25,10 @@ #include "SDL_windows.h" #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_cdrom.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_syscdrom.h" /* This really broken?? */ diff -r c687f06c7473 -r 604d73db6802 src/file/SDL_rwops.c --- a/src/file/SDL_rwops.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/file/SDL_rwops.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,10 +24,10 @@ data sources. It can easily be extended to files, memory, etc. */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_rwops.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #ifdef HAVE_STDIO_H diff -r c687f06c7473 -r 604d73db6802 src/joystick/SDL_joystick.c --- a/src/joystick/SDL_joystick.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/joystick/SDL_joystick.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,10 +22,10 @@ /* This is the joystick API for Simple DirectMedia Layer */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_events.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #ifndef DISABLE_EVENTS #include "SDL_events_c.h" #endif diff -r c687f06c7473 -r 604d73db6802 src/joystick/amigaos/SDL_sysjoystick.c --- a/src/joystick/amigaos/SDL_sysjoystick.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/joystick/amigaos/SDL_sysjoystick.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,8 +23,6 @@ /* This is the system specific header for the SDL joystick API */ -#include /* For the definition of NULL */ - #include #if defined(__SASC) || defined(STORMC4_WOS) #include @@ -39,8 +37,8 @@ extern struct ExecBase *SysBase; extern struct GfxBase *GfxBase; -#include +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_joystick.h" #include "SDL_sysjoystick.h" diff -r c687f06c7473 -r 604d73db6802 src/joystick/beos/SDL_bejoystick.cc --- a/src/joystick/beos/SDL_bejoystick.cc Tue Feb 07 07:03:29 2006 +0000 +++ b/src/joystick/beos/SDL_bejoystick.cc Tue Feb 07 09:29:18 2006 +0000 @@ -22,15 +22,13 @@ /* This is the system specific header for the SDL joystick API */ -#include -#include -#include - #include #include extern "C" { +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_joystick.h" #include "SDL_sysjoystick.h" diff -r c687f06c7473 -r 604d73db6802 src/joystick/bsd/SDL_sysjoystick.c --- a/src/joystick/bsd/SDL_sysjoystick.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/joystick/bsd/SDL_sysjoystick.c Tue Feb 07 09:29:18 2006 +0000 @@ -29,11 +29,8 @@ #include -#include -#include #include #include -#include #include #if defined(HAVE_USB_H) @@ -59,6 +56,8 @@ #include #endif +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_joystick.h" #include "SDL_sysjoystick.h" @@ -145,7 +144,7 @@ for (i = 0; i < MAX_UHID_JOYS; i++) { SDL_Joystick nj; - sprintf(s, "/dev/uhid%d", i); + SDL_snprintf(s, SDL_arraysize(s), "/dev/uhid%d", i); nj.index = SDL_numjoysticks; joynames[nj.index] = strdup(s); @@ -159,7 +158,7 @@ } } for (i = 0; i < MAX_JOY_JOYS; i++) { - sprintf(s, "/dev/joy%d", i); + SDL_snprintf(s, SDL_arraysize(s), "/dev/joy%d", i); fd = open(s, O_RDONLY); if (fd != -1) { joynames[SDL_numjoysticks++] = strdup(s); @@ -312,7 +311,7 @@ case HUG_GAME_PAD: s = hid_usage_in_page(hitem.usage); sp = SDL_malloc(SDL_strlen(s) + 5); - sprintf(sp, "%s (%d)", s, + SDL_snprintf(sp, SDL_strlen(s) + 5, "%s (%d)", s, joy->index); joydevnames[joy->index] = sp; } diff -r c687f06c7473 -r 604d73db6802 src/joystick/darwin/SDL_sysjoystick.c --- a/src/joystick/darwin/SDL_sysjoystick.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/joystick/darwin/SDL_sysjoystick.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,11 +23,8 @@ /* SDL joystick driver for Darwin / MacOS X, based on the IOKit HID API */ /* Written 2001 by Max Horn */ -#include -#include #include #include -#include #include #include #include diff -r c687f06c7473 -r 604d73db6802 src/joystick/dc/SDL_sysjoystick.c --- a/src/joystick/dc/SDL_sysjoystick.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/joystick/dc/SDL_sysjoystick.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,9 +22,8 @@ /* Win32 MultiMedia Joystick driver, contributed by Andrei de A. Formiga */ -#include -#include /* For the definition of NULL */ - +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_joystick.h" #include "SDL_sysjoystick.h" diff -r c687f06c7473 -r 604d73db6802 src/joystick/linux/SDL_sysjoystick.c --- a/src/joystick/linux/SDL_sysjoystick.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/joystick/linux/SDL_sysjoystick.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,9 +22,6 @@ /* This is the system specific header for the SDL joystick API */ -#include /* For the definition of NULL */ -#include /* For SDL_getenv() prototype */ -#include #include #include #include @@ -38,6 +35,8 @@ #include #endif +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_joystick.h" #include "SDL_sysjoystick.h" @@ -325,7 +324,7 @@ for ( i=0; i -#include -#include - #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_types.h" #include "SDL_error.h" #include "SDL_joystick.h" diff -r c687f06c7473 -r 604d73db6802 src/joystick/os2/SDL_sysjoystick.c --- a/src/joystick/os2/SDL_sysjoystick.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/joystick/os2/SDL_sysjoystick.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,8 +22,6 @@ /* OS/2 Joystick driver, contributed by Daniel Caetano */ -#include -#include #include #define INCL_DOSDEVICES @@ -32,6 +30,8 @@ #include #include "joyos2.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_joystick.h" #include "SDL_sysjoystick.h" @@ -217,7 +217,7 @@ if (joycfg.buttons>=7) SYS_JoyData[0].buttoncalc[2]=((axis[2]->upper+axis[3]->centre)>>1); if (joycfg.buttons>=8) SYS_JoyData[0].buttoncalc[3]=((axis[3]->upper+axis[3]->centre)>>1); /* Intialize Joystick Name */ - strcpy (SYS_JoyData[0].szDeviceName,joycfg.name); + SDL_strcpy (SYS_JoyData[0].szDeviceName,joycfg.name); } /* Default Init ... autoconfig */ else @@ -294,7 +294,8 @@ } /* Hack to define Joystick Port Names */ if ( numdevs > maxdevs ) numdevs = maxdevs; - for (i=0; i /* For the definition of NULL */ -#include - +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_joystick.h" #include "SDL_sysjoystick.h" diff -r c687f06c7473 -r 604d73db6802 src/joystick/win32/SDL_mmjoystick.c --- a/src/joystick/win32/SDL_mmjoystick.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/joystick/win32/SDL_mmjoystick.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,11 +22,11 @@ /* Win32 MultiMedia Joystick driver, contributed by Andrei de A. Formiga */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_events.h" #include "SDL_joystick.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_sysjoystick.h" #include "SDL_joystick_c.h" diff -r c687f06c7473 -r 604d73db6802 src/loadso/macosx/SDL_loadso.c --- a/src/loadso/macosx/SDL_loadso.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/loadso/macosx/SDL_loadso.c Tue Feb 07 09:29:18 2006 +0000 @@ -62,9 +62,6 @@ */ #include -#include -#include -#include #include #include #include @@ -73,6 +70,9 @@ #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" + /* Just playing to see if it would compile with the freebsd headers, it does, * but because of the different values for RTLD_LOCAL etc, it would break binary * compat... oh well @@ -390,14 +390,14 @@ } if (!path) { - path = (char **)calloc(MAX_SEARCH_PATHS, sizeof(char **)); + path = (char **)SDL_calloc(MAX_SEARCH_PATHS, sizeof(char **)); } if (!list && !end) list = searchList(); if (i >= (numsize)) { debug("Increasing size for long PATH"); - tmp = (char **)calloc((MAX_SEARCH_PATHS + numsize), sizeof(char **)); + tmp = (char **)SDL_calloc((MAX_SEARCH_PATHS + numsize), sizeof(char **)); if (tmp) { SDL_memcpy(tmp, path, sizeof(char **) * numsize); @@ -515,7 +515,7 @@ dls = dls->next; if (!dls) #endif - dls = calloc(sizeof(*dls),1); + dls = SDL_calloc(sizeof(*dls),1); return dls; } @@ -1017,7 +1017,7 @@ malloc_sym = SDL_malloc(sym_len + 2); if (malloc_sym) { - sprintf(malloc_sym, "_%s", symbol); + SDL_sprintf(malloc_sym, sym_len+2, "_%s", symbol); value = dlsymIntern(handle, malloc_sym, 1); SDL_free(malloc_sym); } @@ -1062,7 +1062,7 @@ malloc_sym = SDL_malloc(sym_len + 2); if (malloc_sym) { - sprintf(malloc_sym, "_%s", symbol); + SDL_snprintf(malloc_sym, sym_len+2, "_%s", symbol); value = dlsymIntern(handle, malloc_sym, 1); SDL_free(malloc_sym); } @@ -1347,7 +1347,7 @@ malloc_sym = SDL_malloc(sym_len + 2); if (malloc_sym) { - sprintf(malloc_sym, "_%s", symbol); + SDL_snprintf(malloc_sym, sym_len+2, "_%s", symbol); rv.d = dlsymIntern(handle, malloc_sym, 1); SDL_free(malloc_sym); } diff -r c687f06c7473 -r 604d73db6802 src/main/beos/SDL_BeApp.cc --- a/src/main/beos/SDL_BeApp.cc Tue Feb 07 07:03:29 2006 +0000 +++ b/src/main/beos/SDL_BeApp.cc Tue Feb 07 09:29:18 2006 +0000 @@ -25,8 +25,6 @@ #include #include #include -#include -#include #include #include "SDL_BeApp.h" diff -r c687f06c7473 -r 604d73db6802 src/main/macos/SDL_main.c --- a/src/main/macos/SDL_main.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/main/macos/SDL_main.c Tue Feb 07 09:29:18 2006 +0000 @@ -589,7 +589,7 @@ /* Parse C-string into argv and argc */ nargs = ParseCommandLine (commandLine, NULL); - args = (char **)SDL_malloc((nargs+1)*(sizeof *args)); + args = (char **)malloc((nargs+1)*(sizeof *args)); if ( args == NULL ) { exit(-1); } diff -r c687f06c7473 -r 604d73db6802 src/stdlib/SDL_malloc.c --- a/src/stdlib/SDL_malloc.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/stdlib/SDL_malloc.c Tue Feb 07 09:29:18 2006 +0000 @@ -29,19 +29,14 @@ #ifndef HAVE_MALLOC #define LACKS_STDIO_H -#define LACKS_UNISTD_H -#define LACKS_FCNTL_H -#define LACKS_SYS_PARAM_H -#define LACKS_SYS_MMAN_H #define LACKS_STRINGS_H #define LACKS_STRING_H -#define LACKS_SYS_TYPES_H -#define LACKS_ERRNO_H #define LACKS_STDLIB_H #define ABORT #define memset SDL_memset #define memcpy SDL_memcpy #define malloc SDL_malloc +#define calloc SDL_calloc #define realloc SDL_realloc #define free SDL_free diff -r c687f06c7473 -r 604d73db6802 src/stdlib/SDL_string.c --- a/src/stdlib/SDL_string.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/stdlib/SDL_string.c Tue Feb 07 09:29:18 2006 +0000 @@ -343,7 +343,8 @@ { char *bufp = string; while ( *bufp ) { - *bufp++ = toupper(*bufp); + *bufp = toupper(*bufp); + ++bufp; } return string; } @@ -354,7 +355,8 @@ { char *bufp = string; while ( *bufp ) { - *bufp++ = tolower(*bufp); + *bufp = tolower(*bufp); + ++bufp; } return string; } @@ -367,6 +369,7 @@ if ( *string == c ) { return (char *)string; } + ++string; } return NULL; } @@ -380,6 +383,7 @@ if ( *bufp == c ) { return (char *)bufp; } + --bufp; } return NULL; } @@ -393,6 +397,7 @@ if ( SDL_strncmp(haystack, needle, length) == 0 ) { return (char *)haystack; } + ++haystack; } return NULL; } diff -r c687f06c7473 -r 604d73db6802 src/thread/SDL_thread.c --- a/src/thread/SDL_thread.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/SDL_thread.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,11 +22,11 @@ /* System independent thread management routines for SDL */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_mutex.h" #include "SDL_thread.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_thread_c.h" #include "SDL_systhread.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/amigaos/SDL_systhread.c --- a/src/thread/amigaos/SDL_systhread.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/amigaos/SDL_systhread.c Tue Feb 07 09:29:18 2006 +0000 @@ -102,7 +102,7 @@ D(bug("Sending %lx to the new thread...\n",args)); if(args) - sprintf(buffer,"%ld",args); + SDL_snprintf(buffer, SDL_arraysize(buffer),"%ld",args); #ifdef STORMC4_WOS thread->handle=CreateTaskPPCTags(TASKATTR_CODE, RunThread, diff -r c687f06c7473 -r 604d73db6802 src/thread/amigaos/SDL_systhread_c.h --- a/src/thread/amigaos/SDL_systhread_c.h Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/amigaos/SDL_systhread_c.h Tue Feb 07 09:29:18 2006 +0000 @@ -31,9 +31,6 @@ #include #endif -#include -#include -#include #include "mydebug.h" extern struct ExecBase *SysBase; diff -r c687f06c7473 -r 604d73db6802 src/thread/amigaos/SDL_thread.c --- a/src/thread/amigaos/SDL_thread.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/amigaos/SDL_thread.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,10 +22,8 @@ /* System independent thread management routines for SDL */ -#include -#include -#include - +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_mutex.h" #include "SDL_thread.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/bsdi/SDL_syssem.c --- a/src/thread/bsdi/SDL_syssem.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/bsdi/SDL_syssem.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,15 +20,13 @@ slouken@libsdl.org */ -#include +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" #include "SDL_timer.h" #ifdef SDL_USE_PTHREADS -#include -#include #include /* For getpid() */ #include diff -r c687f06c7473 -r 604d73db6802 src/thread/dc/SDL_syscond.c --- a/src/thread/dc/SDL_syscond.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/dc/SDL_syscond.c Tue Feb 07 09:29:18 2006 +0000 @@ -26,9 +26,7 @@ implementation, written by Christopher Tate and Owen Smith. Thanks! */ -#include -#include - +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/dc/SDL_sysmutex.c --- a/src/thread/dc/SDL_sysmutex.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/dc/SDL_sysmutex.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,9 +22,7 @@ /* An implementation of mutexes using semaphores */ -#include -#include - +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" #include "SDL_systhread_c.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/dc/SDL_syssem.c --- a/src/thread/dc/SDL_syssem.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/dc/SDL_syssem.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,8 +22,6 @@ /* An implementation of semaphores using mutexes and condition variables */ -#include - #include "SDL_error.h" #include "SDL_timer.h" #include "SDL_thread.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/epoc/SDL_sysmutex.cpp --- a/src/thread/epoc/SDL_sysmutex.cpp Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/epoc/SDL_sysmutex.cpp Tue Feb 07 09:29:18 2006 +0000 @@ -29,9 +29,6 @@ /* Mutex functions using the Win32 API */ -//#include -//#include - #include #include "SDL_error.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/epoc/SDL_syssem.cpp --- a/src/thread/epoc/SDL_syssem.cpp Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/epoc/SDL_syssem.cpp Tue Feb 07 09:29:18 2006 +0000 @@ -28,8 +28,6 @@ /* Semaphore functions using the Win32 API */ -//#include -//#include #include #include "SDL_error.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/epoc/SDL_systhread.cpp --- a/src/thread/epoc/SDL_systhread.cpp Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/epoc/SDL_systhread.cpp Tue Feb 07 09:29:18 2006 +0000 @@ -28,10 +28,6 @@ */ -//#include -//#include - - extern "C" { #undef NULL #include "SDL_error.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/generic/SDL_syscond.c --- a/src/thread/generic/SDL_syscond.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/generic/SDL_syscond.c Tue Feb 07 09:29:18 2006 +0000 @@ -26,9 +26,9 @@ implementation, written by Christopher Tate and Owen Smith. Thanks! */ +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" -#include "SDL_stdlib.h" struct SDL_cond { diff -r c687f06c7473 -r 604d73db6802 src/thread/generic/SDL_sysmutex.c --- a/src/thread/generic/SDL_sysmutex.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/generic/SDL_sysmutex.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,9 +22,9 @@ /* An implementation of mutexes using semaphores */ +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" -#include "SDL_stdlib.h" #include "SDL_systhread_c.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/generic/SDL_syssem.c --- a/src/thread/generic/SDL_syssem.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/generic/SDL_syssem.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,10 +22,10 @@ /* An implementation of semaphores using mutexes and condition variables */ +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_timer.h" #include "SDL_thread.h" -#include "SDL_stdlib.h" #include "SDL_systhread_c.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/irix/SDL_systhread.c --- a/src/thread/irix/SDL_systhread.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/irix/SDL_systhread.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,7 +22,6 @@ /* IRIX thread management routines for SDL */ -#include #include #include #include diff -r c687f06c7473 -r 604d73db6802 src/thread/linux/SDL_syscond.c --- a/src/thread/linux/SDL_syscond.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/linux/SDL_syscond.c Tue Feb 07 09:29:18 2006 +0000 @@ -40,9 +40,9 @@ #include #include #include -#include #include +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" #include "SDL_sysmutex_c.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/linux/SDL_sysmutex.c --- a/src/thread/linux/SDL_sysmutex.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/linux/SDL_sysmutex.c Tue Feb 07 09:29:18 2006 +0000 @@ -37,10 +37,9 @@ #ifdef SDL_USE_PTHREADS -#include -#include #include +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" @@ -59,7 +58,7 @@ pthread_mutexattr_t attr; /* Allocate the structure */ - mutex = (SDL_mutex *)calloc(1, sizeof(*mutex)); + mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex)); if ( mutex ) { pthread_mutexattr_init(&attr); #if defined(PTHREAD_RECURSIVE_MUTEX) diff -r c687f06c7473 -r 604d73db6802 src/thread/linux/SDL_syssem.c --- a/src/thread/linux/SDL_syssem.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/linux/SDL_syssem.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,7 +20,7 @@ slouken@libsdl.org */ -#include +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" #include "SDL_timer.h" @@ -46,9 +46,6 @@ #include "generic/SDL_syssem.c" #else -#include -#include -#include /* For getpid() */ #include #include @@ -74,7 +71,7 @@ static int semnum = 0; char name[32]; - sprintf(name, "/SDL_sem-%d-%4.4d", getpid(), semnum++); + SDL_snprintf(name, SDL_arraysize(name), "/SDL_sem-%d-%4.4d", getpid(), semnum++); sem->sem = sem_open(name, O_CREAT, 0600, initial_value); if ( sem->sem == (sem_t *)SEM_FAILED ) { SDL_SetError("sem_open(%s) failed", name); diff -r c687f06c7473 -r 604d73db6802 src/thread/linux/SDL_systhread.c --- a/src/thread/linux/SDL_systhread.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/linux/SDL_systhread.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,6 +22,7 @@ /* Linux thread management routines for SDL */ +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" #include "SDL_systhread.h" @@ -138,7 +139,6 @@ #else /* Linux-specific clone() based implementation */ -#include #include #include #include @@ -227,7 +227,7 @@ */ char command[1024]; - sprintf(command, + SDL_snprintf(command, SDL_arraysize(command), "ps ax|fgrep -v fgrep|fgrep -v ''|fgrep %d >/dev/null", thread->handle); while ( system(command) == 0 ) diff -r c687f06c7473 -r 604d73db6802 src/thread/os2/SDL_syscond.c --- a/src/thread/os2/SDL_syscond.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/os2/SDL_syscond.c Tue Feb 07 09:29:18 2006 +0000 @@ -26,9 +26,7 @@ implementation, written by Christopher Tate and Owen Smith. Thanks! */ -#include -#include - +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/os2/SDL_sysmutex.c --- a/src/thread/os2/SDL_sysmutex.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/os2/SDL_sysmutex.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,12 +22,11 @@ /* Mutex functions using the OS/2 API */ -#include -#include #define INCL_DOSERRORS #define INCL_DOSSEMAPHORES #include +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_mutex.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/os2/SDL_syssem.c --- a/src/thread/os2/SDL_syssem.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/os2/SDL_syssem.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,13 +22,12 @@ /* Semaphore functions using the OS/2 API */ -#include -#include #define INCL_DOS #define INCL_DOSERRORS #define INCL_DOSSEMAPHORES #include +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" #include "SDL_timer.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/os2/SDL_systhread.c --- a/src/thread/os2/SDL_systhread.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/os2/SDL_systhread.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,13 +22,12 @@ /* OS/2 thread management routines for SDL */ -#include -#include #include #define INCL_DOSERRORS #define INCL_DOSPROCESS #include +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" #include "SDL_systhread.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/pth/SDL_syscond.c --- a/src/thread/pth/SDL_syscond.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/pth/SDL_syscond.c Tue Feb 07 09:29:18 2006 +0000 @@ -4,10 +4,9 @@ * Patrice Mandin */ -#include -#include #include +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" #include "SDL_syscond_c.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/pth/SDL_sysmutex.c --- a/src/thread/pth/SDL_sysmutex.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/pth/SDL_sysmutex.c Tue Feb 07 09:29:18 2006 +0000 @@ -4,10 +4,9 @@ * Patrice Mandin */ -#include -#include #include +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_mutex.h" #include "SDL_sysmutex_c.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/riscos/SDL_syscond.c --- a/src/thread/riscos/SDL_syscond.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/riscos/SDL_syscond.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,10 +27,9 @@ #else #include #include -#include -#include #include +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" #include "SDL_sysmutex_c.h" diff -r c687f06c7473 -r 604d73db6802 src/thread/riscos/SDL_sysmutex.c --- a/src/thread/riscos/SDL_sysmutex.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/riscos/SDL_sysmutex.c Tue Feb 07 09:29:18 2006 +0000 @@ -26,10 +26,9 @@ #include "../generic/SDL_sysmutex.c" #else -#include -#include #include +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" @@ -47,7 +46,7 @@ pthread_mutexattr_t attr; /* Allocate the structure */ - mutex = (SDL_mutex *)calloc(1, sizeof(*mutex)); + mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex)); if ( mutex ) { pthread_mutexattr_init(&attr); #ifdef PTHREAD_NO_RECURSIVE_MUTEX diff -r c687f06c7473 -r 604d73db6802 src/thread/riscos/SDL_syssem.c --- a/src/thread/riscos/SDL_syssem.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/riscos/SDL_syssem.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,12 +23,10 @@ /* RISC OS semiphores based on linux code */ -#include - +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_timer.h" #include "SDL_thread.h" - #include "SDL_systhread_c.h" #ifdef DISABLE_THREADS @@ -76,8 +74,6 @@ #else -#include -#include #include /* For getpid() */ #include #include diff -r c687f06c7473 -r 604d73db6802 src/thread/win32/SDL_sysmutex.c --- a/src/thread/win32/SDL_sysmutex.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/win32/SDL_sysmutex.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,9 +24,9 @@ #include "SDL_windows.h" +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_mutex.h" -#include "SDL_stdlib.h" struct SDL_mutex { diff -r c687f06c7473 -r 604d73db6802 src/thread/win32/SDL_syssem.c --- a/src/thread/win32/SDL_syssem.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/win32/SDL_syssem.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,9 +24,9 @@ #include "SDL_windows.h" +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" -#include "SDL_stdlib.h" #if defined(_WIN32_WCE) && (_WIN32_WCE < 300) #include "win_ce_semaphore.h" #endif diff -r c687f06c7473 -r 604d73db6802 src/thread/win32/SDL_systhread.c --- a/src/thread/win32/SDL_systhread.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/thread/win32/SDL_systhread.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,9 +24,9 @@ #include "SDL_windows.h" +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_thread.h" -#include "SDL_stdlib.h" #include "SDL_systhread.h" typedef struct ThreadStartParms diff -r c687f06c7473 -r 604d73db6802 src/timer/SDL_timer.c --- a/src/timer/SDL_timer.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/timer/SDL_timer.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,9 +20,9 @@ slouken@libsdl.org */ +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_timer.h" -#include "SDL_stdlib.h" #include "SDL_timer_c.h" #include "SDL_mutex.h" #include "SDL_systimer.h" diff -r c687f06c7473 -r 604d73db6802 src/video/SDL_RLEaccel.c --- a/src/video/SDL_RLEaccel.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/SDL_RLEaccel.c Tue Feb 07 09:29:18 2006 +0000 @@ -86,10 +86,10 @@ */ #include "SDL_types.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_video.h" #include "SDL_error.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_sysvideo.h" #include "SDL_blit.h" #include "SDL_RLEaccel_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/SDL_blit_N.c --- a/src/video/SDL_blit_N.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/SDL_blit_N.c Tue Feb 07 09:29:18 2006 +0000 @@ -32,8 +32,7 @@ #ifdef HAVE_ALTIVEC_H #include #endif -#include -#include +#define assert(X) #ifdef MACOSX #include static size_t GetL3CacheSize( void ) @@ -235,7 +234,6 @@ assert(width == 0); - /* do scalar until we can align... */ ONE_PIXEL_BLEND((extrawidth), extrawidth); #undef ONE_PIXEL_BLEND diff -r c687f06c7473 -r 604d73db6802 src/video/SDL_cursor.c --- a/src/video/SDL_cursor.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/SDL_cursor.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,12 +22,12 @@ /* General cursor handling code for SDL */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_mutex.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_blit.h" #include "SDL_events_c.h" #include "SDL_sysvideo.h" diff -r c687f06c7473 -r 604d73db6802 src/video/SDL_gamma.c --- a/src/video/SDL_gamma.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/SDL_gamma.c Tue Feb 07 09:29:18 2006 +0000 @@ -36,9 +36,9 @@ #define log(x) __ieee754_log(x) #endif -#include "SDL_error.h" #include "SDL_stdlib.h" #include "SDL_string.h" +#include "SDL_error.h" #include "SDL_sysvideo.h" diff -r c687f06c7473 -r 604d73db6802 src/video/SDL_pixels.c --- a/src/video/SDL_pixels.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/SDL_pixels.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,11 +22,11 @@ /* General (mostly internal) pixel/color manipulation routines for SDL */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_endian.h" #include "SDL_video.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_sysvideo.h" #include "SDL_blit.h" #include "SDL_pixels_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/SDL_surface.c --- a/src/video/SDL_surface.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/SDL_surface.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,10 +20,10 @@ slouken@libsdl.org */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_sysvideo.h" #include "SDL_cursor_c.h" #include "SDL_blit.h" diff -r c687f06c7473 -r 604d73db6802 src/video/SDL_video.c --- a/src/video/SDL_video.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/SDL_video.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,12 +23,12 @@ /* The high-level video driver subsystem */ #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_events.h" #include "SDL_mutex.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_sysvideo.h" #include "SDL_sysevents.h" #include "SDL_blit.h" diff -r c687f06c7473 -r 604d73db6802 src/video/SDL_yuv.c --- a/src/video/SDL_yuv.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/SDL_yuv.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,9 +22,9 @@ /* This is the implementation of the YUV video surface support */ +#include "SDL_stdlib.h" #include "SDL_video.h" #include "SDL_error.h" -#include "SDL_stdlib.h" #include "SDL_sysvideo.h" #include "SDL_yuvfuncs.h" #include "SDL_yuv_sw_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/SDL_yuv_sw.c --- a/src/video/SDL_yuv_sw.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/SDL_yuv_sw.c Tue Feb 07 09:29:18 2006 +0000 @@ -82,11 +82,11 @@ * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_cpuinfo.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_stretch_c.h" #include "SDL_yuvfuncs.h" #include "SDL_yuv_sw_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/Xext/Xv/Xv.c --- a/src/video/Xext/Xv/Xv.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/Xext/Xv/Xv.c Tue Feb 07 09:29:18 2006 +0000 @@ -234,7 +234,7 @@ SyncHandle(); return(XvBadAlloc); } - (void)SDL_strncpy(name, u.string, size); + (void)strncpy(name, u.string, size); name[size] = '\0'; pa->name = name; @@ -386,7 +386,7 @@ SyncHandle(); return(XvBadAlloc); } - SDL_strncpy(name, u.string, size); + strncpy(name, u.string, size); name[size] = '\0'; pe->name = name; pe++; @@ -902,7 +902,7 @@ ret[i].id = Info.id; ret[i].type = Info.type; ret[i].byte_order = Info.byte_order; - SDL_memcpy(&(ret[i].guid[0]), &(Info.guid[0]), 16); + memcpy(&(ret[i].guid[0]), &(Info.guid[0]), 16); ret[i].bits_per_pixel = Info.bpp; ret[i].format = Info.format; ret[i].num_planes = Info.num_planes; @@ -919,7 +919,7 @@ ret[i].vert_y_period = Info.vert_y_period; ret[i].vert_u_period = Info.vert_u_period; ret[i].vert_v_period = Info.vert_v_period; - SDL_memcpy(&(ret[i].component_order[0]), &(Info.comp_order[0]), 32); + memcpy(&(ret[i].component_order[0]), &(Info.comp_order[0]), 32); ret[i].scanline_order = Info.scanline_order; (*num)++; } diff -r c687f06c7473 -r 604d73db6802 src/video/Xext/Xxf86dga/XF86DGA.c --- a/src/video/Xext/Xxf86dga/XF86DGA.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/Xext/Xxf86dga/XF86DGA.c Tue Feb 07 09:29:18 2006 +0000 @@ -407,12 +407,12 @@ MapPtr *old; old = mapList; - mapList = SDL_realloc(mapList, sizeof(MapPtr) * (numMaps + 1)); + mapList = realloc(mapList, sizeof(MapPtr) * (numMaps + 1)); if (!mapList) { mapList = old; return NULL; } - mapList[numMaps] = SDL_malloc(sizeof(MapRec)); + mapList[numMaps] = malloc(sizeof(MapRec)); if (!mapList[numMaps]) return NULL; return mapList[numMaps++]; @@ -424,12 +424,12 @@ ScrPtr *old; old = scrList; - scrList = SDL_realloc(scrList, sizeof(ScrPtr) * (numScrs + 1)); + scrList = realloc(scrList, sizeof(ScrPtr) * (numScrs + 1)); if (!scrList) { scrList = old; return NULL; } - scrList[numScrs] = SDL_malloc(sizeof(ScrRec)); + scrList[numScrs] = malloc(sizeof(ScrRec)); if (!scrList[numScrs]) return NULL; return scrList[numScrs++]; diff -r c687f06c7473 -r 604d73db6802 src/video/aalib/SDL_aavideo.c --- a/src/video/aalib/SDL_aavideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/aalib/SDL_aavideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,14 +23,13 @@ /* AAlib based SDL video driver implementation. */ -#include -#include -#include #include #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" diff -r c687f06c7473 -r 604d73db6802 src/video/ataricommon/SDL_atarievents.c --- a/src/video/ataricommon/SDL_atarievents.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/ataricommon/SDL_atarievents.c Tue Feb 07 09:29:18 2006 +0000 @@ -28,12 +28,11 @@ * This routines choose what the final event manager will be */ -#include -#include - #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_sysevents.h" #include "SDL_events_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/ataricommon/SDL_atarigl.c --- a/src/video/ataricommon/SDL_atarigl.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/ataricommon/SDL_atarigl.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,15 +24,14 @@ /*--- Includes ---*/ -#include -#include -#include #ifdef HAVE_OPENGL #include #endif #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_video.h" #include "SDL_error.h" #include "SDL_endian.h" diff -r c687f06c7473 -r 604d73db6802 src/video/ataricommon/SDL_xbiosevents.c --- a/src/video/ataricommon/SDL_xbiosevents.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/ataricommon/SDL_xbiosevents.c Tue Feb 07 09:29:18 2006 +0000 @@ -26,10 +26,6 @@ * Patrice Mandin */ -#include -#include -#include - #include #include "SDL_events_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/bwindow/SDL_sysmouse.cc --- a/src/video/bwindow/SDL_sysmouse.cc Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/bwindow/SDL_sysmouse.cc Tue Feb 07 09:29:18 2006 +0000 @@ -20,12 +20,11 @@ slouken@libsdl.org */ -#include -#include - #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_BWin.h" diff -r c687f06c7473 -r 604d73db6802 src/video/bwindow/SDL_sysvideo.cc --- a/src/video/bwindow/SDL_sysvideo.cc Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/bwindow/SDL_sysvideo.cc Tue Feb 07 09:29:18 2006 +0000 @@ -22,13 +22,11 @@ /* BWindow based framebuffer implementation */ -#include -#include - -#include #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_BeApp.h" #include "SDL_BWin.h" #include "SDL_timer.h" @@ -291,7 +289,7 @@ /* Get the video modes we can switch to in fullscreen mode */ bscreen.GetModeList(&modes, &nmodes); - qsort(modes, nmodes, sizeof *modes, CompareModes); + SDL_qsort(modes, nmodes, sizeof *modes, CompareModes); for ( i=0; i -#include -#include - +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_sysyuv.h" @@ -158,7 +155,7 @@ } /* Create the overlay structure */ - overlay = (SDL_Overlay*)calloc(1, sizeof(SDL_Overlay)); + overlay = (SDL_Overlay*)SDL_calloc(1, sizeof(SDL_Overlay)); if (overlay == NULL) { @@ -176,7 +173,7 @@ overlay->hwfuncs = &be_yuvfuncs; /* Create the pixel data and lookup tables */ - hwdata = (struct private_yuvhwdata*)calloc(1, sizeof(struct private_yuvhwdata)); + hwdata = (struct private_yuvhwdata*)SDL_calloc(1, sizeof(struct private_yuvhwdata)); if (hwdata == NULL) { @@ -215,8 +212,8 @@ overlay->hwdata->bbitmap = bbitmap; overlay->planes = planes; - overlay->pitches = (Uint16*)calloc(overlay->planes, sizeof(Uint16)); - overlay->pixels = (Uint8**)calloc(overlay->planes, sizeof(Uint8*)); + overlay->pitches = (Uint16*)SDL_calloc(overlay->planes, sizeof(Uint16)); + overlay->pixels = (Uint8**)SDL_calloc(overlay->planes, sizeof(Uint8*)); if (!overlay->pitches || !overlay->pixels) { SDL_OutOfMemory(); diff -r c687f06c7473 -r 604d73db6802 src/video/cybergfx/SDL_cgximage.c --- a/src/video/cybergfx/SDL_cgximage.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/cybergfx/SDL_cgximage.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,8 +20,8 @@ slouken@libsdl.org */ -#include - +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_endian.h" #include "SDL_cgximage_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/cybergfx/SDL_cgxmodes.c --- a/src/video/cybergfx/SDL_cgxmodes.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/cybergfx/SDL_cgxmodes.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,11 +22,6 @@ /* Utilities for getting and setting the X display mode */ -/* -#include -#include -*/ - #include "SDL_timer.h" #include "SDL_error.h" #include "SDL_events.h" diff -r c687f06c7473 -r 604d73db6802 src/video/cybergfx/SDL_cgxvideo.c --- a/src/video/cybergfx/SDL_cgxvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/cybergfx/SDL_cgxvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -25,18 +25,6 @@ * gabriele.greco@aruba.it */ -/* -#include -#include -#include -#include -#include -#ifdef MTRR_SUPPORT -#include -#include -#endif -*/ - #include "SDL.h" #include "SDL_error.h" #include "SDL_timer.h" diff -r c687f06c7473 -r 604d73db6802 src/video/cybergfx/SDL_cgxvideo.h --- a/src/video/cybergfx/SDL_cgxvideo.h Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/cybergfx/SDL_cgxvideo.h Tue Feb 07 09:29:18 2006 +0000 @@ -24,10 +24,6 @@ #define _SDL_cgxvideo_h -#include -#include -#include - #include #include #include @@ -47,9 +43,11 @@ #include #endif -#include "mydebug.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_mouse.h" #include "SDL_sysvideo.h" +#include "mydebug.h" #define USE_CGX_WRITELUTPIXEL diff -r c687f06c7473 -r 604d73db6802 src/video/cybergfx/SDL_cgxyuv.c --- a/src/video/cybergfx/SDL_cgxyuv.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/cybergfx/SDL_cgxyuv.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,14 +24,14 @@ #ifdef XFREE86_XV -#include -#include #include #include #include #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_x11yuv_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/dc/SDL_dcvideo.c --- a/src/video/dc/SDL_dcvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/dc/SDL_dcvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,11 +20,9 @@ slouken@libsdl.org */ -#include -#include -#include - #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" diff -r c687f06c7473 -r 604d73db6802 src/video/dga/SDL_dgavideo.c --- a/src/video/dga/SDL_dgavideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/dga/SDL_dgavideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,16 +23,14 @@ /* DGA 2.0 based SDL video driver implementation. */ -#include -#include +#include + #include #include -#ifdef HAVE_ALLOCA_H -#include -#endif - #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" @@ -390,7 +388,7 @@ /* Query for the list of available video modes */ modes = SDL_NAME(XDGAQueryModes)(DGA_Display, DGA_Screen, &num_modes); - qsort(modes, num_modes, sizeof *modes, cmpmodes); + SDL_qsort(modes, num_modes, sizeof *modes, cmpmodes); for ( i=0; i #include -#include -#include #include #include #include diff -r c687f06c7473 -r 604d73db6802 src/video/directfb/SDL_DirectFB_video.c --- a/src/video/directfb/SDL_DirectFB_video.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/directfb/SDL_DirectFB_video.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,9 +27,6 @@ /* DirectFB video driver implementation. */ -#include -#include -#include #include #include #include @@ -38,6 +35,8 @@ #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" @@ -110,7 +109,7 @@ device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice)); if (device) { - memset (device, 0, (sizeof *device)); + SDL_memset (device, 0, (sizeof *device)); device->hidden = (struct SDL_PrivateVideoData *) malloc (sizeof (*device->hidden)); } if (device == NULL || device->hidden == NULL) @@ -122,7 +121,7 @@ } return(0); } - memset (device->hidden, 0, sizeof (*device->hidden)); + SDL_memset (device->hidden, 0, sizeof (*device->hidden)); /* Set the function pointers */ device->VideoInit = DirectFB_VideoInit; @@ -195,7 +194,7 @@ HIDDEN->nummodes++; - enumrect = calloc(1, sizeof(struct DirectFBEnumRect)); + enumrect = SDL_calloc(1, sizeof(struct DirectFBEnumRect)); if (!enumrect) { SDL_OutOfMemory(); @@ -294,14 +293,14 @@ SDL_Palette *palette; SDL_Color *colors; - palette = calloc (1, sizeof(SDL_Palette)); + palette = SDL_calloc (1, sizeof(SDL_Palette)); if (!palette) { SDL_OutOfMemory(); return NULL; } - colors = calloc (size, sizeof(SDL_Color)); + colors = SDL_calloc (size, sizeof(SDL_Color)); if (!colors) { SDL_OutOfMemory(); @@ -432,7 +431,7 @@ goto error; } - HIDDEN->modelist = calloc (HIDDEN->nummodes + 1, sizeof(SDL_Rect *)); + HIDDEN->modelist = SDL_calloc (HIDDEN->nummodes + 1, sizeof(SDL_Rect *)); if (!HIDDEN->modelist) { SDL_OutOfMemory(); @@ -614,7 +613,7 @@ else if (!current->hwdata) { /* Allocate the hardware acceleration data */ - current->hwdata = (struct private_hwdata *) calloc (1, sizeof(*current->hwdata)); + current->hwdata = (struct private_hwdata *) SDL_calloc (1, sizeof(*current->hwdata)); if (!current->hwdata) { SDL_OutOfMemory(); @@ -821,7 +820,7 @@ return -1; /* Allocate the hardware acceleration data */ - surface->hwdata = (struct private_hwdata *) calloc (1, sizeof(*surface->hwdata)); + surface->hwdata = (struct private_hwdata *) SDL_calloc (1, sizeof(*surface->hwdata)); if (surface->hwdata == NULL) { SDL_OutOfMemory(); diff -r c687f06c7473 -r 604d73db6802 src/video/directfb/SDL_DirectFB_yuv.c --- a/src/video/directfb/SDL_DirectFB_yuv.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/directfb/SDL_DirectFB_yuv.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,9 +22,7 @@ /* This is the DirectFB implementation of YUV video overlays */ -#include -#include - +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_DirectFB_yuv.h" @@ -148,7 +146,7 @@ struct private_yuvhwdata *hwdata; /* Create the overlay structure */ - overlay = calloc (1, sizeof(SDL_Overlay)); + overlay = SDL_calloc (1, sizeof(SDL_Overlay)); if (!overlay) { SDL_OutOfMemory(); @@ -164,7 +162,7 @@ overlay->hwfuncs = &directfb_yuvfuncs; /* Create the pixel data and lookup tables */ - hwdata = calloc(1, sizeof(struct private_yuvhwdata)); + hwdata = SDL_calloc(1, sizeof(struct private_yuvhwdata)); overlay->hwdata = hwdata; if (!hwdata) { diff -r c687f06c7473 -r 604d73db6802 src/video/dummy/SDL_nullvideo.c --- a/src/video/dummy/SDL_nullvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/dummy/SDL_nullvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -35,11 +35,9 @@ * SDL video driver. Renamed to "DUMMY" by Sam Lantinga. */ -#include -#include -#include - #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" @@ -145,7 +143,9 @@ int DUMMY_VideoInit(_THIS, SDL_PixelFormat *vformat) { + /* fprintf(stderr, "WARNING: You are using the SDL dummy video driver!\n"); + */ /* Determine the screen depth (use default 8-bit depth) */ /* we change this during the SDL_SetVideoMode implementation... */ diff -r c687f06c7473 -r 604d73db6802 src/video/epoc/SDL_epocvideo.cpp --- a/src/video/epoc/SDL_epocvideo.cpp Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/epoc/SDL_epocvideo.cpp Tue Feb 07 09:29:18 2006 +0000 @@ -29,11 +29,9 @@ -#include -#include -#include - extern "C" { +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_timer.h" #include "SDL_video.h" diff -r c687f06c7473 -r 604d73db6802 src/video/fbcon/SDL_fbelo.c --- a/src/video/fbcon/SDL_fbelo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/fbcon/SDL_fbelo.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,12 +20,12 @@ slouken@libsdl.org */ -#include #include #include #include -#include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_fbvideo.h" #include "SDL_fbelo.h" diff -r c687f06c7473 -r 604d73db6802 src/video/fbcon/SDL_fbevents.c --- a/src/video/fbcon/SDL_fbevents.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/fbcon/SDL_fbevents.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,14 +22,12 @@ /* Handle the event stream, converting console events into SDL events */ +#include #include #include #include -#include -#include #include #include -#include #include #include @@ -42,6 +40,8 @@ #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_mutex.h" #include "SDL_sysevents.h" #include "SDL_sysvideo.h" @@ -260,7 +260,7 @@ for ( i=0; vcs[i] && (keyboard_fd < 0); ++i ) { char vtpath[12]; - sprintf(vtpath, vcs[i], current_vt); + SDL_snprintf(vtpath, SDL_arraysize(vtpath), vcs[i], current_vt); keyboard_fd = open(vtpath, O_RDWR, 0); #ifdef DEBUG_KEYBOARD fprintf(stderr, "vtpath = %s, fd = %d\n", @@ -345,7 +345,7 @@ char path[PATH_MAX]; char name[PATH_MAX]; - sprintf(path, "/proc/%s/status", entry->d_name); + SDL_snprintf(path, SDL_arraysize(path), "/proc/%s/status", entry->d_name); status=fopen(path, "r"); if ( status ) { name[0] = '\0'; @@ -379,7 +379,7 @@ proc = opendir("/proc"); if ( proc ) { while ( (pid=find_pid(proc, "gpm")) > 0 ) { - sprintf(path, "/proc/%d/cmdline", pid); + SDL_snprintf(path, SDL_arraysize(path), "/proc/%d/cmdline", pid); cmdline = open(path, O_RDONLY, 0); if ( cmdline >= 0 ) { len = read(cmdline, args, sizeof(args)); diff -r c687f06c7473 -r 604d73db6802 src/video/fbcon/SDL_fbvideo.c --- a/src/video/fbcon/SDL_fbvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/fbcon/SDL_fbvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,16 +23,17 @@ /* Framebuffer console based SDL video driver implementation. */ -#include #include -#include #include #include #include #include #include /* For definition of PAGE_SIZE */ +#include /* For ioperm() */ #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" @@ -53,10 +54,12 @@ #ifndef FB_AUX_VGA_PLANES_VGA4 #define FB_AUX_VGA_PLANES_VGA4 0 #endif +/* static inline void outb (unsigned char value, unsigned short port) { __asm__ __volatile__ ("outb %b0,%w1"::"a" (value), "Nd" (port)); } +*/ #endif /* FB_TYPE_VGA_PLANES */ /* A list of video resolutions that we query for (sorted largest to smallest) */ @@ -438,7 +441,7 @@ int i; for ( i=0; i 0 ) { - qsort(SDL_modelist[i], SDL_nummodes[i], sizeof *SDL_modelist[i], cmpmodes); + SDL_qsort(SDL_modelist[i], SDL_nummodes[i], sizeof *SDL_modelist[i], cmpmodes); } } } diff -r c687f06c7473 -r 604d73db6802 src/video/gapi/SDL_gapivideo.c --- a/src/video/gapi/SDL_gapivideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/gapi/SDL_gapivideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -32,11 +32,8 @@ // TODO: windib on SH3 PPC2000 landscape test // TODO: optimize 8bpp landscape mode -#include -#include -#include - #include "SDL.h" +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" @@ -479,7 +476,7 @@ /* Sort the mode lists */ for ( i=0; iSDL_nummodes[i] > 0 ) { - qsort(gapi->SDL_modelist[i], gapi->SDL_nummodes[i], sizeof *gapi->SDL_modelist[i], cmpmodes); + SDL_qsort(gapi->SDL_modelist[i], gapi->SDL_nummodes[i], sizeof *gapi->SDL_modelist[i], cmpmodes); } } diff -r c687f06c7473 -r 604d73db6802 src/video/gem/SDL_gemmouse.c --- a/src/video/gem/SDL_gemmouse.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/gem/SDL_gemmouse.c Tue Feb 07 09:29:18 2006 +0000 @@ -26,10 +26,9 @@ * Patrice Mandin */ -#include - #include +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_mouse.h" #include "SDL_events_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/gem/SDL_gemvideo.c --- a/src/video/gem/SDL_gemvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/gem/SDL_gemvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -28,10 +28,6 @@ Olivier Landemarre, Johan Klockars, Xavier Joubert, Claude Attard */ -#include -#include -#include - /* Mint includes */ #include #include @@ -39,6 +35,8 @@ #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" diff -r c687f06c7473 -r 604d73db6802 src/video/ggi/SDL_ggievents.c --- a/src/video/ggi/SDL_ggievents.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/ggi/SDL_ggievents.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,8 +24,6 @@ #include #include -#include -#include #include #include #include diff -r c687f06c7473 -r 604d73db6802 src/video/ggi/SDL_ggivideo.c --- a/src/video/ggi/SDL_ggivideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/ggi/SDL_ggivideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,8 +23,6 @@ /* GGI-based SDL video driver implementation. */ -#include -#include #include #include #include @@ -33,6 +31,8 @@ #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" diff -r c687f06c7473 -r 604d73db6802 src/video/ipod/SDL_ipodvideo.c --- a/src/video/ipod/SDL_ipodvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/ipod/SDL_ipodvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -1,8 +1,6 @@ #include #include -#include -#include #include #include #include @@ -15,6 +13,8 @@ #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" @@ -93,15 +93,15 @@ { SDL_VideoDevice *this; - this = (SDL_VideoDevice *)malloc (sizeof(SDL_VideoDevice)); + this = (SDL_VideoDevice *)SDL_malloc (sizeof(SDL_VideoDevice)); if (this) { memset (this, 0, sizeof *this); - this->hidden = (struct SDL_PrivateVideoData *) malloc (sizeof(struct SDL_PrivateVideoData)); + this->hidden = (struct SDL_PrivateVideoData *) SDL_malloc (sizeof(struct SDL_PrivateVideoData)); } if (!this || !this->hidden) { SDL_OutOfMemory(); if (this) - free (this); + SDL_free (this); return 0; } memset (this->hidden, 0, sizeof(struct SDL_PrivateVideoData)); @@ -178,7 +178,7 @@ for ( i=0; vcs[i] && (kbfd < 0); ++i ) { char vtpath[12]; - sprintf(vtpath, vcs[i], curvt); + SDL_snprintf(vtpath, SDL_arraysize(vtpath), vcs[i], curvt); kbfd = open(vtpath, O_RDWR); } } @@ -320,8 +320,8 @@ Rmask = Gmask = Bmask = 0; } - if (this->hidden->buffer) free (this->hidden->buffer); - this->hidden->buffer = malloc (width * height * (bpp / 8)); + if (this->hidden->buffer) SDL_free (this->hidden->buffer); + this->hidden->buffer = SDL_malloc (width * height * (bpp / 8)); if (!this->hidden->buffer) { SDL_SetError ("Couldn't allocate buffer for requested mode"); return 0; @@ -331,7 +331,7 @@ if (!SDL_ReallocFormat (current, bpp, Rmask, Gmask, Bmask, 0)) { SDL_SetError ("Couldn't allocate new pixel format"); - free (this->hidden->buffer); + SDL_free (this->hidden->buffer); this->hidden->buffer = 0; return 0; } diff -r c687f06c7473 -r 604d73db6802 src/video/maccommon/SDL_macmouse.c --- a/src/video/maccommon/SDL_macmouse.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/maccommon/SDL_macmouse.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,8 +20,6 @@ slouken@libsdl.org */ -#include -#include #if defined(__APPLE__) && defined(__MACH__) #include #elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335) @@ -35,6 +33,8 @@ #include #endif +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_mouse.h" #include "SDL_macmouse_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/maccommon/SDL_macwm.c --- a/src/video/maccommon/SDL_macwm.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/maccommon/SDL_macwm.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,9 +20,6 @@ slouken@libsdl.org */ -#include -#include - #if defined(__APPLE__) && defined(__MACH__) #include #elif TARGET_API_MAC_CARBON && (UNIVERSAL_INTERFACES_VERSION > 0x0335) @@ -32,6 +29,7 @@ #include #endif +#include "SDL_string.h" #include "SDL_macwm_c.h" void Mac_SetCaption(_THIS, const char *title, const char *icon) diff -r c687f06c7473 -r 604d73db6802 src/video/macdsp/SDL_dspvideo.c --- a/src/video/macdsp/SDL_dspvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/macdsp/SDL_dspvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -122,9 +122,6 @@ #define DSP_NO_SYNC_OPENGL -#include -#include - #if defined(__APPLE__) && defined(__MACH__) #include #include @@ -140,6 +137,8 @@ #include #endif +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_video.h" #include "SDL_blit.h" #include "SDL_error.h" @@ -265,7 +264,7 @@ if ( device ) { if (device->hidden) - free (device->hidden); + SDL_free(device->hidden); SDL_free(device); } @@ -390,14 +389,14 @@ done: i++; /* i was not incremented before kicking out of the loop */ - mode_list = (SDL_Rect**) malloc (sizeof (SDL_Rect*) * (i+1)); + mode_list = (SDL_Rect**) SDL_malloc (sizeof (SDL_Rect*) * (i+1)); if (mode_list) { /* -dw- new stuff: build in reverse order so largest sizes list first */ for (j = i-1; j >= 0; j--) { - mode_list [j] = (SDL_Rect*) malloc (sizeof (SDL_Rect)); + mode_list [j] = (SDL_Rect*) SDL_malloc (sizeof (SDL_Rect)); if (mode_list [j]) - memcpy (mode_list [j], &(temp_list [j]), sizeof (SDL_Rect)); + SDL_memcpy (mode_list [j], &(temp_list [j]), sizeof (SDL_Rect)); else { SDL_OutOfMemory (); return NULL; @@ -475,7 +474,7 @@ return 0; } - memset (&attrib, 0, sizeof (DSpContextAttributes)); + SDL_memset (&attrib, 0, sizeof (DSpContextAttributes)); /* These attributes are hopefully supported on all devices...*/ attrib.displayWidth = 640; @@ -657,7 +656,7 @@ fmt = "Hardware surface could not be allocated in %s - unknown error"; break; } - sprintf(message, fmt, mem); + SDL_snprintf(message, SDL_arraysize(message), fmt, mem); SDL_SetError(message); } #endif // TARGET_API_MAC_OSX @@ -735,7 +734,7 @@ DisposeGWorld (dsp_back_buffer); if (current->hwdata) - free (current->hwdata); + SDL_free(current->hwdata); DSpContext_SetState (dsp_context, kDSpContextState_Inactive ); DSpContext_Release (dsp_context); @@ -788,7 +787,7 @@ page_count = 1; } - memset (&attrib, 0, sizeof (DSpContextAttributes)); + SDL_memset (&attrib, 0, sizeof (DSpContextAttributes)); attrib.displayWidth = width; attrib.displayHeight = height; attrib.displayBestDepth = bpp; @@ -867,7 +866,7 @@ /* single-buffer context */ DSpContext_GetFrontBuffer (dsp_context, &dsp_back_buffer); - current->hwdata = (private_hwdata*) malloc (sizeof (private_hwdata)); + current->hwdata = (private_hwdata*) SDL_malloc (sizeof (private_hwdata)); if (current ->hwdata == NULL) { SDL_OutOfMemory (); return NULL; @@ -885,13 +884,13 @@ } else if ( DSp_NewHWSurface(this, &dsp_back_buffer, bpp, width-1, height-1) == 0 ) { - current->hwdata = (private_hwdata*) malloc (sizeof (private_hwdata)); + current->hwdata = (private_hwdata*) SDL_malloc (sizeof (private_hwdata)); if (current ->hwdata == NULL) { SDL_OutOfMemory (); return NULL; } - memset (current->hwdata, 0, sizeof (private_hwdata)); + SDL_memset (current->hwdata, 0, sizeof (private_hwdata)); current->hwdata->offscreen = dsp_back_buffer; current->flags |= SDL_DOUBLEBUF | SDL_HWSURFACE; this->UpdateRects = DSp_DirectUpdate; /* hardware doesn't do update rects, must be page-flipped */ @@ -1084,13 +1083,13 @@ if ( DSp_NewHWSurface (this, &temp, surface->format->BitsPerPixel, surface->w, surface->h) < 0 ) return (-1); - surface->hwdata = (private_hwdata*) malloc (sizeof (private_hwdata)); + surface->hwdata = (private_hwdata*) SDL_malloc (sizeof (private_hwdata)); if (surface->hwdata == NULL) { SDL_OutOfMemory (); return -1; } - memset (surface->hwdata, 0, sizeof(private_hwdata)); + SDL_memset (surface->hwdata, 0, sizeof(private_hwdata)); surface->hwdata->offscreen = temp; surface->pitch = GetPixRowBytes (GetPortPixMap (temp)) & 0x3FFF; surface->pixels = GetPixBaseAddr (GetPortPixMap (temp)); @@ -1105,7 +1104,7 @@ { if (surface->hwdata->offscreen != NULL) DisposeGWorld (surface->hwdata->offscreen); - free (surface->hwdata); + SDL_free(surface->hwdata); surface->pixels = NULL; } diff -r c687f06c7473 -r 604d73db6802 src/video/macrom/SDL_romvideo.c --- a/src/video/macrom/SDL_romvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/macrom/SDL_romvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,9 +20,6 @@ slouken@libsdl.org */ -#include -#include - #if defined(__APPLE__) && defined(__MACH__) #include #if USE_QUICKTIME @@ -44,6 +41,8 @@ #include #endif +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_video.h" #include "SDL_error.h" #include "SDL_syswm.h" diff -r c687f06c7473 -r 604d73db6802 src/video/nanox/SDL_nximage.c --- a/src/video/nanox/SDL_nximage.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/nanox/SDL_nximage.c Tue Feb 07 09:29:18 2006 +0000 @@ -25,9 +25,8 @@ clare@setabox.com */ -#include -#include - +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_nximage_c.h" @@ -106,7 +105,7 @@ else { for (j = h; j > 0; -- j, src += yinc, dest += destinc) - memcpy (dest, src, rowinc) ; + SDL_memcpy (dest, src, rowinc) ; } if (!Clientfb) { if (currently_fullscreen) { @@ -128,13 +127,13 @@ Dprintf ("enter NX_SetupImage\n") ; - screen -> pixels = (void *) malloc (size) ; + screen -> pixels = (void *) SDL_malloc (size) ; if (!Clientfb) { - Image_buff = (unsigned char *) malloc (size) ; + Image_buff = (unsigned char *) SDL_malloc (size) ; if (screen -> pixels == NULL || Image_buff == NULL) { - free (screen -> pixels) ; - free (Image_buff) ; + SDL_free (screen -> pixels) ; + SDL_free (Image_buff) ; SDL_OutOfMemory () ; return -1 ; } @@ -152,8 +151,8 @@ { Dprintf ("enter NX_DestroyImage\n") ; - if (SDL_Image) free (SDL_Image) ; - if (Image_buff) free (Image_buff) ; + if (SDL_Image) SDL_free (SDL_Image) ; + if (Image_buff) SDL_free (Image_buff) ; if (screen) screen -> pixels = NULL ; Dprintf ("leave NX_DestroyImage\n") ; @@ -215,7 +214,7 @@ rowinc = xinc * this -> screen -> w; for (j = this -> screen -> h; j > 0; -- j, src += yinc, dest += fbinfo.pitch) - memcpy (dest, src, rowinc) ; + SDL_memcpy (dest, src, rowinc) ; } else #endif diff -r c687f06c7473 -r 604d73db6802 src/video/nanox/SDL_nxmodes.c --- a/src/video/nanox/SDL_nxmodes.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/nanox/SDL_nxmodes.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,8 +24,8 @@ clare@setabox.com */ -#include - +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_nxmodes_c.h" SDL_Rect ** NX_ListModes (_THIS, SDL_PixelFormat * format, Uint32 flags) @@ -46,9 +46,9 @@ if (SDL_modelist) { for (i = 0; SDL_modelist [i]; ++ i) { - free (SDL_modelist [i]) ; + SDL_free (SDL_modelist [i]) ; } - free (SDL_modelist) ; + SDL_free (SDL_modelist) ; SDL_modelist = NULL; } } diff -r c687f06c7473 -r 604d73db6802 src/video/nanox/SDL_nxmouse.c --- a/src/video/nanox/SDL_nxmouse.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/nanox/SDL_nxmouse.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,8 +24,7 @@ clare@setabox.com */ -#include - +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_events_c.h" @@ -43,7 +42,7 @@ Dprintf ("enter NX_CreateWMCursor\n") ; - cursor = (WMcursor *) malloc (sizeof (WMcursor)) ; + cursor = (WMcursor *) SDL_malloc (sizeof (WMcursor)) ; if (cursor == NULL) { SDL_OutOfMemory () ; return NULL ; @@ -56,7 +55,7 @@ void NX_FreeWMCursor (_THIS, WMcursor * cursor) { Dprintf ("NX_FreeWMCursor\n") ; - free (cursor) ; + SDL_free (cursor) ; return ; } diff -r c687f06c7473 -r 604d73db6802 src/video/nanox/SDL_nxvideo.c --- a/src/video/nanox/SDL_nxvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/nanox/SDL_nxvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -25,9 +25,8 @@ clare@setabox.com */ -#include -#include - +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_video.h" #include "SDL_pixels_c.h" #include "SDL_events_c.h" @@ -84,11 +83,11 @@ Dprintf ("enter NX_CreateDevice\n") ; // Initialize all variables that we clean on shutdown - device = (SDL_VideoDevice *) malloc (sizeof (SDL_VideoDevice)) ; + device = (SDL_VideoDevice *) SDL_malloc (sizeof (SDL_VideoDevice)) ; if (device) { - memset (device, 0, (sizeof * device)) ; + SDL_memset (device, 0, (sizeof * device)) ; device -> hidden = (struct SDL_PrivateVideoData *) - malloc ((sizeof * device -> hidden)) ; + SDL_malloc ((sizeof * device -> hidden)) ; device -> gl_data = NULL ; } if ((device == NULL) || (device -> hidden == NULL)) { @@ -96,7 +95,7 @@ NX_DeleteDevice (device) ; return 0 ; } - memset (device -> hidden, 0, (sizeof * device -> hidden)) ; + SDL_memset (device -> hidden, 0, (sizeof * device -> hidden)) ; // Set the function pointers device -> VideoInit = NX_VideoInit ; @@ -212,9 +211,9 @@ SDL_Visual.bpp = si.bpp ; // GetVideoMode - SDL_modelist = (SDL_Rect **) malloc (sizeof (SDL_Rect *) * 2) ; + SDL_modelist = (SDL_Rect **) SDL_malloc (sizeof (SDL_Rect *) * 2) ; if (SDL_modelist) { - SDL_modelist [0] = (SDL_Rect *) malloc (sizeof(SDL_Rect)) ; + SDL_modelist [0] = (SDL_Rect *) SDL_malloc (sizeof(SDL_Rect)) ; if (SDL_modelist [0]) { SDL_modelist [0] -> x = 0 ; SDL_modelist [0] -> y = 0 ; @@ -486,9 +485,9 @@ if (SDL_Visual.bpp != 32 && SDL_Visual.bpp != 24) return -1 ; - if (! GammaRamp_R) GammaRamp_R = (Uint16 *) malloc (sizeof (Uint16) * CI_SIZE) ; - if (! GammaRamp_G) GammaRamp_G = (Uint16 *) malloc (sizeof (Uint16) * CI_SIZE) ; - if (! GammaRamp_B) GammaRamp_B = (Uint16 *) malloc (sizeof (Uint16) * CI_SIZE) ; + if (! GammaRamp_R) GammaRamp_R = (Uint16 *) SDL_malloc (sizeof (Uint16) * CI_SIZE) ; + if (! GammaRamp_G) GammaRamp_G = (Uint16 *) SDL_malloc (sizeof (Uint16) * CI_SIZE) ; + if (! GammaRamp_B) GammaRamp_B = (Uint16 *) SDL_malloc (sizeof (Uint16) * CI_SIZE) ; if ((! GammaRamp_R) || (! GammaRamp_G) || (! GammaRamp_B)) { SDL_OutOfMemory () ; return -1 ; diff -r c687f06c7473 -r 604d73db6802 src/video/nanox/SDL_nxwm.c --- a/src/video/nanox/SDL_nxwm.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/nanox/SDL_nxwm.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,8 +24,6 @@ clare@setabox.com */ -#include - #include "SDL_syswm.h" #include "SDL_error.h" #include "SDL_events_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/os2fslib/SDL_os2fslib.c --- a/src/video/os2fslib/SDL_os2fslib.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/os2fslib/SDL_os2fslib.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,13 +20,12 @@ slouken@libsdl.org */ -#include -#include -#include #include #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" diff -r c687f06c7473 -r 604d73db6802 src/video/photon/SDL_ph_image.c --- a/src/video/photon/SDL_ph_image.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/photon/SDL_ph_image.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,12 +20,12 @@ slouken@libsdl.org */ -#include - #include #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_endian.h" #include "SDL_video.h" diff -r c687f06c7473 -r 604d73db6802 src/video/photon/SDL_ph_modes.c --- a/src/video/photon/SDL_ph_modes.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/photon/SDL_ph_modes.c Tue Feb 07 09:29:18 2006 +0000 @@ -173,7 +173,7 @@ return -1; } - qsort(mode_list.modes, mode_list.num_modes, sizeof(unsigned short), compare_modes_by_res); + SDL_qsort(mode_list.modes, mode_list.num_modes, sizeof(unsigned short), compare_modes_by_res); for(i=0;i -#include -#include - +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_mouse.h" #include "SDL_events_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/photon/SDL_ph_video.c --- a/src/video/photon/SDL_ph_video.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/photon/SDL_ph_video.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,13 +20,12 @@ slouken@libsdl.org */ -#include -#include #include -#include #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_timer.h" #include "SDL_thread.h" diff -r c687f06c7473 -r 604d73db6802 src/video/photon/SDL_ph_wm.c --- a/src/video/photon/SDL_ph_wm.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/photon/SDL_ph_wm.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,13 +22,13 @@ #define DISABLE_X11 -#include -#include #include #include #include #include + #include "SDL_version.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_timer.h" #include "SDL_video.h" diff -r c687f06c7473 -r 604d73db6802 src/video/photon/SDL_phyuv.c --- a/src/video/photon/SDL_phyuv.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/photon/SDL_phyuv.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,13 +22,13 @@ /* This is the QNX Realtime Platform version of SDL YUV video overlays */ -#include -#include #include #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_phyuv_c.h" @@ -81,7 +81,7 @@ PhPoint_t pos; /* Create the overlay structure */ - overlay = calloc(1, sizeof(SDL_Overlay)); + overlay = SDL_calloc(1, sizeof(SDL_Overlay)); if (overlay == NULL) { @@ -99,7 +99,7 @@ overlay->hwfuncs = &ph_yuvfuncs; /* Create the pixel data and lookup tables */ - hwdata = calloc(1, sizeof(struct private_yuvhwdata)); + hwdata = SDL_calloc(1, sizeof(struct private_yuvhwdata)); if (hwdata == NULL) { @@ -132,8 +132,8 @@ overlay->hwdata->CurrentViewPort.size.w = width; overlay->hwdata->CurrentViewPort.size.h = height; overlay->hwdata->State = OVERLAY_STATE_UNINIT; - overlay->hwdata->FrameData0 = (FRAMEDATA *) calloc(1, sizeof(FRAMEDATA)); - overlay->hwdata->FrameData1 = (FRAMEDATA *) calloc(1, sizeof(FRAMEDATA)); + overlay->hwdata->FrameData0 = (FRAMEDATA *) SDL_calloc(1, sizeof(FRAMEDATA)); + overlay->hwdata->FrameData1 = (FRAMEDATA *) SDL_calloc(1, sizeof(FRAMEDATA)); vidport = -1; i=0; @@ -246,8 +246,8 @@ /* Find the pitch and offset values for the overlay */ overlay->planes = planes; - overlay->pitches = calloc(overlay->planes, sizeof(Uint16)); - overlay->pixels = calloc(overlay->planes, sizeof(Uint8*)); + overlay->pitches = SDL_calloc(overlay->planes, sizeof(Uint16)); + overlay->pixels = SDL_calloc(overlay->planes, sizeof(Uint8*)); if (!overlay->pitches || !overlay->pixels) { SDL_OutOfMemory(); diff -r c687f06c7473 -r 604d73db6802 src/video/picogui/SDL_pgvideo.c --- a/src/video/picogui/SDL_pgvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/picogui/SDL_pgvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,11 +23,9 @@ micahjd@users.sourceforge.net */ -#include -#include -#include - #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" diff -r c687f06c7473 -r 604d73db6802 src/video/ps2gs/SDL_gsevents.c --- a/src/video/ps2gs/SDL_gsevents.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/ps2gs/SDL_gsevents.c Tue Feb 07 09:29:18 2006 +0000 @@ -25,11 +25,8 @@ #include #include #include -#include -#include #include #include -#include #include #include @@ -42,6 +39,7 @@ #include #include "SDL.h" +#include "SDL_string.h" #include "SDL_mutex.h" #include "SDL_sysevents.h" #include "SDL_sysvideo.h" @@ -257,7 +255,7 @@ for ( i=0; vcs[i] && (keyboard_fd < 0); ++i ) { char vtpath[12]; - sprintf(vtpath, vcs[i], current_vt); + SDL_snprintf(vtpath, SDL_arraysize(vtpath), vcs[i], current_vt); keyboard_fd = open(vtpath, O_RDWR, 0); #ifdef DEBUG_KEYBOARD fprintf(stderr, "vtpath = %s, fd = %d\n", @@ -333,7 +331,7 @@ char path[PATH_MAX]; char name[PATH_MAX]; - sprintf(path, "/proc/%s/status", entry->d_name); + SDL_snprintf(path, SDL_arraysize(path), "/proc/%s/status", entry->d_name); status=fopen(path, "r"); if ( status ) { name[0] = '\0'; @@ -367,7 +365,7 @@ proc = opendir("/proc"); if ( proc ) { while ( (pid=find_pid(proc, "gpm")) > 0 ) { - sprintf(path, "/proc/%d/cmdline", pid); + SDL_snprintf(path, SDL_arraysize(path), "/proc/%d/cmdline", pid); cmdline = open(path, O_RDONLY, 0); if ( cmdline >= 0 ) { len = read(cmdline, args, sizeof(args)); diff -r c687f06c7473 -r 604d73db6802 src/video/ps2gs/SDL_gsmouse.c --- a/src/video/ps2gs/SDL_gsmouse.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/ps2gs/SDL_gsmouse.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,8 +20,6 @@ slouken@libsdl.org */ -#include -#include #include #include "SDL_error.h" diff -r c687f06c7473 -r 604d73db6802 src/video/ps2gs/SDL_gsvideo.c --- a/src/video/ps2gs/SDL_gsvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/ps2gs/SDL_gsvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,14 +23,14 @@ /* Framebuffer console based SDL video driver implementation. */ -#include -#include #include #include #include #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" diff -r c687f06c7473 -r 604d73db6802 src/video/ps2gs/SDL_gsyuv.c --- a/src/video/ps2gs/SDL_gsyuv.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/ps2gs/SDL_gsyuv.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,14 +22,14 @@ /* This is the Playstation 2 implementation of YUV video overlays */ -#include -#include #include #include #include #include #include /* For definition of PAGE_SIZE */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_gsyuv_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/qtopia/SDL_sysmouse.cc --- a/src/video/qtopia/SDL_sysmouse.cc Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/qtopia/SDL_sysmouse.cc Tue Feb 07 09:29:18 2006 +0000 @@ -20,11 +20,6 @@ slouken@libsdl.org */ -#include -#include - - -#include "SDL_error.h" #include "SDL_QWin.h" extern "C" { diff -r c687f06c7473 -r 604d73db6802 src/video/qtopia/SDL_sysvideo.cc --- a/src/video/qtopia/SDL_sysvideo.cc Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/qtopia/SDL_sysvideo.cc Tue Feb 07 09:29:18 2006 +0000 @@ -22,16 +22,14 @@ /* Qtopia based framebuffer implementation */ -#include -#include - -#include #include #include #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_timer.h" #include "SDL_QWin.h" diff -r c687f06c7473 -r 604d73db6802 src/video/quartz/SDL_QuartzEvents.m --- a/src/video/quartz/SDL_QuartzEvents.m Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/quartz/SDL_QuartzEvents.m Tue Feb 07 09:29:18 2006 +0000 @@ -20,9 +20,9 @@ slouken@libsdl.org */ +#include "SDL_stdlib.h" #include "SDL_QuartzVideo.h" -#include // For getenv() #include // For wake from sleep detection #include // For wake from sleep detection #include "SDL_QuartzKeys.h" @@ -295,7 +295,7 @@ } } - if (getenv ("SDL_ENABLEAPPEVENTS")) + if (SDL_getenv ("SDL_ENABLEAPPEVENTS")) [ NSApp sendEvent:event ]; } @@ -773,7 +773,7 @@ switch (type) { case NSLeftMouseDown: - if ( getenv("SDL_HAS3BUTTONMOUSE") ) { + if ( SDL_getenv("SDL_HAS3BUTTONMOUSE") ) { DO_MOUSE_DOWN (SDL_BUTTON_LEFT); } else { if ( NSCommandKeyMask & current_mods ) { diff -r c687f06c7473 -r 604d73db6802 src/video/riscos/SDL_riscosFullScreenVideo.c --- a/src/video/riscos/SDL_riscosFullScreenVideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/riscos/SDL_riscosFullScreenVideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,11 +27,9 @@ Implements RISC OS full screen display. */ -#include -#include -#include - #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" @@ -357,7 +355,7 @@ /* Sort the mode lists */ for ( j=0; j 0 ) { - qsort(SDL_modelist[j], SDL_nummodes[j], sizeof *SDL_modelist[j], cmpmodes); + SDL_qsort(SDL_modelist[j], SDL_nummodes[j], sizeof *SDL_modelist[j], cmpmodes); } } } diff -r c687f06c7473 -r 604d73db6802 src/video/riscos/SDL_riscosmouse.c --- a/src/video/riscos/SDL_riscosmouse.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/riscos/SDL_riscosmouse.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,9 +27,7 @@ Implements mouse cursor shape definitions and positioning */ -#include -#include - +#include "SDL_stdlib.h" #include "SDL_error.h" #include "SDL_mouse.h" #include "SDL_events_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/riscos/SDL_riscossprite.c --- a/src/video/riscos/SDL_riscossprite.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/riscos/SDL_riscossprite.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,9 +27,10 @@ Implements Sprite plotting code for wimp display.window */ -#include #include "kernel.h" #include "swis.h" + +#include "SDL_stdlib.h" #include "SDL_riscosvideo.h" extern void WIMP_ReadModeInfo(_THIS); diff -r c687f06c7473 -r 604d73db6802 src/video/riscos/SDL_riscostask.c --- a/src/video/riscos/SDL_riscostask.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/riscos/SDL_riscostask.c Tue Feb 07 09:29:18 2006 +0000 @@ -31,12 +31,11 @@ Restoring desktop after switching to full screen */ -#include -#include - #include "kernel.h" #include "swis.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_riscostask.h" #ifndef DISABLE_THREADS diff -r c687f06c7473 -r 604d73db6802 src/video/riscos/SDL_riscosvideo.c --- a/src/video/riscos/SDL_riscosvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/riscos/SDL_riscosvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -29,11 +29,9 @@ into other source files. */ -#include -#include -#include - #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_syswm.h" #include "SDL_error.h" #include "SDL_video.h" diff -r c687f06c7473 -r 604d73db6802 src/video/riscos/SDL_wimpvideo.c --- a/src/video/riscos/SDL_wimpvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/riscos/SDL_wimpvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,11 +27,9 @@ Implements RISC OS Wimp display. */ -#include -#include -#include - #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" diff -r c687f06c7473 -r 604d73db6802 src/video/svga/SDL_svgaevents.c --- a/src/video/svga/SDL_svgaevents.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/svga/SDL_svgaevents.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,9 +22,6 @@ /* Handle the event stream, converting X11 events into SDL events */ -#include -#include - #include #include #include @@ -38,6 +35,8 @@ #endif #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_sysevents.h" #include "SDL_events_c.h" #include "SDL_svgavideo.h" diff -r c687f06c7473 -r 604d73db6802 src/video/svga/SDL_svgavideo.c --- a/src/video/svga/SDL_svgavideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/svga/SDL_svgavideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,8 +23,6 @@ /* SVGAlib based SDL video driver implementation. */ -#include -#include #include #include #include @@ -43,6 +41,8 @@ #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" diff -r c687f06c7473 -r 604d73db6802 src/video/vgl/SDL_vglvideo.c --- a/src/video/vgl/SDL_vglvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/vgl/SDL_vglvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -25,8 +25,6 @@ #include #include -#include -#include #include #include @@ -36,6 +34,8 @@ #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" diff -r c687f06c7473 -r 604d73db6802 src/video/wincommon/SDL_sysevents.c --- a/src/video/wincommon/SDL_sysevents.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/wincommon/SDL_sysevents.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,12 +22,12 @@ #include "SDL_windows.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_events.h" #include "SDL_video.h" #include "SDL_error.h" #include "SDL_syswm.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_getenv.h" #include "SDL_sysevents.h" #include "SDL_events_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/wincommon/SDL_sysmouse.c --- a/src/video/wincommon/SDL_sysmouse.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/wincommon/SDL_sysmouse.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,10 +22,10 @@ #include "SDL_windows.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_mouse.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_sysmouse_c.h" #include "SDL_events_c.h" #include "SDL_cursor_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/wincommon/SDL_syswm.c --- a/src/video/wincommon/SDL_syswm.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/wincommon/SDL_syswm.c Tue Feb 07 09:29:18 2006 +0000 @@ -23,11 +23,11 @@ #include "SDL_windows.h" #include "SDL_version.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_syswm.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_syswm_c.h" #include "SDL_wingl_c.h" #include "SDL_pixels_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/wincommon/SDL_wingl.c --- a/src/video/wincommon/SDL_wingl.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/wincommon/SDL_wingl.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,12 +22,12 @@ /* WGL implementation of SDL OpenGL support */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #ifdef HAVE_OPENGL #include "SDL_opengl.h" #endif #include "SDL_error.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_lowvideo.h" #include "SDL_wingl_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/windib/SDL_dibevents.c --- a/src/video/windib/SDL_dibevents.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/windib/SDL_dibevents.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,11 +22,11 @@ #include "SDL_windows.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_events.h" #include "SDL_error.h" #include "SDL_syswm.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_sysevents.h" #include "SDL_events_c.h" #include "SDL_lowvideo.h" diff -r c687f06c7473 -r 604d73db6802 src/video/windib/SDL_dibvideo.c --- a/src/video/windib/SDL_dibvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/windib/SDL_dibvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -35,10 +35,10 @@ #endif #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_mutex.h" #include "SDL_syswm.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_sysvideo.h" #include "SDL_sysevents.h" #include "SDL_events_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/windx5/SDL_dx5events.c --- a/src/video/windx5/SDL_dx5events.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/windx5/SDL_dx5events.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,12 +24,12 @@ #include "directx.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_events.h" #include "SDL_video.h" #include "SDL_error.h" #include "SDL_syswm.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_sysevents.h" #include "SDL_events_c.h" #include "SDL_lowvideo.h" diff -r c687f06c7473 -r 604d73db6802 src/video/windx5/SDL_dx5video.c --- a/src/video/windx5/SDL_dx5video.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/windx5/SDL_dx5video.c Tue Feb 07 09:29:18 2006 +0000 @@ -28,12 +28,12 @@ #define CDS_FULLSCREEN 4 #endif +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_timer.h" #include "SDL_events.h" #include "SDL_syswm.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_sysvideo.h" #include "SDL_blit.h" #include "SDL_pixels_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/windx5/SDL_dx5yuv.c --- a/src/video/windx5/SDL_dx5yuv.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/windx5/SDL_dx5yuv.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,10 +22,10 @@ /* This is the DirectDraw implementation of YUV video overlays */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" -#include "SDL_stdlib.h" -#include "SDL_string.h" #include "SDL_dx5yuv_c.h" #include "SDL_yuvfuncs.h" diff -r c687f06c7473 -r 604d73db6802 src/video/wscons/SDL_wsconsvideo.c --- a/src/video/wscons/SDL_wsconsvideo.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/wscons/SDL_wsconsvideo.c Tue Feb 07 09:29:18 2006 +0000 @@ -26,13 +26,11 @@ #include #include #include -#include -#include -#include -#include #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" diff -r c687f06c7473 -r 604d73db6802 src/video/x11/SDL_x11dga.c --- a/src/video/x11/SDL_x11dga.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/x11/SDL_x11dga.c Tue Feb 07 09:29:18 2006 +0000 @@ -25,7 +25,8 @@ There will be a completely separate DGA driver that is fullscreen-only. */ -#include /* For SDL_getenv() */ +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_video.h" #include "SDL_cursor_c.h" #include "SDL_x11dga_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/x11/SDL_x11events.c --- a/src/video/x11/SDL_x11events.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/x11/SDL_x11events.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,9 +22,6 @@ /* Handle the event stream, converting X11 events into SDL events */ -#include -#include -#include #include #include #include @@ -37,6 +34,7 @@ #include #include "SDL.h" +#include "SDL_string.h" #include "SDL_syswm.h" #include "SDL_sysevents.h" #include "SDL_sysvideo.h" diff -r c687f06c7473 -r 604d73db6802 src/video/x11/SDL_x11gl.c --- a/src/video/x11/SDL_x11gl.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/x11/SDL_x11gl.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,12 +20,11 @@ slouken@libsdl.org */ -#include /* For SDL_getenv() prototype */ -#include - -#include "SDL_events_c.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_x11video.h" +#include "SDL_events_c.h" #include "SDL_x11dga_c.h" #include "SDL_x11gl_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/x11/SDL_x11image.c --- a/src/video/x11/SDL_x11image.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/x11/SDL_x11image.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,9 +20,11 @@ slouken@libsdl.org */ -#include +#include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_endian.h" #include "SDL_events_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/x11/SDL_x11modes.c --- a/src/video/x11/SDL_x11modes.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/x11/SDL_x11modes.c Tue Feb 07 09:29:18 2006 +0000 @@ -22,9 +22,10 @@ /* Utilities for getting and setting the X display mode */ -#include -#include +#include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_timer.h" #include "SDL_error.h" #include "SDL_events.h" @@ -359,7 +360,7 @@ } #endif - qsort(modes, nmodes, sizeof *modes, cmpmodes); + SDL_qsort(modes, nmodes, sizeof *modes, cmpmodes); SDL_modelist = (SDL_Rect **)SDL_malloc((nmodes+2)*sizeof(SDL_Rect *)); if ( SDL_modelist ) { n = 0; diff -r c687f06c7473 -r 604d73db6802 src/video/x11/SDL_x11mouse.c --- a/src/video/x11/SDL_x11mouse.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/x11/SDL_x11mouse.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,13 +20,11 @@ slouken@libsdl.org */ -#include -#include -#include - #include #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_mouse.h" #include "SDL_events_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/x11/SDL_x11video.c --- a/src/video/x11/SDL_x11video.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/x11/SDL_x11video.c Tue Feb 07 09:29:18 2006 +0000 @@ -27,29 +27,16 @@ if full locking is neccessary, take a look at XInitThreads(). */ -#include -#include #include -#include #include #ifdef MTRR_SUPPORT #include #include #endif -#ifdef HAVE_ALLOCA_H -#include -#endif - -#ifdef HAVE_ALLOCA -#define ALLOCA(n) ((void*)alloca(n)) -#define FREEA(p) -#else -#define ALLOCA(n) SDL_malloc(n) -#define FREEA(p) SDL_free(p) -#endif - #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_timer.h" #include "SDL_thread.h" @@ -299,9 +286,9 @@ /* Next look at the application's executable name */ #if defined(linux) || defined(__FreeBSD__) #if defined(linux) - sprintf(procfile, "/proc/%d/exe", getpid()); + SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/exe", getpid()); #elif defined(__FreeBSD__) - sprintf(procfile, "/proc/%d/file", getpid()); + SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/file", getpid()); #else #error Where can we find the executable name? #endif @@ -1215,7 +1202,7 @@ /* private writable colormap: just set the colours we need */ XColor *xcmap; int i; - xcmap = ALLOCA(ncolors*sizeof(*xcmap)); + xcmap = SDL_stack_alloc(XColor, ncolors); if(xcmap == NULL) return 0; for ( i=0; iscreen->format->palette->ncolors; colors = this->screen->format->palette->colors; - freelist = ALLOCA(nc * sizeof(*freelist)); + freelist = SDL_stack_alloc(unsigned long, nc); /* make sure multiple allocations of the same cell are freed */ for(i = 0; i < ncolors; i++) { int pixel = firstcolor + i; @@ -1255,10 +1242,10 @@ } } pXFreeColors(GFX_Display, SDL_XColorMap, freelist, nfree, 0); - FREEA(freelist); + SDL_stack_free(freelist); - want = ALLOCA(ncolors * sizeof(SDL_Color)); - reject = ALLOCA(ncolors * sizeof(SDL_Color)); + want = SDL_stack_alloc(SDL_Color, ncolors); + reject = SDL_stack_alloc(SDL_Color, ncolors); SDL_memcpy(want, colors + firstcolor, ncolors * sizeof(SDL_Color)); /* make sure the user isn't fooled by her own wishes (black is safe, always available in the default colormap) */ @@ -1288,8 +1275,8 @@ } if(nrej) allocate_nearest(this, colors, reject, nrej); - FREEA(reject); - FREEA(want); + SDL_stack_free(reject); + SDL_stack_free(want); } return nrej == 0; } diff -r c687f06c7473 -r 604d73db6802 src/video/x11/SDL_x11wm.c --- a/src/video/x11/SDL_x11wm.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/x11/SDL_x11wm.c Tue Feb 07 09:29:18 2006 +0000 @@ -20,12 +20,12 @@ slouken@libsdl.org */ -#include -#include #include #include #include "SDL_version.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_timer.h" #include "SDL_video.h" diff -r c687f06c7473 -r 604d73db6802 src/video/x11/SDL_x11yuv.c --- a/src/video/x11/SDL_x11yuv.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/x11/SDL_x11yuv.c Tue Feb 07 09:29:18 2006 +0000 @@ -24,8 +24,6 @@ #ifdef XFREE86_XV -#include -#include #include #ifndef NO_SHARED_MEMORY #include @@ -34,6 +32,8 @@ #endif #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_x11yuv_c.h" diff -r c687f06c7473 -r 604d73db6802 src/video/xbios/SDL_xbios.c --- a/src/video/xbios/SDL_xbios.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/xbios/SDL_xbios.c Tue Feb 07 09:29:18 2006 +0000 @@ -26,9 +26,6 @@ * Patrice Mandin */ -#include -#include -#include #include #include @@ -38,6 +35,8 @@ #include #include "SDL.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_mouse.h" diff -r c687f06c7473 -r 604d73db6802 src/video/xbios/SDL_xbios_centscreen.c --- a/src/video/xbios/SDL_xbios_centscreen.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/xbios/SDL_xbios_centscreen.c Tue Feb 07 09:29:18 2006 +0000 @@ -26,11 +26,10 @@ Patrice Mandin */ -#include -#include - #include +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_xbios.h" #include "SDL_xbios_centscreen.h" diff -r c687f06c7473 -r 604d73db6802 src/video/xbios/SDL_xbios_sb3.c --- a/src/video/xbios/SDL_xbios_sb3.c Tue Feb 07 07:03:29 2006 +0000 +++ b/src/video/xbios/SDL_xbios_sb3.c Tue Feb 07 09:29:18 2006 +0000 @@ -28,8 +28,7 @@ /*--- Includes ---*/ -#include - +#include "SDL_stdlib.h" #include "SDL_xbios.h" #include "SDL_xbios_sb3.h"