Fixed the selftest to catch up with minor API change earlier this
authorMonty <xiphmont@xiph.org>
Thu, 6 Apr 2000 15:39:43 +0000 (15:39 +0000)
committerMonty <xiphmont@xiph.org>
Thu, 6 Apr 2000 15:39:43 +0000 (15:39 +0000)
week... and then the selftest caught a bug introduced in said change
:-)

Monty

svn path=/trunk/vorbis/; revision=305

lib/framing.c

index f79c63f..b0de497 100644 (file)
@@ -13,7 +13,7 @@
 
  function: code raw [Vorbis] packets into framed OggSquish stream and
            decode Ogg streams back into raw packets
- last mod: $Id: framing.c,v 1.16 2000/04/03 09:45:55 xiphmont Exp $
+ last mod: $Id: framing.c,v 1.17 2000/04/06 15:39:43 xiphmont Exp $
 
  note: The CRC code is directly derived from public domain code by
  Ross Williams (ross@guest.adelaide.edu.au).  See docs/framing.html
@@ -303,6 +303,11 @@ int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og){
 
     /* 32 bits of page counter (we have both counter and page header
        because this val can roll over) */
+    if(os->pageno==-1)os->pageno=0; /* because someone called
+                                       stream_reset; this would be a
+                                       strange thing to do in an
+                                       encode stream, but it has
+                                       plausible uses */
     {
       long pageno=os->pageno++;
       for(i=18;i<22;i++){
@@ -875,8 +880,8 @@ void test_pack(int *pl, int **headers){
   int eosflag=0;
   int bosflag=0;
 
-  ogg_stream_reset(&os_en,0);
-  ogg_stream_reset(&os_de,0);
+  ogg_stream_reset(&os_en);
+  ogg_stream_reset(&os_de);
   ogg_sync_reset(&oy);
 
   for(packets=0;;packets++)if(pl[packets]==-1)break;
@@ -1303,7 +1308,7 @@ int main(void){
     int inptr=0,i,j;
     ogg_page og[5];
     
-    ogg_stream_reset(&os_en,0);
+    ogg_stream_reset(&os_en);
 
     for(i=0;pl[i]!=-1;i++){
       ogg_packet op;
@@ -1337,7 +1342,7 @@ int main(void){
       fprintf(stderr,"Testing loss of pages... ");
 
       ogg_sync_reset(&oy);
-      ogg_stream_reset(&os_de,0);
+      ogg_stream_reset(&os_de);
       for(i=0;i<5;i++){
        memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header,
               og[i].header_len);
@@ -1382,7 +1387,7 @@ int main(void){
       fprintf(stderr,"Testing loss of pages (rollback required)... ");
 
       ogg_sync_reset(&oy);
-      ogg_stream_reset(&os_de,0);
+      ogg_stream_reset(&os_de);
       for(i=0;i<5;i++){
        memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header,
               og[i].header_len);