comparison src/audio/esd/SDL_esdaudio.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 c9b51268668f
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
140 return(available); 140 return(available);
141 } 141 }
142 142
143 static void Audio_DeleteDevice(SDL_AudioDevice *device) 143 static void Audio_DeleteDevice(SDL_AudioDevice *device)
144 { 144 {
145 free(device->hidden); 145 SDL_free(device->hidden);
146 free(device); 146 SDL_free(device);
147 UnloadESDLibrary(); 147 UnloadESDLibrary();
148 } 148 }
149 149
150 static SDL_AudioDevice *Audio_CreateDevice(int devindex) 150 static SDL_AudioDevice *Audio_CreateDevice(int devindex)
151 { 151 {
152 SDL_AudioDevice *this; 152 SDL_AudioDevice *this;
153 153
154 /* Initialize all variables that we clean on shutdown */ 154 /* Initialize all variables that we clean on shutdown */
155 LoadESDLibrary(); 155 LoadESDLibrary();
156 this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); 156 this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
157 if ( this ) { 157 if ( this ) {
158 memset(this, 0, (sizeof *this)); 158 SDL_memset(this, 0, (sizeof *this));
159 this->hidden = (struct SDL_PrivateAudioData *) 159 this->hidden = (struct SDL_PrivateAudioData *)
160 malloc((sizeof *this->hidden)); 160 SDL_malloc((sizeof *this->hidden));
161 } 161 }
162 if ( (this == NULL) || (this->hidden == NULL) ) { 162 if ( (this == NULL) || (this->hidden == NULL) ) {
163 SDL_OutOfMemory(); 163 SDL_OutOfMemory();
164 if ( this ) { 164 if ( this ) {
165 free(this); 165 SDL_free(this);
166 } 166 }
167 return(0); 167 return(0);
168 } 168 }
169 memset(this->hidden, 0, (sizeof *this->hidden)); 169 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
170 audio_fd = -1; 170 audio_fd = -1;
171 171
172 /* Set the function pointers */ 172 /* Set the function pointers */
173 this->OpenAudio = ESD_OpenAudio; 173 this->OpenAudio = ESD_OpenAudio;
174 this->WaitAudio = ESD_WaitAudio; 174 this->WaitAudio = ESD_WaitAudio;
259 259
260 sprintf(temp, "/proc/%d/cmdline", getpid()); 260 sprintf(temp, "/proc/%d/cmdline", getpid());
261 fp = fopen(temp, "r"); 261 fp = fopen(temp, "r");
262 if ( fp != NULL ) { 262 if ( fp != NULL ) {
263 if ( fgets(temp, sizeof(temp)-1, fp) ) { 263 if ( fgets(temp, sizeof(temp)-1, fp) ) {
264 progname = strrchr(temp, '/'); 264 progname = SDL_strrchr(temp, '/');
265 if ( progname == NULL ) { 265 if ( progname == NULL ) {
266 progname = temp; 266 progname = temp;
267 } else { 267 } else {
268 progname = progname+1; 268 progname = progname+1;
269 } 269 }
316 mixlen = spec->size; 316 mixlen = spec->size;
317 mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen); 317 mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen);
318 if ( mixbuf == NULL ) { 318 if ( mixbuf == NULL ) {
319 return(-1); 319 return(-1);
320 } 320 }
321 memset(mixbuf, spec->silence, spec->size); 321 SDL_memset(mixbuf, spec->silence, spec->size);
322 322
323 /* Get the parent process id (we're the parent of the audio thread) */ 323 /* Get the parent process id (we're the parent of the audio thread) */
324 parent = getpid(); 324 parent = getpid();
325 325
326 /* We're ready to rock and roll. :-) */ 326 /* We're ready to rock and roll. :-) */