[xiph-commits] r17536 - trunk/Tremor

tterribe at svn.xiph.org tterribe at svn.xiph.org
Thu Oct 14 09:06:44 PDT 2010


Author: tterribe
Date: 2010-10-14 09:06:44 -0700 (Thu, 14 Oct 2010)
New Revision: 17536

Modified:
   trunk/Tremor/vorbisfile.c
Log:
Fix _lookup_serial to compare with proper types.

Storing a serial number in a long and comparing it to an ogg_uint32_t only
 works if you cast the long down, instead of letting C promote it.


Modified: trunk/Tremor/vorbisfile.c
===================================================================
--- trunk/Tremor/vorbisfile.c	2010-10-14 06:42:51 UTC (rev 17535)
+++ trunk/Tremor/vorbisfile.c	2010-10-14 16:06:44 UTC (rev 17536)
@@ -194,7 +194,7 @@
 }
 
 /* returns nonzero if found */
-static int _lookup_serialno(long s, ogg_uint32_t *serialno_list, int n){
+static int _lookup_serialno(ogg_uint32_t s, ogg_uint32_t *serialno_list, int n){
   if(serialno_list){
     while(n--){
       if(*serialno_list == s) return 1;
@@ -205,7 +205,7 @@
 }
 
 static int _lookup_page_serialno(ogg_page *og, ogg_uint32_t *serialno_list, int n){
-  long s = ogg_page_serialno(og);
+  ogg_uint32_t s = ogg_page_serialno(og);
   return _lookup_serialno(s,serialno_list,n);
 }
 
@@ -246,12 +246,12 @@
         ret_gran=ogg_page_granulepos(&og);
         offset=ret;
 
-        if(ret_serialno == *serialno){
+        if((ogg_uint32_t)ret_serialno == *serialno){
           prefoffset=ret;
           *granpos=ret_gran;
         }
 
-        if(!_lookup_serialno(ret_serialno,serial_list,serial_n)){
+        if(!_lookup_serialno((ogg_uint32_t)ret_serialno,serial_list,serial_n)){
           /* we fell off the end of the link, which means we seeked
              back too far and shouldn't have been looking in that link
              to begin with.  If we found the preferred serial number,



More information about the commits mailing list