Mercurial > SDL_sound_CoreAudio
comparison SDL_sound.c @ 387:fb519e6028e3
Changed all the Sound_SetError() calls to __Sound_SetError (or BAIL*_MACRO)
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Fri, 05 Jul 2002 23:11:51 +0000 |
parents | ce998ee6194f |
children | 9d0b5ec9cc26 |
comparison
equal
deleted
inserted
replaced
386:8c8ecd1008c9 | 387:fb519e6028e3 |
---|---|
356 ErrMsg *err; | 356 ErrMsg *err; |
357 | 357 |
358 if (str == NULL) | 358 if (str == NULL) |
359 return; | 359 return; |
360 | 360 |
361 SNDDBG(("Sound_SetError(\"%s\");%s\n", str, | 361 SNDDBG(("__Sound_SetError(\"%s\");%s\n", str, |
362 (initialized) ? "" : " [NOT INITIALIZED!]")); | 362 (initialized) ? "" : " [NOT INITIALIZED!]")); |
363 | 363 |
364 if (!initialized) | 364 if (!initialized) |
365 return; | 365 return; |
366 | 366 |
442 { | 442 { |
443 Sound_Sample *retval = malloc(sizeof (Sound_Sample)); | 443 Sound_Sample *retval = malloc(sizeof (Sound_Sample)); |
444 Sound_SampleInternal *internal = malloc(sizeof (Sound_SampleInternal)); | 444 Sound_SampleInternal *internal = malloc(sizeof (Sound_SampleInternal)); |
445 if ((retval == NULL) || (internal == NULL)) | 445 if ((retval == NULL) || (internal == NULL)) |
446 { | 446 { |
447 Sound_SetError(ERR_OUT_OF_MEMORY); | 447 __Sound_SetError(ERR_OUT_OF_MEMORY); |
448 if (retval) | 448 if (retval) |
449 free(retval); | 449 free(retval); |
450 if (internal) | 450 if (internal) |
451 free(internal); | 451 free(internal); |
452 | 452 |
458 | 458 |
459 assert(bufferSize > 0); | 459 assert(bufferSize > 0); |
460 retval->buffer = malloc(bufferSize); /* pure ugly. */ | 460 retval->buffer = malloc(bufferSize); /* pure ugly. */ |
461 if (!retval->buffer) | 461 if (!retval->buffer) |
462 { | 462 { |
463 Sound_SetError(ERR_OUT_OF_MEMORY); | 463 __Sound_SetError(ERR_OUT_OF_MEMORY); |
464 free(internal); | 464 free(internal); |
465 free(retval); | 465 free(retval); |
466 return(NULL); | 466 return(NULL); |
467 } /* if */ | 467 } /* if */ |
468 memset(retval->buffer, '\0', bufferSize); | 468 memset(retval->buffer, '\0', bufferSize); |
547 desired.format, | 547 desired.format, |
548 desired.channels, | 548 desired.channels, |
549 desired.rate, | 549 desired.rate, |
550 sample->buffer_size) == -1) | 550 sample->buffer_size) == -1) |
551 { | 551 { |
552 Sound_SetError(SDL_GetError()); | 552 __Sound_SetError(SDL_GetError()); |
553 funcs->close(sample); | 553 funcs->close(sample); |
554 SDL_RWseek(internal->rw, pos, SEEK_SET); /* set for next try... */ | 554 SDL_RWseek(internal->rw, pos, SEEK_SET); /* set for next try... */ |
555 return(0); | 555 return(0); |
556 } /* if */ | 556 } /* if */ |
557 | 557 |
666 free(retval->opaque); | 666 free(retval->opaque); |
667 if (retval->buffer != NULL) | 667 if (retval->buffer != NULL) |
668 free(retval->buffer); | 668 free(retval->buffer); |
669 free(retval); | 669 free(retval); |
670 SDL_RWclose(rw); | 670 SDL_RWclose(rw); |
671 Sound_SetError(ERR_UNSUPPORTED_FORMAT); | 671 __Sound_SetError(ERR_UNSUPPORTED_FORMAT); |
672 return(NULL); | 672 return(NULL); |
673 } /* Sound_NewSample */ | 673 } /* Sound_NewSample */ |
674 | 674 |
675 | 675 |
676 Sound_Sample *Sound_NewSampleFromFile(const char *filename, | 676 Sound_Sample *Sound_NewSampleFromFile(const char *filename, |
698 { | 698 { |
699 Sound_SampleInternal *internal; | 699 Sound_SampleInternal *internal; |
700 | 700 |
701 if (!initialized) | 701 if (!initialized) |
702 { | 702 { |
703 Sound_SetError(ERR_NOT_INITIALIZED); | 703 __Sound_SetError(ERR_NOT_INITIALIZED); |
704 return; | 704 return; |
705 } /* if */ | 705 } /* if */ |
706 | 706 |
707 if (sample == NULL) | 707 if (sample == NULL) |
708 { | 708 { |
709 Sound_SetError(ERR_INVALID_ARGUMENT); | 709 __Sound_SetError(ERR_INVALID_ARGUMENT); |
710 return; | 710 return; |
711 } /* if */ | 711 } /* if */ |
712 | 712 |
713 internal = (Sound_SampleInternal *) sample->opaque; | 713 internal = (Sound_SampleInternal *) sample->opaque; |
714 | 714 |
825 Uint32 br = Sound_Decode(sample); | 825 Uint32 br = Sound_Decode(sample); |
826 void *ptr = realloc(buf, newBufSize + br); | 826 void *ptr = realloc(buf, newBufSize + br); |
827 if (ptr == NULL) | 827 if (ptr == NULL) |
828 { | 828 { |
829 sample->flags |= SOUND_SAMPLEFLAG_ERROR; | 829 sample->flags |= SOUND_SAMPLEFLAG_ERROR; |
830 Sound_SetError(ERR_OUT_OF_MEMORY); | 830 __Sound_SetError(ERR_OUT_OF_MEMORY); |
831 } /* if */ | 831 } /* if */ |
832 else | 832 else |
833 { | 833 { |
834 buf = ptr; | 834 buf = ptr; |
835 memcpy( ((char *) buf) + newBufSize, sample->buffer, br ); | 835 memcpy( ((char *) buf) + newBufSize, sample->buffer, br ); |