src/audio/SDL_wave.c
changeset 1336 3692456e7b0f
parent 1330 450721ad5436
child 1338 604d73db6802
     1.1 --- a/src/audio/SDL_wave.c	Mon Feb 06 17:28:04 2006 +0000
     1.2 +++ b/src/audio/SDL_wave.c	Tue Feb 07 06:59:48 2006 +0000
     1.3 @@ -135,7 +135,7 @@
     1.4  	*audio_len = (encoded_len/MS_ADPCM_state.wavefmt.blockalign) * 
     1.5  				MS_ADPCM_state.wSamplesPerBlock*
     1.6  				MS_ADPCM_state.wavefmt.channels*sizeof(Sint16);
     1.7 -	*audio_buf = (Uint8 *)malloc(*audio_len);
     1.8 +	*audio_buf = (Uint8 *)SDL_malloc(*audio_len);
     1.9  	if ( *audio_buf == NULL ) {
    1.10  		SDL_Error(SDL_ENOMEM);
    1.11  		return(-1);
    1.12 @@ -214,7 +214,7 @@
    1.13  		}
    1.14  		encoded_len -= MS_ADPCM_state.wavefmt.blockalign;
    1.15  	}
    1.16 -	free(freeable);
    1.17 +	SDL_free(freeable);
    1.18  	return(0);
    1.19  }
    1.20  
    1.21 @@ -352,7 +352,7 @@
    1.22  	*audio_len = (encoded_len/IMA_ADPCM_state.wavefmt.blockalign) * 
    1.23  				IMA_ADPCM_state.wSamplesPerBlock*
    1.24  				IMA_ADPCM_state.wavefmt.channels*sizeof(Sint16);
    1.25 -	*audio_buf = (Uint8 *)malloc(*audio_len);
    1.26 +	*audio_buf = (Uint8 *)SDL_malloc(*audio_len);
    1.27  	if ( *audio_buf == NULL ) {
    1.28  		SDL_Error(SDL_ENOMEM);
    1.29  		return(-1);
    1.30 @@ -394,7 +394,7 @@
    1.31  		}
    1.32  		encoded_len -= IMA_ADPCM_state.wavefmt.blockalign;
    1.33  	}
    1.34 -	free(freeable);
    1.35 +	SDL_free(freeable);
    1.36  	return(0);
    1.37  }
    1.38  
    1.39 @@ -444,7 +444,7 @@
    1.40  	chunk.data = NULL;
    1.41  	do {
    1.42  		if ( chunk.data != NULL ) {
    1.43 -			free(chunk.data);
    1.44 +			SDL_free(chunk.data);
    1.45  		}
    1.46  		lenread = ReadChunk(src, &chunk);
    1.47  		if ( lenread < 0 ) {
    1.48 @@ -489,7 +489,7 @@
    1.49  			was_error = 1;
    1.50  			goto done;
    1.51  	}
    1.52 -	memset(spec, 0, (sizeof *spec));
    1.53 +	SDL_memset(spec, 0, (sizeof *spec));
    1.54  	spec->freq = SDL_SwapLE32(format->frequency);
    1.55  	switch (SDL_SwapLE16(format->bitspersample)) {
    1.56  		case 4:
    1.57 @@ -521,7 +521,7 @@
    1.58  	*audio_buf = NULL;
    1.59  	do {
    1.60  		if ( *audio_buf != NULL ) {
    1.61 -			free(*audio_buf);
    1.62 +			SDL_free(*audio_buf);
    1.63  		}
    1.64  		lenread = ReadChunk(src, &chunk);
    1.65  		if ( lenread < 0 ) {
    1.66 @@ -553,7 +553,7 @@
    1.67  
    1.68  done:
    1.69  	if ( format != NULL ) {
    1.70 -		free(format);
    1.71 +		SDL_free(format);
    1.72  	}
    1.73  	if ( freesrc && src ) {
    1.74  		SDL_RWclose(src);
    1.75 @@ -574,7 +574,7 @@
    1.76  void SDL_FreeWAV(Uint8 *audio_buf)
    1.77  {
    1.78  	if ( audio_buf != NULL ) {
    1.79 -		free(audio_buf);
    1.80 +		SDL_free(audio_buf);
    1.81  	}
    1.82  }
    1.83  
    1.84 @@ -582,14 +582,14 @@
    1.85  {
    1.86  	chunk->magic	= SDL_ReadLE32(src);
    1.87  	chunk->length	= SDL_ReadLE32(src);
    1.88 -	chunk->data = (Uint8 *)malloc(chunk->length);
    1.89 +	chunk->data = (Uint8 *)SDL_malloc(chunk->length);
    1.90  	if ( chunk->data == NULL ) {
    1.91  		SDL_Error(SDL_ENOMEM);
    1.92  		return(-1);
    1.93  	}
    1.94  	if ( SDL_RWread(src, chunk->data, chunk->length, 1) != 1 ) {
    1.95  		SDL_Error(SDL_EFREAD);
    1.96 -		free(chunk->data);
    1.97 +		SDL_free(chunk->data);
    1.98  		return(-1);
    1.99  	}
   1.100  	return(chunk->length);