changeset 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 4acb5260d684
children ba49bdd9ea33
files SDL_sound.c
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
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 */