src/SDL_error.c
changeset 1330 450721ad5436
parent 1312 c9b51268668f
child 1336 3692456e7b0f
     1.1 --- a/src/SDL_error.c	Sat Feb 04 22:01:44 2006 +0000
     1.2 +++ b/src/SDL_error.c	Mon Feb 06 08:28:51 2006 +0000
     1.3 @@ -22,13 +22,9 @@
     1.4  
     1.5  /* Simple error handling in SDL */
     1.6  
     1.7 -#include <stdio.h>
     1.8 -#include <stdlib.h>
     1.9 -#include <stdarg.h>
    1.10 -#include <string.h>
    1.11 -
    1.12  #include "SDL_types.h"
    1.13 -#include "SDL_getenv.h"
    1.14 +#include "SDL_stdlib.h"
    1.15 +#include "SDL_string.h"
    1.16  #include "SDL_error.h"
    1.17  #include "SDL_error_c.h"
    1.18  #ifndef DISABLE_THREADS
    1.19 @@ -42,10 +38,6 @@
    1.20  #define SDL_GetErrBuf()	(&SDL_global_error)
    1.21  #endif /* DISABLE_THREADS */
    1.22  
    1.23 -#ifdef __CYGWIN__
    1.24 -#define DISABLE_STDIO
    1.25 -#endif
    1.26 -
    1.27  #define SDL_ERRBUFIZE	1024
    1.28  
    1.29  /* Private functions */
    1.30 @@ -121,16 +113,10 @@
    1.31  	}
    1.32  	va_end(ap);
    1.33  
    1.34 -#ifndef DISABLE_STDIO
    1.35  	/* If we are in debug mode, print out an error message */
    1.36  #ifdef DEBUG_ERROR
    1.37  	fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError());
    1.38 -#else
    1.39 -	if ( getenv("SDL_DEBUG") ) {
    1.40 -		fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError());
    1.41 -	}
    1.42  #endif
    1.43 -#endif /* !DISABLE_STDIO */
    1.44  }
    1.45  
    1.46  /* Print out an integer value to a UNICODE buffer */
    1.47 @@ -139,7 +125,7 @@
    1.48  	char tmp[128];
    1.49  	int len, i;
    1.50  
    1.51 -	sprintf(tmp, "%d", value);
    1.52 +	snprintf(tmp, SDL_arraysize(tmp), "%d", value);
    1.53  	len = 0;
    1.54  	if ( strlen(tmp) < maxlen ) {
    1.55  		for ( i=0; tmp[i]; ++i ) {
    1.56 @@ -155,7 +141,7 @@
    1.57  	char tmp[128];
    1.58  	int len, i;
    1.59  
    1.60 -	sprintf(tmp, "%f", value);
    1.61 +	snprintf(tmp, SDL_arraysize(tmp), "%f", value);
    1.62  	len = 0;
    1.63  	if ( strlen(tmp) < maxlen ) {
    1.64  		for ( i=0; tmp[i]; ++i ) {
    1.65 @@ -171,7 +157,7 @@
    1.66  	char tmp[128];
    1.67  	int len, i;
    1.68  
    1.69 -	sprintf(tmp, "%p", value);
    1.70 +	snprintf(tmp, SDL_arraysize(tmp), "%p", value);
    1.71  	len = 0;
    1.72  	if ( strlen(tmp) < maxlen ) {
    1.73  		for ( i=0; tmp[i]; ++i ) {