Diff of /src/framing.c [35fdec] .. [f0dc56]  Maximize  Restore

Switch to side-by-side view

--- a/src/framing.c
+++ b/src/framing.c
@@ -57,16 +57,16 @@
 
 int ogg_page_serialno(const ogg_page *og){
   return(og->header[14] |
-	 (og->header[15]<<8) |
-	 (og->header[16]<<16) |
-	 (og->header[17]<<24));
+         (og->header[15]<<8) |
+         (og->header[16]<<16) |
+         (og->header[17]<<24));
 }
  
 long ogg_page_pageno(const ogg_page *og){
   return(og->header[18] |
-	 (og->header[19]<<8) |
-	 (og->header[20]<<16) |
-	 (og->header[21]<<24));
+         (og->header[19]<<8) |
+         (og->header[20]<<16) |
+         (og->header[21]<<24));
 }
 
 
@@ -108,9 +108,9 @@
   for (i=0; i<8; i++)
     if (r & 0x80000000UL)
       r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator
-				    polynomial, although we use an
-				    unreflected alg and an init/final
-				    of 0, not 0xffffffff */
+                                    polynomial, although we use an
+                                    unreflected alg and an init/final
+                                    of 0, not 0xffffffff */
     else
        r<<=1;
  return (r & 0xffffffffUL);
@@ -240,7 +240,7 @@
   if(os->body_storage<=os->body_fill+needed){
     void *ret;
     ret=_ogg_realloc(os->body_data,(os->body_storage+needed+1024)*
-		     sizeof(*os->body_data));
+                     sizeof(*os->body_data));
     if(!ret){
       ogg_stream_clear(os);
       return -1;
@@ -255,14 +255,14 @@
   if(os->lacing_storage<=os->lacing_fill+needed){
     void *ret;
     ret=_ogg_realloc(os->lacing_vals,(os->lacing_storage+needed+32)*
-		     sizeof(*os->lacing_vals));
+                     sizeof(*os->lacing_vals));
     if(!ret){
       ogg_stream_clear(os);
       return -1;
     }
     os->lacing_vals=ret;
     ret=_ogg_realloc(os->granule_vals,(os->lacing_storage+needed+32)*
-		     sizeof(*os->granule_vals));
+                     sizeof(*os->granule_vals));
     if(!ret){
       ogg_stream_clear(os);
       return -1;
@@ -320,7 +320,7 @@
     os->body_fill-=os->body_returned;
     if(os->body_fill)
       memmove(os->body_data,os->body_data+os->body_returned,
-	      os->body_fill);
+              os->body_fill);
     os->body_returned=0;
   }
  
@@ -400,8 +400,8 @@
     granule_pos=0;
     for(vals=0;vals<maxvals;vals++){
       if((os->lacing_vals[vals]&0x0ff)<255){
-	vals++;
-	break;
+        vals++;
+        break;
       }
     }
   }else{
@@ -446,10 +446,10 @@
   /* 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 */
+                                     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++){
@@ -655,7 +655,7 @@
     /* Compare */
     if(memcmp(chksum,page+22,4)){
       /* D'oh.  Mismatch! Corrupt page (or miscapture and not a page
-	 at all) */
+         at all) */
       /* replace the computed checksum with the one actually read in */
       memcpy(page+22,chksum,4);
       
@@ -767,17 +767,17 @@
     if(br){
       os->body_fill-=br;
       if(os->body_fill)
-	memmove(os->body_data,os->body_data+br,os->body_fill);
+        memmove(os->body_data,os->body_data+br,os->body_fill);
       os->body_returned=0;
     }
 
     if(lr){
       /* segment table */
       if(os->lacing_fill-lr){
-	memmove(os->lacing_vals,os->lacing_vals+lr,
-		(os->lacing_fill-lr)*sizeof(*os->lacing_vals));
-	memmove(os->granule_vals,os->granule_vals+lr,
-		(os->lacing_fill-lr)*sizeof(*os->granule_vals));
+        memmove(os->lacing_vals,os->lacing_vals+lr,
+                (os->lacing_fill-lr)*sizeof(*os->lacing_vals));
+        memmove(os->granule_vals,os->granule_vals+lr,
+                (os->lacing_fill-lr)*sizeof(*os->granule_vals));
       }
       os->lacing_fill-=lr;
       os->lacing_packet-=lr;
@@ -814,13 +814,13 @@
        os->lacing_vals[os->lacing_fill-1]==0x400){
       bos=0;
       for(;segptr<segments;segptr++){
-	int val=header[27+segptr];
-	body+=val;
-	bodysize-=val;
-	if(val<255){
-	  segptr++;
-	  break;
-	}
+        int val=header[27+segptr];
+        body+=val;
+        bodysize-=val;
+        if(val<255){
+          segptr++;
+          break;
+        }
       }
     }
   }
