src/io/source_wavread.c: fix bytes_read for JUNK headers
authorPaul Brossier <piem@piem.org>
Wed, 21 Sep 2016 13:23:22 +0000 (15:23 +0200)
committerPaul Brossier <piem@piem.org>
Wed, 21 Sep 2016 13:23:22 +0000 (15:23 +0200)
src/io/source_wavread.c

index 9e00259..f63447c 100644 (file)
@@ -135,9 +135,9 @@ aubio_source_wavread_t * new_aubio_source_wavread(const char_t * path, uint_t sa
       goto beach;
     }
     bytes_read += bytes_junk;
-    bytes_expected += bytes_junk;
+    bytes_expected += bytes_junk + 4;
     // now really read the fmt chunk
-    fread(buf, 1, 4, s->fid);
+    bytes_read += fread(buf, 1, 4, s->fid);
     buf[4] = '\0';
   }