diff src/SDL_error.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents 450721ad5436
children 604d73db6802
line wrap: on
line diff
--- a/src/SDL_error.c	Mon Feb 06 17:28:04 2006 +0000
+++ b/src/SDL_error.c	Tue Feb 07 06:59:48 2006 +0000
@@ -63,7 +63,7 @@
 	/* Copy in the key, mark error as valid */
 	error = SDL_GetErrBuf();
 	error->error = 1;
-	strncpy((char *)error->key, fmt, sizeof(error->key));
+	SDL_strncpy((char *)error->key, fmt, sizeof(error->key));
 	error->key[sizeof(error->key)-1] = '\0';
 
 	va_start(ap, fmt);
@@ -98,7 +98,7 @@
 				  char *str = va_arg(ap, char *);
 				  if (str == NULL)
 				      str = "(null)";
-				  strncpy((char *)error->args[index].buf, str, ERR_MAX_STRLEN);
+				  SDL_strncpy((char *)error->args[index].buf, str, ERR_MAX_STRLEN);
 				  error->args[index].buf[ERR_MAX_STRLEN-1] = 0;
 				  error->argc++;
 				}
@@ -125,9 +125,9 @@
 	char tmp[128];
 	int len, i;
 
-	snprintf(tmp, SDL_arraysize(tmp), "%d", value);
+	SDL_snprintf(tmp, SDL_arraysize(tmp), "%d", value);
 	len = 0;
-	if ( strlen(tmp) < maxlen ) {
+	if ( SDL_strlen(tmp) < maxlen ) {
 		for ( i=0; tmp[i]; ++i ) {
 			*str++ = tmp[i];
 			++len;
@@ -141,9 +141,9 @@
 	char tmp[128];
 	int len, i;
 
-	snprintf(tmp, SDL_arraysize(tmp), "%f", value);
+	SDL_snprintf(tmp, SDL_arraysize(tmp), "%f", value);
 	len = 0;
-	if ( strlen(tmp) < maxlen ) {
+	if ( SDL_strlen(tmp) < maxlen ) {
 		for ( i=0; tmp[i]; ++i ) {
 			*str++ = tmp[i];
 			++len;
@@ -157,9 +157,9 @@
 	char tmp[128];
 	int len, i;
 
-	snprintf(tmp, SDL_arraysize(tmp), "%p", value);
+	SDL_snprintf(tmp, SDL_arraysize(tmp), "%p", value);
 	len = 0;
-	if ( strlen(tmp) < maxlen ) {
+	if ( SDL_strlen(tmp) < maxlen ) {
 		for ( i=0; tmp[i]; ++i ) {
 			*str++ = tmp[i];
 			++len;
@@ -253,9 +253,9 @@
 	unsigned int i;
 
 	/* Allocate the UNICODE buffer */
-	errstr16 = (Uint16 *)malloc(maxlen * (sizeof *errstr16));
+	errstr16 = (Uint16 *)SDL_malloc(maxlen * (sizeof *errstr16));
 	if ( ! errstr16 ) {
-		strncpy((char *)errstr, "Out of memory", maxlen);
+		SDL_strncpy((char *)errstr, "Out of memory", maxlen);
 		errstr[maxlen-1] = '\0';
 		return(errstr);
 	}
@@ -269,7 +269,7 @@
 	}
 
 	/* Free UNICODE buffer (if necessary) */
-	free(errstr16);
+	SDL_free(errstr16);
 
 	return(errstr);
 }
@@ -320,7 +320,7 @@
 	SDL_SetError("Hi there!");
 	printf("Error 1: %s\n", SDL_GetError());
 	SDL_ClearError();
-	memset(buffer, '1', BUFSIZ);
+	SDL_memset(buffer, '1', BUFSIZ);
 	buffer[BUFSIZ] = 0;
 	SDL_SetError("This is the error: %s (%f)", buffer, 1.0);
 	printf("Error 2: %s\n", SDL_GetError());