src/audio/windx5/SDL_dx5audio.c
changeset 1336 3692456e7b0f
parent 1330 450721ad5436
child 1338 604d73db6802
     1.1 --- a/src/audio/windx5/SDL_dx5audio.c	Mon Feb 06 17:28:04 2006 +0000
     1.2 +++ b/src/audio/windx5/SDL_dx5audio.c	Tue Feb 07 06:59:48 2006 +0000
     1.3 @@ -133,8 +133,8 @@
     1.4  static void Audio_DeleteDevice(SDL_AudioDevice *device)
     1.5  {
     1.6  	DX5_Unload();
     1.7 -	free(device->hidden);
     1.8 -	free(device);
     1.9 +	SDL_free(device->hidden);
    1.10 +	SDL_free(device);
    1.11  }
    1.12  
    1.13  static SDL_AudioDevice *Audio_CreateDevice(int devindex)
    1.14 @@ -147,20 +147,20 @@
    1.15  	}
    1.16  
    1.17  	/* Initialize all variables that we clean on shutdown */
    1.18 -	this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
    1.19 +	this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
    1.20  	if ( this ) {
    1.21 -		memset(this, 0, (sizeof *this));
    1.22 +		SDL_memset(this, 0, (sizeof *this));
    1.23  		this->hidden = (struct SDL_PrivateAudioData *)
    1.24 -				malloc((sizeof *this->hidden));
    1.25 +				SDL_malloc((sizeof *this->hidden));
    1.26  	}
    1.27  	if ( (this == NULL) || (this->hidden == NULL) ) {
    1.28  		SDL_OutOfMemory();
    1.29  		if ( this ) {
    1.30 -			free(this);
    1.31 +			SDL_free(this);
    1.32  		}
    1.33  		return(0);
    1.34  	}
    1.35 -	memset(this->hidden, 0, (sizeof *this->hidden));
    1.36 +	SDL_memset(this->hidden, 0, (sizeof *this->hidden));
    1.37  
    1.38  	/* Set the function pointers */
    1.39  	this->OpenAudio = DX5_OpenAudio;
    1.40 @@ -223,13 +223,13 @@
    1.41  			error = "Function not supported";
    1.42  			break;
    1.43  		default:
    1.44 -			snprintf(errbuf, SDL_arraysize(errbuf),
    1.45 +			SDL_snprintf(errbuf, SDL_arraysize(errbuf),
    1.46  			         "%s: Unknown DirectSound error: 0x%x",
    1.47  								function, code);
    1.48  			break;
    1.49  	}
    1.50  	if ( ! errbuf[0] ) {
    1.51 -		snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, error);
    1.52 +		SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, error);
    1.53  	}
    1.54  	SDL_SetError("%s", errbuf);
    1.55  	return;
    1.56 @@ -386,7 +386,7 @@
    1.57  	/* Wait for the playing chunk to finish */
    1.58  	stream = this->GetAudioBuf(this);
    1.59  	if ( stream != NULL ) {
    1.60 -		memset(stream, silence, mixlen);
    1.61 +		SDL_memset(stream, silence, mixlen);
    1.62  		this->PlayAudio(this);
    1.63  	}
    1.64  	this->WaitAudio(this);
    1.65 @@ -435,7 +435,7 @@
    1.66  	}
    1.67  
    1.68  	/* Try to create the primary buffer */
    1.69 -	memset(&format, 0, sizeof(format));
    1.70 +	SDL_memset(&format, 0, sizeof(format));
    1.71  	format.dwSize = sizeof(format);
    1.72  	format.dwFlags=(DSBCAPS_PRIMARYBUFFER|DSBCAPS_GETCURRENTPOSITION2);
    1.73  	format.dwFlags |= DSBCAPS_STICKYFOCUS;
    1.74 @@ -451,7 +451,7 @@
    1.75  	}
    1.76  
    1.77  	/* Check the size of the fragment buffer */
    1.78 -	memset(&caps, 0, sizeof(caps));
    1.79 +	SDL_memset(&caps, 0, sizeof(caps));
    1.80  	caps.dwSize = sizeof(caps);
    1.81  	result = IDirectSoundBuffer_GetCaps(*sndbuf, &caps);
    1.82  	if ( result != DS_OK ) {
    1.83 @@ -516,7 +516,7 @@
    1.84  	}
    1.85  
    1.86  	/* Try to create the secondary buffer */
    1.87 -	memset(&format, 0, sizeof(format));
    1.88 +	SDL_memset(&format, 0, sizeof(format));
    1.89  	format.dwSize = sizeof(format);
    1.90  	format.dwFlags = DSBCAPS_GETCURRENTPOSITION2;
    1.91  #ifdef USE_POSITION_NOTIFY
    1.92 @@ -550,9 +550,9 @@
    1.93  	                                 DSBLOCK_ENTIREBUFFER);
    1.94  	if ( result == DS_OK ) {
    1.95  		if ( wavefmt->wBitsPerSample == 8 ) {
    1.96 -			memset(pvAudioPtr1, 0x80, dwAudioBytes1);
    1.97 +			SDL_memset(pvAudioPtr1, 0x80, dwAudioBytes1);
    1.98  		} else {
    1.99 -			memset(pvAudioPtr1, 0x00, dwAudioBytes1);
   1.100 +			SDL_memset(pvAudioPtr1, 0x00, dwAudioBytes1);
   1.101  		}
   1.102  		IDirectSoundBuffer_Unlock(*sndbuf,
   1.103  		                          (LPVOID)pvAudioPtr1, dwAudioBytes1,
   1.104 @@ -584,7 +584,7 @@
   1.105  	}
   1.106  
   1.107  	/* Allocate the notify structures */
   1.108 -	notify_positions = (DSBPOSITIONNOTIFY *)malloc(NUM_BUFFERS*
   1.109 +	notify_positions = (DSBPOSITIONNOTIFY *)SDL_malloc(NUM_BUFFERS*
   1.110  					sizeof(*notify_positions));
   1.111  	if ( notify_positions == NULL ) {
   1.112  		goto done;
   1.113 @@ -620,7 +620,7 @@
   1.114  	WAVEFORMATEX waveformat;
   1.115  
   1.116  	/* Set basic WAVE format parameters */
   1.117 -	memset(&waveformat, 0, sizeof(waveformat));
   1.118 +	SDL_memset(&waveformat, 0, sizeof(waveformat));
   1.119  	waveformat.wFormatTag = WAVE_FORMAT_PCM;
   1.120  
   1.121  	/* Determine the audio parameters from the AudioSpec */