[xiph-commits] r14720 - trunk/theora-exp/examples

tterribe at svn.xiph.org tterribe at svn.xiph.org
Sat Apr 12 14:14:35 PDT 2008


Author: tterribe
Date: 2008-04-12 14:14:35 -0700 (Sat, 12 Apr 2008)
New Revision: 14720

Modified:
   trunk/theora-exp/examples/rehuff.c
Log:
Move dump of C code for Huffman tables to stderr to avoid conflict with
 outputting the file to stdout.
Fixes #1334.


Modified: trunk/theora-exp/examples/rehuff.c
===================================================================
--- trunk/theora-exp/examples/rehuff.c	2008-04-12 11:36:40 UTC (rev 14719)
+++ trunk/theora-exp/examples/rehuff.c	2008-04-12 21:14:35 UTC (rev 14720)
@@ -186,7 +186,8 @@
   int ti;
   int tj;
   maxlen=0;
-  printf("th_huff_code %s[TH_NHUFFMAN_TABLES][TH_NDCT_TOKENS]={",_symbol);
+  fprintf(stderr,"th_huff_code %s[TH_NHUFFMAN_TABLES][TH_NDCT_TOKENS]={",
+   _symbol);
   for(ti=0;ti<TH_NHUFFMAN_TABLES;ti++){
     for(tj=0;tj<TH_NDCT_TOKENS;tj++){
       if(_codes[ti][tj].nbits>maxlen)maxlen=_codes[ti][tj].nbits;
@@ -194,16 +195,17 @@
   }
   maxlen=maxlen+3>>2;
   for(ti=0;ti<TH_NHUFFMAN_TABLES;ti++){
-    if(ti>0)printf(",");
-    printf("\n  {");
+    if(ti>0)fprintf(stderr,",");
+    fprintf(stderr,"\n  {");
     for(tj=0;tj<TH_NDCT_TOKENS;tj++){
-      if(tj>0)printf(",");
-      if((tj&3)==0)printf("\n    ");
-      printf("{0x%0*X,%2i}",maxlen,_codes[ti][tj].pattern,_codes[ti][tj].nbits);
+      if(tj>0)fprintf(stderr,",");
+      if((tj&3)==0)fprintf(stderr,"\n    ");
+      fprintf(stderr,"{0x%0*X,%2i}",maxlen,
+       _codes[ti][tj].pattern,_codes[ti][tj].nbits);
     }
-    printf("\n  }");
+    fprintf(stderr,"\n  }");
   }
-  printf("\n};\n");
+  fprintf(stderr,"\n};\n");
 }
 
 
@@ -992,7 +994,8 @@
           rehuffs[ri].processing_headers=th_decode_headerin(&rehuffs[ri].ti,
            &rehuffs[ri].tc,&rehuffs[ri].ts,&op);
           if(rehuffs[ri].processing_headers<0){
-            printf("Error parsing Theora stream headers; corrupt stream?\n");
+            fprintf(stderr,
+             "Error parsing Theora stream headers; corrupt stream?\n");
             exit(1);
           }
           else if(rehuffs[ri].processing_headers>0){



More information about the commits mailing list