@@ -839,8 +839,8 @@
       os->granule_vals[os->lacing_fill]=-1;
       
       if(bos){
-	os->lacing_vals[os->lacing_fill]|=0x100;
-	bos=0;
+        os->lacing_vals[os->lacing_fill]|=0x100;
+        bos=0;
       }
       
       if(val<255)saved=os->lacing_fill;
@@ -1010,7 +1010,7 @@
   lastno=no;
   if(op->packetno!=sequence){
     fprintf(stderr,"incorrect packet sequence %ld != %d\n",
-	    (long)(op->packetno),sequence);
+            (long)(op->packetno),sequence);
     exit(1);
   }
 
@@ -1018,7 +1018,7 @@
   for(j=0;j<op->bytes;j++)
     if(op->packet[j]!=((j+no)&0xff)){
       fprintf(stderr,"body data mismatch (1) at pos %ld: %x!=%lx!\n\n",
-	      j,op->packet[j],(j+no)&0xff);
+              j,op->packet[j],(j+no)&0xff);
       exit(1);
     }
 }
@@ -1029,7 +1029,7 @@
   for(j=0;j<og->body_len;j++)
     if(og->body[j]!=data[j]){
       fprintf(stderr,"body data mismatch (2) at pos %ld: %x!=%x!\n\n",
-	      j,data[j],og->body[j]);
+              j,data[j],og->body[j]);
       exit(1);
     }
 
@@ -1038,14 +1038,14 @@
     if(og->header[j]!=header[j]){
       fprintf(stderr,"header content mismatch at pos %ld:\n",j);
       for(j=0;j<header[26]+27;j++)
-	fprintf(stderr," (%ld)%02x:%02x",j,header[j],og->header[j]);
+        fprintf(stderr," (%ld)%02x:%02x",j,header[j],og->header[j]);
       fprintf(stderr,"\n");
       exit(1);
     }
   }
   if(og->header_len!=header[26]+27){
     fprintf(stderr,"header length incorrect! (%ld!=%d)\n",
-	    og->header_len,header[26]+27);
+            og->header_len,header[26]+27);
     exit(1);
   }
 }
@@ -1054,21 +1054,21 @@
   int j;
   fprintf(stderr,"\nHEADER:\n");
   fprintf(stderr,"  capture: %c %c %c %c  version: %d  flags: %x\n",
-	  og->header[0],og->header[1],og->header[2],og->header[3],
-	  (int)og->header[4],(int)og->header[5]);
+          og->header[0],og->header[1],og->header[2],og->header[3],
+          (int)og->header[4],(int)og->header[5]);
 
   fprintf(stderr,"  granulepos: %d  serialno: %d  pageno: %ld\n",
-	  (og->header[9]<<24)|(og->header[8]<<16)|
-	  (og->header[7]<<8)|og->header[6],
-	  (og->header[17]<<24)|(og->header[16]<<16)|
-	  (og->header[15]<<8)|og->header[14],
-	  ((long)(og->header[21])<<24)|(og->header[20]<<16)|
-	  (og->header[19]<<8)|og->header[18]);
+          (og->header[9]<<24)|(og->header[8]<<16)|
+          (og->header[7]<<8)|og->header[6],
+          (og->header[17]<<24)|(og->header[16]<<16)|
+          (og->header[15]<<8)|og->header[14],
+          ((long)(og->header[21])<<24)|(og->header[20]<<16)|
+          (og->header[19]<<8)|og->header[18]);
 
   fprintf(stderr,"  checksum: %02x:%02x:%02x:%02x\n  segments: %d (",
-	  (int)og->header[22],(int)og->header[23],
-	  (int)og->header[24],(int)og->header[25],
-	  (int)og->header[26]);
+          (int)og->header[22],(int)og->header[23],
+          (int)og->header[24],(int)og->header[25],
+          (int)og->header[26]);
 
   for(j=27;j<og->header_len;j++)
     fprintf(stderr,"%d ",(int)og->header[j]);
