diff src/audio/SDL_wave.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/audio/SDL_wave.c	Mon Feb 06 17:28:04 2006 +0000
+++ b/src/audio/SDL_wave.c	Tue Feb 07 06:59:48 2006 +0000
@@ -135,7 +135,7 @@
 	*audio_len = (encoded_len/MS_ADPCM_state.wavefmt.blockalign) * 
 				MS_ADPCM_state.wSamplesPerBlock*
 				MS_ADPCM_state.wavefmt.channels*sizeof(Sint16);
-	*audio_buf = (Uint8 *)malloc(*audio_len);
+	*audio_buf = (Uint8 *)SDL_malloc(*audio_len);
 	if ( *audio_buf == NULL ) {
 		SDL_Error(SDL_ENOMEM);
 		return(-1);
@@ -214,7 +214,7 @@
 		}
 		encoded_len -= MS_ADPCM_state.wavefmt.blockalign;
 	}
-	free(freeable);
+	SDL_free(freeable);
 	return(0);
 }
 
@@ -352,7 +352,7 @@
 	*audio_len = (encoded_len/IMA_ADPCM_state.wavefmt.blockalign) * 
 				IMA_ADPCM_state.wSamplesPerBlock*
 				IMA_ADPCM_state.wavefmt.channels*sizeof(Sint16);
-	*audio_buf = (Uint8 *)malloc(*audio_len);
+	*audio_buf = (Uint8 *)SDL_malloc(*audio_len);
 	if ( *audio_buf == NULL ) {
 		SDL_Error(SDL_ENOMEM);
 		return(-1);
@@ -394,7 +394,7 @@
 		}
 		encoded_len -= IMA_ADPCM_state.wavefmt.blockalign;
 	}
-	free(freeable);
+	SDL_free(freeable);
 	return(0);
 }
 
@@ -444,7 +444,7 @@
 	chunk.data = NULL;
 	do {
 		if ( chunk.data != NULL ) {
-			free(chunk.data);
+			SDL_free(chunk.data);
 		}
 		lenread = ReadChunk(src, &chunk);
 		if ( lenread < 0 ) {
@@ -489,7 +489,7 @@
 			was_error = 1;
 			goto done;
 	}
-	memset(spec, 0, (sizeof *spec));
+	SDL_memset(spec, 0, (sizeof *spec));
 	spec->freq = SDL_SwapLE32(format->frequency);
 	switch (SDL_SwapLE16(format->bitspersample)) {
 		case 4:
@@ -521,7 +521,7 @@
 	*audio_buf = NULL;
 	do {
 		if ( *audio_buf != NULL ) {
-			free(*audio_buf);
+			SDL_free(*audio_buf);
 		}
 		lenread = ReadChunk(src, &chunk);
 		if ( lenread < 0 ) {
@@ -553,7 +553,7 @@
 
 done:
 	if ( format != NULL ) {
-		free(format);
+		SDL_free(format);
 	}
 	if ( freesrc && src ) {
 		SDL_RWclose(src);
@@ -574,7 +574,7 @@
 void SDL_FreeWAV(Uint8 *audio_buf)
 {
 	if ( audio_buf != NULL ) {
-		free(audio_buf);
+		SDL_free(audio_buf);
 	}
 }
 
@@ -582,14 +582,14 @@
 {
 	chunk->magic	= SDL_ReadLE32(src);
 	chunk->length	= SDL_ReadLE32(src);
-	chunk->data = (Uint8 *)malloc(chunk->length);
+	chunk->data = (Uint8 *)SDL_malloc(chunk->length);
 	if ( chunk->data == NULL ) {
 		SDL_Error(SDL_ENOMEM);
 		return(-1);
 	}
 	if ( SDL_RWread(src, chunk->data, chunk->length, 1) != 1 ) {
 		SDL_Error(SDL_EFREAD);
-		free(chunk->data);
+		SDL_free(chunk->data);
 		return(-1);
 	}
 	return(chunk->length);