comparison src/cdrom/macosx/AudioFileReaderThread.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 71a2648acc75
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
84 //frt->mFileData.push_back (inItem); 84 //frt->mFileData.push_back (inItem);
85 // !!! FIXME: this could be faster with a "tail" member. --ryan. 85 // !!! FIXME: this could be faster with a "tail" member. --ryan.
86 FileData *i = frt->mFileData; 86 FileData *i = frt->mFileData;
87 FileData *prev = NULL; 87 FileData *prev = NULL;
88 88
89 FileData *newfd = (FileData *) malloc(sizeof (FileData)); 89 FileData *newfd = (FileData *) SDL_malloc(sizeof (FileData));
90 newfd->obj = inItem; 90 newfd->obj = inItem;
91 newfd->next = NULL; 91 newfd->next = NULL;
92 92
93 while (i != NULL) { prev = i; i = i->next; } 93 while (i != NULL) { prev = i; i = i->next; }
94 if (prev == NULL) 94 if (prev == NULL)
134 { 134 {
135 if (prev == NULL) 135 if (prev == NULL)
136 frt->mFileData = next; 136 frt->mFileData = next;
137 else 137 else
138 prev->next = next; 138 prev->next = next;
139 free(i); 139 SDL_free(i);
140 } 140 }
141 i = next; 141 i = next;
142 } 142 }
143 143
144 if (--frt->mNumReaders == 0) { 144 if (--frt->mNumReaders == 0) {
277 theItem = NULL; 277 theItem = NULL;
278 if (frt->mFileData != NULL) 278 if (frt->mFileData != NULL)
279 { 279 {
280 FileData *next = frt->mFileData->next; 280 FileData *next = frt->mFileData->next;
281 theItem = frt->mFileData->obj; 281 theItem = frt->mFileData->obj;
282 free(frt->mFileData); 282 SDL_free(frt->mFileData);
283 frt->mFileData = next; 283 frt->mFileData = next;
284 } 284 }
285 285
286 if (bNeedsRelease) frt->mGuard->Unlock(frt->mGuard); 286 if (bNeedsRelease) frt->mGuard->Unlock(frt->mGuard);
287 } 287 }
328 void delete_FileReaderThread(FileReaderThread *frt) 328 void delete_FileReaderThread(FileReaderThread *frt)
329 { 329 {
330 if (frt != NULL) 330 if (frt != NULL)
331 { 331 {
332 delete_SDLOSXCAGuard(frt->mGuard); 332 delete_SDLOSXCAGuard(frt->mGuard);
333 free(frt); 333 SDL_free(frt);
334 } 334 }
335 } 335 }
336 336
337 FileReaderThread *new_FileReaderThread () 337 FileReaderThread *new_FileReaderThread ()
338 { 338 {
339 FileReaderThread *frt = (FileReaderThread *) malloc(sizeof (FileReaderThread)); 339 FileReaderThread *frt = (FileReaderThread *) SDL_malloc(sizeof (FileReaderThread));
340 if (frt == NULL) 340 if (frt == NULL)
341 return NULL; 341 return NULL;
342 memset(frt, '\0', sizeof (*frt)); 342 SDL_memset(frt, '\0', sizeof (*frt));
343 343
344 frt->mGuard = new_SDLOSXCAGuard(); 344 frt->mGuard = new_SDLOSXCAGuard();
345 if (frt->mGuard == NULL) 345 if (frt->mGuard == NULL)
346 { 346 {
347 free(frt); 347 SDL_free(frt);
348 return NULL; 348 return NULL;
349 } 349 }
350 350
351 #define SET_FILEREADERTHREAD_METHOD(m) frt->m = FileReaderThread_##m 351 #define SET_FILEREADERTHREAD_METHOD(m) frt->m = FileReaderThread_##m
352 SET_FILEREADERTHREAD_METHOD(GetGuard); 352 SET_FILEREADERTHREAD_METHOD(GetGuard);
547 if (afm != NULL) { 547 if (afm != NULL) {
548 if (afm->mFileBuffer) { 548 if (afm->mFileBuffer) {
549 free (afm->mFileBuffer); 549 free (afm->mFileBuffer);
550 } 550 }
551 551
552 free(afm); 552 SDL_free(afm);
553 } 553 }
554 } 554 }
555 555
556 556
557 AudioFileManager *new_AudioFileManager(AudioFilePlayer *inParent, 557 AudioFileManager *new_AudioFileManager(AudioFilePlayer *inParent,
566 sReaderThread = new_FileReaderThread(); 566 sReaderThread = new_FileReaderThread();
567 if (sReaderThread == NULL) 567 if (sReaderThread == NULL)
568 return NULL; 568 return NULL;
569 } 569 }
570 570
571 afm = (AudioFileManager *) malloc(sizeof (AudioFileManager)); 571 afm = (AudioFileManager *) SDL_malloc(sizeof (AudioFileManager));
572 if (afm == NULL) 572 if (afm == NULL)
573 return NULL; 573 return NULL;
574 memset(afm, '\0', sizeof (*afm)); 574 SDL_memset(afm, '\0', sizeof (*afm));
575 575
576 #define SET_AUDIOFILEMANAGER_METHOD(m) afm->m = AudioFileManager_##m 576 #define SET_AUDIOFILEMANAGER_METHOD(m) afm->m = AudioFileManager_##m
577 SET_AUDIOFILEMANAGER_METHOD(Disconnect); 577 SET_AUDIOFILEMANAGER_METHOD(Disconnect);
578 SET_AUDIOFILEMANAGER_METHOD(DoConnect); 578 SET_AUDIOFILEMANAGER_METHOD(DoConnect);
579 SET_AUDIOFILEMANAGER_METHOD(Read); 579 SET_AUDIOFILEMANAGER_METHOD(Read);