@@ -1097,192 +1097,192 @@
 
 /* 17 only */
 const int head1_0[] = {0x4f,0x67,0x67,0x53,0,0x06,
-		       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,0,0,0,0,
-		       0x15,0xed,0xec,0x91,
-		       1,
-		       17};
+                       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,0,0,0,0,
+                       0x15,0xed,0xec,0x91,
+                       1,
+                       17};
 
 /* 17, 254, 255, 256, 500, 510, 600 byte, pad */
 const int head1_1[] = {0x4f,0x67,0x67,0x53,0,0x02,
-		       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,0,0,0,0,
-		       0x59,0x10,0x6c,0x2c,
-		       1,
-		       17};
+                       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,0,0,0,0,
+                       0x59,0x10,0x6c,0x2c,
+                       1,
+                       17};
 const int head2_1[] = {0x4f,0x67,0x67,0x53,0,0x04,
-		       0x07,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,1,0,0,0,
-		       0x89,0x33,0x85,0xce,
-		       13,
-		       254,255,0,255,1,255,245,255,255,0,
-		       255,255,90};
+                       0x07,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,1,0,0,0,
+                       0x89,0x33,0x85,0xce,
+                       13,
+                       254,255,0,255,1,255,245,255,255,0,
+                       255,255,90};
 
 /* nil packets; beginning,middle,end */
 const int head1_2[] = {0x4f,0x67,0x67,0x53,0,0x02,
-		       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,0,0,0,0,
-		       0xff,0x7b,0x23,0x17,
-		       1,
-		       0};
+                       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,0,0,0,0,
+                       0xff,0x7b,0x23,0x17,
+                       1,
+                       0};
 const int head2_2[] = {0x4f,0x67,0x67,0x53,0,0x04,
-		       0x07,0x28,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,1,0,0,0,
-		       0x5c,0x3f,0x66,0xcb,
-		       17,
-		       17,254,255,0,0,255,1,0,255,245,255,255,0,
-		       255,255,90,0};
+                       0x07,0x28,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,1,0,0,0,
+                       0x5c,0x3f,0x66,0xcb,
+                       17,
+                       17,254,255,0,0,255,1,0,255,245,255,255,0,
+                       255,255,90,0};
 
 /* large initial packet */
 const int head1_3[] = {0x4f,0x67,0x67,0x53,0,0x02,
-		       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,0,0,0,0,
-		       0x01,0x27,0x31,0xaa,
-		       18,
-		       255,255,255,255,255,255,255,255,
-		       255,255,255,255,255,255,255,255,255,10};
+                       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,0,0,0,0,
+                       0x01,0x27,0x31,0xaa,
+                       18,
+                       255,255,255,255,255,255,255,255,
+                       255,255,255,255,255,255,255,255,255,10};
 
 const int head2_3[] = {0x4f,0x67,0x67,0x53,0,0x04,
-		       0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,1,0,0,0,
-		       0x7f,0x4e,0x8a,0xd2,
-		       4,
-		       255,4,255,0};
+                       0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,1,0,0,0,
+                       0x7f,0x4e,0x8a,0xd2,
+                       4,
+                       255,4,255,0};
 
 
 /* continuing packet test */
 const int head1_4[] = {0x4f,0x67,0x67,0x53,0,0x02,
-		       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,0,0,0,0,
-		       0xff,0x7b,0x23,0x17,
-		       1,
-		       0};
+                       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,0,0,0,0,
+                       0xff,0x7b,0x23,0x17,
+                       1,
+                       0};
 
 const int head2_4[] = {0x4f,0x67,0x67,0x53,0,0x00,
-		       0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-		       0x01,0x02,0x03,0x04,1,0,0,0,
-		       0x54,0x05,0x51,0xc8,
-		       17,
-		       255,255,255,255,255,255,255,255,
-		       255,255,255,255,255,255,255,255,255};
+                       0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+                       0x01,0x02,0x03,0x04,1,0,0,0,
+                       0x54,0x05,0x51,0xc8,
+                       17,
+                       255,255,255,255,255,255,255,255,
+                       255,255,255,255,255,255,255,255,255};
 
 const int head3_4[] = {0x4f,0x67,0x67,0x53,0,0x05,
-		       0x07,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,2,0,0,0,
-		       0xc8,0xc3,0xcb,0xed,
-		       5,
-		       10,255,4,255,0};
+                       0x07,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,2,0,0,0,
+                       0xc8,0xc3,0xcb,0xed,
+                       5,
+                       10,255,4,255,0};
 
 
 /* page with the 255 segment limit */
 const int head1_5[] = {0x4f,0x67,0x67,0x53,0,0x02,
-		       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,0,0,0,0,
-		       0xff,0x7b,0x23,0x17,
-		       1,
-		       0};
+                       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,0,0,0,0,
+                       0xff,0x7b,0x23,0x17,
+                       1,
+                       0};
 
 const int head2_5[] = {0x4f,0x67,0x67,0x53,0,0x00,
-		       0x07,0xfc,0x03,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,1,0,0,0,
-		       0xed,0x2a,0x2e,0xa7,
-		       255,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10,10,
-		       10,10,10,10,10,10,10};
+                       0x07,0xfc,0x03,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,1,0,0,0,
+                       0xed,0x2a,0x2e,0xa7,
+                       255,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10,10,
+                       10,10,10,10,10,10,10};
 
 const int head3_5[] = {0x4f,0x67,0x67,0x53,0,0x04,
-		       0x07,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,2,0,0,0,
-		       0x6c,0x3b,0x82,0x3d,
-		       1,
-		       50};
+                       0x07,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,2,0,0,0,
+                       0x6c,0x3b,0x82,0x3d,
+                       1,
+                       50};
 
 
 /* packet that overspans over an entire page */
 const int head1_6[] = {0x4f,0x67,0x67,0x53,0,0x02,
-		       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,0,0,0,0,
-		       0xff,0x7b,0x23,0x17,
-		       1,
-		       0};
+                       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,0,0,0,0,
+                       0xff,0x7b,0x23,0x17,
+                       1,
+                       0};
 
 const int head2_6[] = {0x4f,0x67,0x67,0x53,0,0x00,
-		       0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,1,0,0,0,
-		       0x3c,0xd9,0x4d,0x3f,
-		       17,
-		       100,255,255,255,255,255,255,255,255,
-		       255,255,255,255,255,255,255,255};
+                       0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,1,0,0,0,
+                       0x3c,0xd9,0x4d,0x3f,
+                       17,
+                       100,255,255,255,255,255,255,255,255,
+                       255,255,255,255,255,255,255,255};
 
 const int head3_6[] = {0x4f,0x67,0x67,0x53,0,0x01,
-		       0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-		       0x01,0x02,0x03,0x04,2,0,0,0,
-		       0x01,0xd2,0xe5,0xe5,
-		       17,
-		       255,255,255,255,255,255,255,255,
-		       255,255,255,255,255,255,255,255,255};
+                       0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+                       0x01,0x02,0x03,0x04,2,0,0,0,
+                       0x01,0xd2,0xe5,0xe5,
+                       17,
+                       255,255,255,255,255,255,255,255,
+                       255,255,255,255,255,255,255,255,255};
 
 const int head4_6[] = {0x4f,0x67,0x67,0x53,0,0x05,
-		       0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,3,0,0,0,
-		       0xef,0xdd,0x88,0xde,
-		       7,
-		       255,255,75,255,4,255,0};
+                       0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,3,0,0,0,
+                       0xef,0xdd,0x88,0xde,
+                       7,
+                       255,255,75,255,4,255,0};
 
 /* packet that overspans over an entire page */
 const int head1_7[] = {0x4f,0x67,0x67,0x53,0,0x02,
-		       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,0,0,0,0,
-		       0xff,0x7b,0x23,0x17,
-		       1,
-		       0};
+                       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,0,0,0,0,
+                       0xff,0x7b,0x23,0x17,
+                       1,
+                       0};
 
 const int head2_7[] = {0x4f,0x67,0x67,0x53,0,0x00,
-		       0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,1,0,0,0,
-		       0x3c,0xd9,0x4d,0x3f,
-		       17,
-		       100,255,255,255,255,255,255,255,255,
-		       255,255,255,255,255,255,255,255};
+                       0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,1,0,0,0,
+                       0x3c,0xd9,0x4d,0x3f,
+                       17,
+                       100,255,255,255,255,255,255,255,255,
+                       255,255,255,255,255,255,255,255};
 
 const int head3_7[] = {0x4f,0x67,0x67,0x53,0,0x05,
-		       0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
-		       0x01,0x02,0x03,0x04,2,0,0,0,
-		       0xd4,0xe0,0x60,0xe5,
-		       1,0};
+                       0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
+                       0x01,0x02,0x03,0x04,2,0,0,0,
+                       0xd4,0xe0,0x60,0xe5,
+                       1,0};
 
 void test_pack(const int *pl, const int **headers, int byteskip, 
-	       int pageskip, int packetskip){
+               int pageskip, int packetskip){
   unsigned char *data=_ogg_malloc(1024*1024); /* for scripted test cases only */
   long inptr=0;
   long outptr=0;
@@ -1326,109 +1326,109 @@
       ogg_page og;
       
       while(ogg_stream_pageout(&os_en,&og)){
-	/* We have a page.  Check it carefully */
-
-	fprintf(stderr,"%ld, ",pageno);
-
-	if(headers[pageno]==NULL){
-	  fprintf(stderr,"coded too many pages!\n");
-	  exit(1);
-	}
-
-	check_page(data+outptr,headers[pageno],&og);
-
-	outptr+=og.body_len;
-	pageno++;
-	if(pageskip){
-	  bosflag=1;
-	  pageskip--;
-	  deptr+=og.body_len;
-	}
-
-	/* have a complete page; submit it to sync/decode */
-
-	{
-	  ogg_page og_de;
-	  ogg_packet op_de,op_de2;
-	  char *buf=ogg_sync_buffer(&oy,og.header_len+og.body_len);
-	  char *next=buf;
-	  byteskipcount+=og.header_len;
-	  if(byteskipcount>byteskip){
-	    memcpy(next,og.header,byteskipcount-byteskip);
-	    next+=byteskipcount-byteskip;
-	    byteskipcount=byteskip;
-	  }
-
-	  byteskipcount+=og.body_len;
-	  if(byteskipcount>byteskip){
-	    memcpy(next,og.body,byteskipcount-byteskip);
-	    next+=byteskipcount-byteskip;
-	    byteskipcount=byteskip;
-	  }
-
-	  ogg_sync_wrote(&oy,next-buf);
-
-	  while(1){
-	    int ret=ogg_sync_pageout(&oy,&og_de);
-	    if(ret==0)break;
-	    if(ret<0)continue;
-	    /* got a page.  Happy happy.  Verify that it's good. */
-	    
-	    fprintf(stderr,"(%ld), ",pageout);
-
-	    check_page(data+deptr,headers[pageout],&og_de);
-	    deptr+=og_de.body_len;
-	    pageout++;
-
-	    /* submit it to deconstitution */
-	    ogg_stream_pagein(&os_de,&og_de);
-
-	    /* packets out? */
-	    while(ogg_stream_packetpeek(&os_de,&op_de2)>0){
-	      ogg_stream_packetpeek(&os_de,NULL);
-	      ogg_stream_packetout(&os_de,&op_de); /* just catching them all */
-	      
-	      /* verify peek and out match */
-	      if(memcmp(&op_de,&op_de2,sizeof(op_de))){
-		fprintf(stderr,"packetout != packetpeek! pos=%ld\n",
-			depacket);
-		exit(1);
-	      }
-
-	      /* verify the packet! */
-	      /* check data */
-	      if(memcmp(data+depacket,op_de.packet,op_de.bytes)){
-		fprintf(stderr,"packet data mismatch in decode! pos=%ld\n",
-			depacket);
-		exit(1);
-	      }
-	      /* check bos flag */
-	      if(bosflag==0 && op_de.b_o_s==0){
-		fprintf(stderr,"b_o_s flag not set on packet!\n");
-		exit(1);
-	      }
-	      if(bosflag && op_de.b_o_s){
-		fprintf(stderr,"b_o_s flag incorrectly set on packet!\n");
-		exit(1);
-	      }
-	      bosflag=1;
-	      depacket+=op_de.bytes;
-	      
-	      /* check eos flag */
-	      if(eosflag){
-		fprintf(stderr,"Multiple decoded packets with eos flag!\n");
-		exit(1);
-	      }
-
-	      if(op_de.e_o_s)eosflag=1;
-
-	      /* check granulepos flag */
-	      if(op_de.granulepos!=-1){
-		fprintf(stderr," granule:%ld ",(long)op_de.granulepos);
-	      }
-	    }
-	  }
-	}
+        /* We have a page.  Check it carefully */
+
+        fprintf(stderr,"%ld, ",pageno);
+
+        if(headers[pageno]==NULL){
+          fprintf(stderr,"coded too many pages!\n");
+          exit(1);
+        }
+
+        check_page(data+outptr,headers[pageno],&og);
+
+        outptr+=og.body_len;
+        pageno++;
+        if(pageskip){
+          bosflag=1;
+          pageskip--;
+          deptr+=og.body_len;
+        }
+
+        /* have a complete page; submit it to sync/decode */
+
+        {
+          ogg_page og_de;
+          ogg_packet op_de,op_de2;
+          char *buf=ogg_sync_buffer(&oy,og.header_len+og.body_len);
+          char *next=buf;
+          byteskipcount+=og.header_len;
+          if(byteskipcount>byteskip){
+            memcpy(next,og.header,byteskipcount-byteskip);
+            next+=byteskipcount-byteskip;
+            byteskipcount=byteskip;
+          }
+
+          byteskipcount+=og.body_len;
+          if(byteskipcount>byteskip){
+            memcpy(next,og.body,byteskipcount-byteskip);
+            next+=byteskipcount-byteskip;
+            byteskipcount=byteskip;
+          }
+
+          ogg_sync_wrote(&oy,next-buf);
+
+          while(1){
+            int ret=ogg_sync_pageout(&oy,&og_de);
+            if(ret==0)break;
+            if(ret<0)continue;
+            /* got a page.  Happy happy.  Verify that it's good. */
+            
+            fprintf(stderr,"(%ld), ",pageout);
+
+            check_page(data+deptr,headers[pageout],&og_de);
+            deptr+=og_de.body_len;
+            pageout++;
+
+            /* submit it to deconstitution */
+            ogg_stream_pagein(&os_de,&og_de);
+
+            /* packets out? */
+            while(ogg_stream_packetpeek(&os_de,&op_de2)>0){
+              ogg_stream_packetpeek(&os_de,NULL);
+              ogg_stream_packetout(&os_de,&op_de); /* just catching them all */
+              
+              /* verify peek and out match */
+              if(memcmp(&op_de,&op_de2,sizeof(op_de))){
+                fprintf(stderr,"packetout != packetpeek! pos=%ld\n",
+                        depacket);
+                exit(1);
+              }
+
+              /* verify the packet! */
+              /* check data */
+              if(memcmp(data+depacket,op_de.packet,op_de.bytes)){
+                fprintf(stderr,"packet data mismatch in decode! pos=%ld\n",
+                        depacket);
+                exit(1);
+              }
+              /* check bos flag */
+              if(bosflag==0 && op_de.b_o_s==0){
+                fprintf(stderr,"b_o_s flag not set on packet!\n");
+                exit(1);
+              }
+              if(bosflag && op_de.b_o_s){
+                fprintf(stderr,"b_o_s flag incorrectly set on packet!\n");
+                exit(1);
+              }
+              bosflag=1;
+              depacket+=op_de.bytes;
+              
+              /* check eos flag */
+              if(eosflag){
+                fprintf(stderr,"Multiple decoded packets with eos flag!\n");
+                exit(1);
+              }
+
+              if(op_de.e_o_s)eosflag=1;
+
+              /* check granulepos flag */
+              if(op_de.granulepos!=-1){
+                fprintf(stderr," granule:%ld ",(long)op_de.granulepos);
+              }
+            }
+          }
+        }
       }
     }
   }
