Commit 1a14d4b5 authored by conrad's avatar conrad

revert Ralph's dereference-before-null-check fixes from r3787,

accidentally overwritten in r3791


git-svn-id: http://svn.annodex.net/liboggz/trunk@3793 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent 5b4fa2e7
......@@ -606,7 +606,7 @@ oggz_offset_end (OGGZ * oggz)
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 @@ oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
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 @@ oggz_seek_end (OGGZ * oggz, ogg_int64_t unit_offset)
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 @@ oggz_seek (OGGZ * oggz, oggz_off_t offset, int whence)
}
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 @@ oggz_seek (OGGZ * oggz, oggz_off_t offset, int whence)
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 @@ oggz_seek_units (OGGZ * oggz, ogg_int64_t units, int whence)
return -1;
}
reader = &oggz->x.reader;
switch (whence) {
case SEEK_SET:
r = oggz_seek_set (oggz, units);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment