[xiph-commits] r16517 - trunk/theora/examples

giles at svn.xiph.org giles at svn.xiph.org
Tue Aug 25 12:48:57 PDT 2009


Author: giles
Date: 2009-08-25 12:48:57 -0700 (Tue, 25 Aug 2009)
New Revision: 16517

Modified:
   trunk/theora/examples/encoder_example.c
Log:
Fix an ignored fread() warning.

GCC now warns if the return code for fread() and similar functions is 
ignored, but it can be pacified just by assigning it to a variable. 
Clang isn't pursuaded by this and still warns that nothing is done
to check the result.

This combines the dummy read of the 4 byte chunk size (which we ignore)
with the subsequent read for the 'WAVE' chunk id so that the length
check covers both.


Modified: trunk/theora/examples/encoder_example.c
===================================================================
--- trunk/theora/examples/encoder_example.c	2009-08-25 14:59:31 UTC (rev 16516)
+++ trunk/theora/examples/encoder_example.c	2009-08-25 19:48:57 UTC (rev 16517)
@@ -731,10 +731,9 @@
 
     /* Parse the rest of the header */
 
-    ret=fread(buffer,1,4,test);
-    ret=fread(buffer,1,4,test);
-    if(ret<4)goto riff_err;
-    if(!memcmp(buffer,"WAVE",4)){
+    ret=fread(buffer,1,8,test);
+    if(ret<8)goto riff_err;
+    if(!memcmp(buffer+4,"WAVE",4)){
 
       while(!feof(test)){
         ret=fread(buffer,1,4,test);



More information about the commits mailing list