@@ -1518,37 +1518,37 @@
   {
 
     const int packets[]={0,10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,10,
-		   10,10,10,10,10,10,10,50,-1};
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,10,
+                   10,10,10,10,10,10,10,50,-1};
     const int *headret[]={head1_5,head2_5,head3_5,NULL};
     
     fprintf(stderr,"testing max packet segments... ");
@@ -1612,8 +1612,8 @@
     /* retrieve finished pages */
     for(i=0;i<5;i++){
       if(ogg_stream_pageout(&os_en,&og[i])==0){
-	fprintf(stderr,"Too few pages output building sync tests!\n");
-	exit(1);
+        fprintf(stderr,"Too few pages output building sync tests!\n");
+        exit(1);
       }
       copy_page(&og[i]);
     }
@@ -1628,11 +1628,11 @@
       ogg_sync_reset(&oy);
       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);
-	ogg_sync_wrote(&oy,og[i].header_len);
-	memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len);
-	ogg_sync_wrote(&oy,og[i].body_len);
+        memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header,
+               og[i].header_len);
+        ogg_sync_wrote(&oy,og[i].header_len);
+        memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len);
+        ogg_sync_wrote(&oy,og[i].body_len);
       }
 
       ogg_sync_pageout(&oy,&temp);
@@ -1653,8 +1653,8 @@
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
       checkpacket(&test,4079,2,3000);
       if(ogg_stream_packetout(&os_de,&test)!=-1){
-	fprintf(stderr,"Error: loss of page did not return error\n");
-	exit(1);
+        fprintf(stderr,"Error: loss of page did not return error\n");
+        exit(1);
       }
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
       checkpacket(&test,76,5,-1);
