diff src/file/SDL_rwops.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/file/SDL_rwops.c	Mon Feb 06 17:28:04 2006 +0000
+++ b/src/file/SDL_rwops.c	Tue Feb 07 06:59:48 2006 +0000
@@ -120,7 +120,7 @@
 		total_bytes = mem_available;
 	}
 
-	memcpy(ptr, context->hidden.mem.here, total_bytes);
+	SDL_memcpy(ptr, context->hidden.mem.here, total_bytes);
 	context->hidden.mem.here += total_bytes;
 
 	return (total_bytes / size);
@@ -130,7 +130,7 @@
 	if ( (context->hidden.mem.here + (num*size)) > context->hidden.mem.stop ) {
 		num = (context->hidden.mem.stop-context->hidden.mem.here)/size;
 	}
-	memcpy(context->hidden.mem.here, ptr, num*size);
+	SDL_memcpy(context->hidden.mem.here, ptr, num*size);
 	context->hidden.mem.here += num*size;
 	return(num);
 }
@@ -162,8 +162,8 @@
  */
 static char *unix_to_mac(const char *file)
 {
-	int flen = strlen(file);
-	char *path = malloc(flen + 2);
+	int flen = SDL_strlen(file);
+	char *path = SDL_malloc(flen + 2);
 	const char *src = file;
 	char *dst = path;
 	if(*src == '/') {
@@ -175,7 +175,7 @@
 			*dst++ = ':';   /* relative paths begin with ':' */
 	}
 	while(src < file + flen) {
-		const char *end = strchr(src, '/');
+		const char *end = SDL_strchr(src, '/');
 		int len;
 		if(!end)
 			end = file + flen; /* last component */
@@ -186,7 +186,7 @@
 			if(len == 2 && src[0] == '.' && src[1] == '.') {
 				/* replace .. with the empty string */
 			} else {
-				memcpy(dst, src, len);
+				SDL_memcpy(dst, src, len);
 				dst += len;
 			}
 			if(end < file + flen)
@@ -209,7 +209,7 @@
 	{
 		char *mpath = unix_to_mac(file);
 		fp = fopen(mpath, mode);
-		free(mpath);
+		SDL_free(mpath);
 	}
 #else
 	fp = fopen(file, mode);
@@ -292,7 +292,7 @@
 {
 	SDL_RWops *area;
 
-	area = (SDL_RWops *)malloc(sizeof *area);
+	area = (SDL_RWops *)SDL_malloc(sizeof *area);
 	if ( area == NULL ) {
 		SDL_OutOfMemory();
 	}
@@ -301,5 +301,5 @@
 
 void SDL_FreeRW(SDL_RWops *area)
 {
-	free(area);
+	SDL_free(area);
 }