diff SDL_sound.c @ 26:ddc3614c9042

Bugfix (thanks Tsuyoshi Iguchi!), and Ogg Vorbis decoder entry.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 19 Sep 2001 14:33:06 +0000
parents d4ac6ce1360e
children f27bcbcaeab1
line wrap: on
line diff
--- a/SDL_sound.c	Wed Sep 19 14:05:36 2001 +0000
+++ b/SDL_sound.c	Wed Sep 19 14:33:06 2001 +0000
@@ -52,6 +52,10 @@
 extern const Sound_DecoderFunctions  __Sound_DecoderFunctions_WAV;
 #endif
 
+#if (defined SOUND_SUPPORTS_OGG)
+extern const Sound_DecoderFunctions  __Sound_DecoderFunctions_OGG;
+#endif
+
 #if (defined SOUND_SUPPORTS_VOC)
 extern const Sound_DecoderFunctions  __Sound_DecoderFunctions_VOC;
 #endif
@@ -70,6 +74,10 @@
     &__Sound_DecoderFunctions_WAV,
 #endif
 
+#if (defined SOUND_SUPPORTS_OGG)
+    &__Sound_DecoderFunctions_OGG,
+#endif
+
 #if (defined SOUND_SUPPORTS_VOC)
     &__Sound_DecoderFunctions_VOC,
 #endif
@@ -114,14 +122,15 @@
     for (i = 0; decoderFuncs[i] != NULL; i++)
         ; /* do nothing. */
 
-    i++;
     available_decoders = (const Sound_DecoderInfo **)
-                            malloc(i * sizeof (Sound_DecoderInfo *));
+                            malloc((i + 1) * sizeof (Sound_DecoderInfo *));
     BAIL_IF_MACRO(available_decoders == NULL, ERR_OUT_OF_MEMORY, 0);
 
     for (i = 0; decoderFuncs[i] != NULL; i++)
         available_decoders[i] = &decoderFuncs[i]->info;
 
+    available_decoders[i] = NULL;
+
     initialized = 1;
     return(1);
 } /* Sound_Init */