diff decoders/voc.c @ 468:cd46c97e58bc

Fixed broken VOC decoder...would always dereference NULL during VOC_open().
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 25 Oct 2003 12:38:57 +0000
parents daeb71a3f1ed
children c66080364dff 3f03af31e246
line wrap: on
line diff
--- a/decoders/voc.c	Wed Oct 15 02:22:17 2003 +0000
+++ b/decoders/voc.c	Sat Oct 25 12:38:57 2003 +0000
@@ -185,11 +185,10 @@
 
 
 /* Read next block header, save info, leave position at start of data */
-static int voc_get_block(Sound_Sample *sample)
+static int voc_get_block(Sound_Sample *sample, vs_t *v)
 {
     Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
     SDL_RWops *src = internal->rw;
-    vs_t *v = (vs_t *) internal->decoder_private;
     Uint8 bits24[3];
     Uint8 uc, block;
     Uint32 sblen;
@@ -384,7 +383,7 @@
 
     if (v->rest == 0)
     {
-        if (!voc_get_block(sample))
+        if (!voc_get_block(sample, v))
             return 0;
     } /* if */
 
@@ -457,7 +456,7 @@
 
     v->start_pos = SDL_RWtell(internal->rw);
     v->rate = -1;
-    if (!voc_get_block(sample))
+    if (!voc_get_block(sample, v))
     {
         free(v);
         return(0);
@@ -502,7 +501,7 @@
             break;
         } /* if */
 
-        if (!voc_get_block(sample))
+        if (!voc_get_block(sample, v))
         {
             sample->flags |= (v->error) ? 
                                  SOUND_SAMPLEFLAG_ERROR :
@@ -551,7 +550,7 @@
     while (offset > 0)
     {
         Uint32 rc = voc_read_waveform(sample, 0, offset);
-        if ( (rc == 0) || (!voc_get_block(sample)) )
+        if ( (rc == 0) || (!voc_get_block(sample, v)) )
         {
             SDL_RWseek(internal->rw, origpos, SEEK_SET);
             v->rest = origrest;