diff src/SDL_error.c @ 1330:450721ad5436

It's now possible to build SDL without any C runtime at all on Windows, using Visual C++ 2005
author Sam Lantinga <slouken@libsdl.org>
date Mon, 06 Feb 2006 08:28:51 +0000
parents c9b51268668f
children 3692456e7b0f
line wrap: on
line diff
--- a/src/SDL_error.c	Sat Feb 04 22:01:44 2006 +0000
+++ b/src/SDL_error.c	Mon Feb 06 08:28:51 2006 +0000
@@ -22,13 +22,9 @@
 
 /* Simple error handling in SDL */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-
 #include "SDL_types.h"
-#include "SDL_getenv.h"
+#include "SDL_stdlib.h"
+#include "SDL_string.h"
 #include "SDL_error.h"
 #include "SDL_error_c.h"
 #ifndef DISABLE_THREADS
@@ -42,10 +38,6 @@
 #define SDL_GetErrBuf()	(&SDL_global_error)
 #endif /* DISABLE_THREADS */
 
-#ifdef __CYGWIN__
-#define DISABLE_STDIO
-#endif
-
 #define SDL_ERRBUFIZE	1024
 
 /* Private functions */
@@ -121,16 +113,10 @@
 	}
 	va_end(ap);
 
-#ifndef DISABLE_STDIO
 	/* If we are in debug mode, print out an error message */
 #ifdef DEBUG_ERROR
 	fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError());
-#else
-	if ( getenv("SDL_DEBUG") ) {
-		fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError());
-	}
 #endif
-#endif /* !DISABLE_STDIO */
 }
 
 /* Print out an integer value to a UNICODE buffer */
@@ -139,7 +125,7 @@
 	char tmp[128];
 	int len, i;
 
-	sprintf(tmp, "%d", value);
+	snprintf(tmp, SDL_arraysize(tmp), "%d", value);
 	len = 0;
 	if ( strlen(tmp) < maxlen ) {
 		for ( i=0; tmp[i]; ++i ) {
@@ -155,7 +141,7 @@
 	char tmp[128];
 	int len, i;
 
-	sprintf(tmp, "%f", value);
+	snprintf(tmp, SDL_arraysize(tmp), "%f", value);
 	len = 0;
 	if ( strlen(tmp) < maxlen ) {
 		for ( i=0; tmp[i]; ++i ) {
@@ -171,7 +157,7 @@
 	char tmp[128];
 	int len, i;
 
-	sprintf(tmp, "%p", value);
+	snprintf(tmp, SDL_arraysize(tmp), "%p", value);
 	len = 0;
 	if ( strlen(tmp) < maxlen ) {
 		for ( i=0; tmp[i]; ++i ) {