src/SDL_error.c
changeset 1336 3692456e7b0f
parent 1330 450721ad5436
child 1338 604d73db6802
     1.1 --- a/src/SDL_error.c	Mon Feb 06 17:28:04 2006 +0000
     1.2 +++ b/src/SDL_error.c	Tue Feb 07 06:59:48 2006 +0000
     1.3 @@ -63,7 +63,7 @@
     1.4  	/* Copy in the key, mark error as valid */
     1.5  	error = SDL_GetErrBuf();
     1.6  	error->error = 1;
     1.7 -	strncpy((char *)error->key, fmt, sizeof(error->key));
     1.8 +	SDL_strncpy((char *)error->key, fmt, sizeof(error->key));
     1.9  	error->key[sizeof(error->key)-1] = '\0';
    1.10  
    1.11  	va_start(ap, fmt);
    1.12 @@ -98,7 +98,7 @@
    1.13  				  char *str = va_arg(ap, char *);
    1.14  				  if (str == NULL)
    1.15  				      str = "(null)";
    1.16 -				  strncpy((char *)error->args[index].buf, str, ERR_MAX_STRLEN);
    1.17 +				  SDL_strncpy((char *)error->args[index].buf, str, ERR_MAX_STRLEN);
    1.18  				  error->args[index].buf[ERR_MAX_STRLEN-1] = 0;
    1.19  				  error->argc++;
    1.20  				}
    1.21 @@ -125,9 +125,9 @@
    1.22  	char tmp[128];
    1.23  	int len, i;
    1.24  
    1.25 -	snprintf(tmp, SDL_arraysize(tmp), "%d", value);
    1.26 +	SDL_snprintf(tmp, SDL_arraysize(tmp), "%d", value);
    1.27  	len = 0;
    1.28 -	if ( strlen(tmp) < maxlen ) {
    1.29 +	if ( SDL_strlen(tmp) < maxlen ) {
    1.30  		for ( i=0; tmp[i]; ++i ) {
    1.31  			*str++ = tmp[i];
    1.32  			++len;
    1.33 @@ -141,9 +141,9 @@
    1.34  	char tmp[128];
    1.35  	int len, i;
    1.36  
    1.37 -	snprintf(tmp, SDL_arraysize(tmp), "%f", value);
    1.38 +	SDL_snprintf(tmp, SDL_arraysize(tmp), "%f", value);
    1.39  	len = 0;
    1.40 -	if ( strlen(tmp) < maxlen ) {
    1.41 +	if ( SDL_strlen(tmp) < maxlen ) {
    1.42  		for ( i=0; tmp[i]; ++i ) {
    1.43  			*str++ = tmp[i];
    1.44  			++len;
    1.45 @@ -157,9 +157,9 @@
    1.46  	char tmp[128];
    1.47  	int len, i;
    1.48  
    1.49 -	snprintf(tmp, SDL_arraysize(tmp), "%p", value);
    1.50 +	SDL_snprintf(tmp, SDL_arraysize(tmp), "%p", value);
    1.51  	len = 0;
    1.52 -	if ( strlen(tmp) < maxlen ) {
    1.53 +	if ( SDL_strlen(tmp) < maxlen ) {
    1.54  		for ( i=0; tmp[i]; ++i ) {
    1.55  			*str++ = tmp[i];
    1.56  			++len;
    1.57 @@ -253,9 +253,9 @@
    1.58  	unsigned int i;
    1.59  
    1.60  	/* Allocate the UNICODE buffer */
    1.61 -	errstr16 = (Uint16 *)malloc(maxlen * (sizeof *errstr16));
    1.62 +	errstr16 = (Uint16 *)SDL_malloc(maxlen * (sizeof *errstr16));
    1.63  	if ( ! errstr16 ) {
    1.64 -		strncpy((char *)errstr, "Out of memory", maxlen);
    1.65 +		SDL_strncpy((char *)errstr, "Out of memory", maxlen);
    1.66  		errstr[maxlen-1] = '\0';
    1.67  		return(errstr);
    1.68  	}
    1.69 @@ -269,7 +269,7 @@
    1.70  	}
    1.71  
    1.72  	/* Free UNICODE buffer (if necessary) */
    1.73 -	free(errstr16);
    1.74 +	SDL_free(errstr16);
    1.75  
    1.76  	return(errstr);
    1.77  }
    1.78 @@ -320,7 +320,7 @@
    1.79  	SDL_SetError("Hi there!");
    1.80  	printf("Error 1: %s\n", SDL_GetError());
    1.81  	SDL_ClearError();
    1.82 -	memset(buffer, '1', BUFSIZ);
    1.83 +	SDL_memset(buffer, '1', BUFSIZ);
    1.84  	buffer[BUFSIZ] = 0;
    1.85  	SDL_SetError("This is the error: %s (%f)", buffer, 1.0);
    1.86  	printf("Error 2: %s\n", SDL_GetError());