@@ -1673,11 +1673,11 @@
       ogg_sync_reset(&oy);
       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);
-	ogg_sync_wrote(&oy,og[i].header_len);
-	memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len);
-	ogg_sync_wrote(&oy,og[i].body_len);
+        memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header,
+               og[i].header_len);
+        ogg_sync_wrote(&oy,og[i].header_len);
+        memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len);
+        ogg_sync_wrote(&oy,og[i].body_len);
       }
 
       ogg_sync_pageout(&oy,&temp);
@@ -1702,8 +1702,8 @@
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
       checkpacket(&test,2956,3,4000);
       if(ogg_stream_packetout(&os_de,&test)!=-1){
-	fprintf(stderr,"Error: loss of page did not return error\n");
-	exit(1);
+        fprintf(stderr,"Error: loss of page did not return error\n");
+        exit(1);
       }
       if(ogg_stream_packetout(&os_de,&test)!=1)error();
       checkpacket(&test,300,13,14000);
@@ -1717,26 +1717,26 @@
       fprintf(stderr,"Testing sync on partial inputs... ");
       ogg_sync_reset(&oy);
       memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
-	     3);
+             3);
       ogg_sync_wrote(&oy,3);
       if(ogg_sync_pageout(&oy,&og_de)>0)error();
       
       /* Test fractional page inputs: incomplete fixed header */
       memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+3,
