comparison src/audio/mme/SDL_mmeaudio.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 b8d311d90021
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
41 41
42 static void Audio_DeleteDevice(SDL_AudioDevice *device) 42 static void Audio_DeleteDevice(SDL_AudioDevice *device)
43 { 43 {
44 if ( device ) { 44 if ( device ) {
45 if ( device->hidden ) { 45 if ( device->hidden ) {
46 free(device->hidden); 46 SDL_free(device->hidden);
47 device->hidden = NULL; 47 device->hidden = NULL;
48 } 48 }
49 free(device); 49 SDL_free(device);
50 device = NULL; 50 device = NULL;
51 } 51 }
52 } 52 }
53 53
54 static SDL_AudioDevice *Audio_CreateDevice(int devindex) 54 static SDL_AudioDevice *Audio_CreateDevice(int devindex)
55 { 55 {
56 SDL_AudioDevice *this; 56 SDL_AudioDevice *this;
57 57
58 /* Initialize all variables that we clean on shutdown */ 58 /* Initialize all variables that we clean on shutdown */
59 this = malloc(sizeof(SDL_AudioDevice)); 59 this = SDL_malloc(sizeof(SDL_AudioDevice));
60 if ( this ) { 60 if ( this ) {
61 memset(this, 0, (sizeof *this)); 61 SDL_memset(this, 0, (sizeof *this));
62 this->hidden = malloc((sizeof *this->hidden)); 62 this->hidden = SDL_malloc((sizeof *this->hidden));
63 } 63 }
64 if ( (this == NULL) || (this->hidden == NULL) ) { 64 if ( (this == NULL) || (this->hidden == NULL) ) {
65 SDL_OutOfMemory(); 65 SDL_OutOfMemory();
66 if ( this ) { 66 if ( this ) {
67 free(this); 67 SDL_free(this);
68 } 68 }
69 return(0); 69 return(0);
70 } 70 }
71 memset(this->hidden, 0, (sizeof *this->hidden)); 71 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
72 /* Set the function pointers */ 72 /* Set the function pointers */
73 this->OpenAudio = MME_OpenAudio; 73 this->OpenAudio = MME_OpenAudio;
74 this->WaitAudio = MME_WaitAudio; 74 this->WaitAudio = MME_WaitAudio;
75 this->PlayAudio = MME_PlayAudio; 75 this->PlayAudio = MME_PlayAudio;
76 this->GetAudioBuf = MME_GetAudioBuf; 76 this->GetAudioBuf = MME_GetAudioBuf;
90 { 90 {
91 int len; 91 int len;
92 char errbuf[MAXERRORLENGTH]; 92 char errbuf[MAXERRORLENGTH];
93 93
94 sprintf(errbuf, "%s: ", function); 94 sprintf(errbuf, "%s: ", function);
95 len = strlen(errbuf); 95 len = SDL_strlen(errbuf);
96 waveOutGetErrorText(code, errbuf+len, MAXERRORLENGTH-len); 96 waveOutGetErrorText(code, errbuf+len, MAXERRORLENGTH-len);
97 SDL_SetError("%s",errbuf); 97 SDL_SetError("%s",errbuf);
98 } 98 }
99 99
100 static void CALLBACK MME_CALLBACK(HWAVEOUT hwo, 100 static void CALLBACK MME_CALLBACK(HWAVEOUT hwo,