# HG changeset patch # User Ryan C. Gordon # Date 1006187842 0 # Node ID b6d6f994e970acbb4d7a98e6ef25311a84474a8f # Parent 3ccce5bb41c0a0b7dff0d9fbd0625ffdb1e33c16 Moved MIDI decoder to end of array. Fixed Sound_SetError() so that it works after the first call. Now makes sure there's really sound data to convert between formats before attempting to do so. diff -r 3ccce5bb41c0 -r b6d6f994e970 SDL_sound.c --- a/SDL_sound.c Mon Nov 19 16:35:12 2001 +0000 +++ b/SDL_sound.c Mon Nov 19 16:37:22 2001 +0000 @@ -129,14 +129,14 @@ { 0, &__Sound_DecoderFunctions_SHN }, #endif +#if (defined SOUND_SUPPORTS_FLAC) + { 0, &__Sound_DecoderFunctions_FLAC }, +#endif + #if (defined SOUND_SUPPORTS_MIDI) { 0, &__Sound_DecoderFunctions_MIDI }, #endif -#if (defined SOUND_SUPPORTS_FLAC) - { 0, &__Sound_DecoderFunctions_FLAC }, -#endif - { 0, NULL } }; @@ -244,11 +244,8 @@ */ void Sound_SetError(const char *err) { - if (err != NULL) - { - SNDDBG(("Sound_SetError(\"%s\");\n", err)); - SDL_SetError(err); - } /* if */ + SNDDBG(("Sound_SetError(\"%s\");\n", err)); + SDL_SetError(err); } /* Sound_SetError */ @@ -620,7 +617,7 @@ sample->flags &= !SOUND_SAMPLEFLAG_EAGAIN; retval = internal->funcs->read(sample); - if (internal->sdlcvt.needed) + if (retval > 0 && internal->sdlcvt.needed) { internal->sdlcvt.len = retval; Sound_ConvertAudio(&internal->sdlcvt);