-	     20);
+             20);
       ogg_sync_wrote(&oy,20);
       if(ogg_sync_pageout(&oy,&og_de)>0)error();
       
       /* Test fractional page inputs: incomplete header */
       memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+23,
-	     5);
+             5);
       ogg_sync_wrote(&oy,5);
       if(ogg_sync_pageout(&oy,&og_de)>0)error();
       
       /* Test fractional page inputs: incomplete body */
       
       memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+28,
-	     og[1].header_len-28);
+             og[1].header_len-28);
       ogg_sync_wrote(&oy,og[1].header_len-28);
       if(ogg_sync_pageout(&oy,&og_de)>0)error();
       
@@ -1745,7 +1745,7 @@
       if(ogg_sync_pageout(&oy,&og_de)>0)error();
       
       memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body+1000,
-	     og[1].body_len-1000);
+             og[1].body_len-1000);
       ogg_sync_wrote(&oy,og[1].body_len-1000);
       if(ogg_sync_pageout(&oy,&og_de)<=0)error();
       
@@ -1759,24 +1759,24 @@
       ogg_sync_reset(&oy); 
 
       memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
-	     og[1].header_len);
+             og[1].header_len);
       ogg_sync_wrote(&oy,og[1].header_len);
 
       memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
-	     og[1].body_len);
+             og[1].body_len);
       ogg_sync_wrote(&oy,og[1].body_len);
 
       memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
