[xiph-commits] r3793 - liboggz/trunk/src/liboggz

conrad at svn.annodex.net conrad at svn.annodex.net
Mon Nov 17 15:32:12 PST 2008


Author: conrad
Date: 2008-11-17 15:32:11 -0800 (Mon, 17 Nov 2008)
New Revision: 3793

Modified:
   liboggz/trunk/src/liboggz/oggz_seek.c
Log:
revert Ralph's dereference-before-null-check fixes from r3787,
accidentally overwritten in r3791


Modified: liboggz/trunk/src/liboggz/oggz_seek.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz_seek.c	2008-11-17 21:35:13 UTC (rev 3792)
+++ liboggz/trunk/src/liboggz/oggz_seek.c	2008-11-17 23:32:11 UTC (rev 3793)
@@ -606,7 +606,7 @@
 static ogg_int64_t
 oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
 {
-  OggzReader * reader = &oggz->x.reader;
+  OggzReader * reader;
   oggz_off_t offset_orig, offset_at, offset_guess;
   oggz_off_t offset_begin, offset_end = -1, offset_next;
   ogg_int64_t granule_at;
@@ -633,6 +633,8 @@
     return -1;
   }
 
+  reader = &oggz->x.reader;
+
   if (unit_target == reader->current_unit) {
 #ifdef DEBUG
     printf ("oggz_seek_set: unit_target == reader->current_unit, SKIP\n");
@@ -815,7 +817,7 @@
 off_t
 oggz_seek (OGGZ * oggz, oggz_off_t offset, int whence)
 {
-  OggzReader * reader = &oggz->x.reader;
+  OggzReader * reader;
   ogg_int64_t units = -1;
 
   if (oggz == NULL) return -1;
@@ -825,7 +827,9 @@
   }
 
   if (offset == 0 && whence == SEEK_SET) units = 0;
-  
+
+  reader = &oggz->x.reader;
+
   if (!(offset == 0 && whence == SEEK_CUR)) {
     /* Invalidate current_unit */
     reader->current_unit = -1;
@@ -837,7 +841,7 @@
 ogg_int64_t
 oggz_seek_units (OGGZ * oggz, ogg_int64_t units, int whence)
 {
-  OggzReader * reader = &oggz->x.reader;
+  OggzReader * reader;
 
   ogg_int64_t r;
 
@@ -862,6 +866,8 @@
     return -1;
   }
 
+  reader = &oggz->x.reader;
+
   switch (whence) {
   case SEEK_SET:
     r = oggz_seek_set (oggz, units);



More information about the commits mailing list