# HG changeset patch # User Ryan C. Gordon # Date 1002406197 0 # Node ID fd942c1433f8d5001f947992b1e3552f9cc396f7 # Parent 9778eba2281369449bd788a4d3ca3466155998f3 Fixed for win32 compile. diff -r 9778eba22813 -r fd942c1433f8 SDL_sound.c --- a/SDL_sound.c Fri Oct 05 14:04:53 2001 +0000 +++ b/SDL_sound.c Sat Oct 06 22:09:57 2001 +0000 @@ -128,6 +128,8 @@ #if (defined SOUND_SUPPORTS_MIDI) { 0, &__Sound_DecoderFunctions_MIDI }, #endif + + { 0, NULL } }; @@ -163,10 +165,10 @@ SDL_Init(SDL_INIT_AUDIO); available_decoders = (const Sound_DecoderInfo **) - malloc((total + 1) * sizeof (Sound_DecoderInfo *)); + malloc((total) * sizeof (Sound_DecoderInfo *)); BAIL_IF_MACRO(available_decoders == NULL, ERR_OUT_OF_MEMORY, 0); - for (i = 0; i < total; i++) + for (i = 0; decoders[i].funcs != NULL; i++) { decoders[i].available = decoders[i].funcs->init(); if (decoders[i].available) @@ -185,7 +187,6 @@ int Sound_Quit(void) { - size_t total = sizeof (decoders) / sizeof (decoders[0]); size_t i; BAIL_IF_MACRO(!initialized, ERR_NOT_INITIALIZED, 0); @@ -193,7 +194,7 @@ while (((volatile Sound_Sample *) samplesList) != NULL) Sound_FreeSample(samplesList); - for (i = 0; i < total; i++) + for (i = 0; decoders[i].funcs != NULL; i++) { if (decoders[i].available) { @@ -443,7 +444,6 @@ Sound_Sample *Sound_NewSample(SDL_RWops *rw, const char *ext, Sound_AudioInfo *desired, Uint32 bSize) { - size_t total = sizeof (decoders) / sizeof (decoders[0]); size_t i; Sound_Sample *retval; @@ -457,7 +457,7 @@ if (ext != NULL) { - for (i = 0; i < total; i++) + for (i = 0; decoders[i].funcs != NULL; i++) { if (decoders[i].available) { @@ -472,7 +472,7 @@ } /* if */ /* no direct extension match? Try everything we've got... */ - for (i = 0; i < total; i++) + for (i = 0; decoders[i].funcs != NULL; i++) { if (decoders[i].available) {