-	     20);
+             20);
       ogg_sync_wrote(&oy,20);
       if(ogg_sync_pageout(&oy,&og_de)<=0)error();
       if(ogg_sync_pageout(&oy,&og_de)>0)error();
 
       memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+20,
-	     og[1].header_len-20);
+             og[1].header_len-20);
       ogg_sync_wrote(&oy,og[1].header_len-20);
       memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
-	     og[1].body_len);
+             og[1].body_len);
       ogg_sync_wrote(&oy,og[1].body_len);
       if(ogg_sync_pageout(&oy,&og_de)<=0)error();
 
@@ -1791,29 +1791,29 @@
       
       /* 'garbage' */
       memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
-	     og[1].body_len);
+             og[1].body_len);
       ogg_sync_wrote(&oy,og[1].body_len);
 
       memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
-	     og[1].header_len);
+             og[1].header_len);
       ogg_sync_wrote(&oy,og[1].header_len);
 
       memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
-	     og[1].body_len);
+             og[1].body_len);
       ogg_sync_wrote(&oy,og[1].body_len);
 
       memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header,
-	     20);
+             20);
       ogg_sync_wrote(&oy,20);
       if(ogg_sync_pageout(&oy,&og_de)>0)error();
       if(ogg_sync_pageout(&oy,&og_de)<=0)error();
       if(ogg_sync_pageout(&oy,&og_de)>0)error();
 
       memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header+20,
-	     og[2].header_len-20);
+             og[2].header_len-20);
       ogg_sync_wrote(&oy,og[2].header_len-20);
       memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body,
-	     og[2].body_len);
+             og[2].body_len);
       ogg_sync_wrote(&oy,og[2].body_len);
       if(ogg_sync_pageout(&oy,&og_de)<=0)error();
 
@@ -1827,33 +1827,33 @@
       ogg_sync_reset(&oy); 
 
       memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
-	     og[1].header_len);
+             og[1].header_len);
       ogg_sync_wrote(&oy,og[1].header_len);
 
       memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
-	     og[1].body_len);
+             og[1].body_len);
       ogg_sync_wrote(&oy,og[1].body_len);
 
       memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header,
-	     og[2].header_len);
+             og[2].header_len);
       ogg_sync_wrote(&oy,og[2].header_len);
 
       memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header,
-	     og[2].header_len);
+             og[2].header_len);
       ogg_sync_wrote(&oy,og[2].header_len);
 
       if(ogg_sync_pageout(&oy,&og_de)<=0)error();
 
       memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body,
-	     og[2].body_len-5);
+             og[2].body_len-5);
       ogg_sync_wrote(&oy,og[2].body_len-5);
 
       memcpy(ogg_sync_buffer(&oy,og[3].header_len),og[3].header,
-	     og[3].header_len);
+             og[3].header_len);
       ogg_sync_wrote(&oy,og[3].header_len);
 
       memcpy(ogg_sync_buffer(&oy,og[3].body_len),og[3].body,
-	     og[3].body_len);
+             og[3].body_len);
       ogg_sync_wrote(&oy,og[3].body_len);
 
       if(ogg_sync_pageout(&oy,&og_de)>0)error();
@@ -1865,7 +1865,7 @@
     /* Free page data that was previously copied */
     {
       for(i=0;i<5;i++){
-	free_page(&og[i]);
+        free_page(&og[i]);
       }
     }
   }    

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks