Commit 4daa143e authored by conrad's avatar conrad

remove dead code from oggz_read.c

for ticket:439, reported by Coverity


git-svn-id: http://svn.annodex.net/liboggz/trunk@3790 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent 3f12ea32
......@@ -120,12 +120,8 @@ oggz_set_read_callback (OGGZ * oggz, long serialno,
reader->read_user_data = user_data;
} else {
stream = oggz_get_stream (oggz, serialno);
#if 0
if (stream == NULL) return OGGZ_ERR_BAD_SERIALNO;
#else
if (stream == NULL)
stream = oggz_add_stream (oggz, serialno);
#endif
stream->read_packet = read_packet;
stream->read_user_data = user_data;
......@@ -154,12 +150,8 @@ oggz_set_read_page (OGGZ * oggz, long serialno, OggzReadPage read_page,
reader->read_page_user_data = user_data;
} else {
stream = oggz_get_stream (oggz, serialno);
#if 0
if (stream == NULL) return OGGZ_ERR_BAD_SERIALNO;
#else
if (stream == NULL)
stream = oggz_add_stream (oggz, serialno);
#endif
stream->read_page = read_page;
stream->read_page_user_data = user_data;
......@@ -169,9 +161,10 @@ oggz_set_read_page (OGGZ * oggz, long serialno, OggzReadPage read_page,
}
/*
* oggz_get_next_page_7 (oggz, og, do_read)
* oggz_read_get_next_page (oggz, og, do_read)
*
* MODIFIED COPY OF CODE FROM BELOW SEEKING STUFF
* This differs from oggz_get_next_page() in oggz_seek.c in that it
* does not attempt to call oggz_io_read() if the sync buffer is empty.
*
* retrieves the next page.
* returns >= 0 if found; return value is offset of page start
......@@ -179,12 +172,9 @@ oggz_set_read_page (OGGZ * oggz, long serialno, OggzReadPage read_page,
* returns -2 if EOF was encountered
*/
static oggz_off_t
oggz_get_next_page_7 (OGGZ * oggz, ogg_page * og)
oggz_read_get_next_page (OGGZ * oggz, ogg_page * og)
{
OggzReader * reader = &oggz->x.reader;
#if _UNMODIFIED
char * buffer;
#endif
long bytes = 0, more;
oggz_off_t page_offset = 0, ret;
int found = 0;
......@@ -194,25 +184,7 @@ oggz_get_next_page_7 (OGGZ * oggz, ogg_page * og)
if (more == 0) {
page_offset = 0;
#if _UMMODIFIED_
buffer = ogg_sync_buffer (&reader->ogg_sync, CHUNKSIZE);
if ((bytes = oggz_io_read (oggz, buffer, CHUNKSIZE)) == 0) {
#if 0
if (ferror (oggz->file)) {
oggz_set_error (oggz, OGGZ_ERR_SYSTEM);
return -1;
}
#endif
}
if (bytes == 0) {
return -2;
}
ogg_sync_wrote(&reader->ogg_sync, bytes);
#else
return -2;
#endif
} else if (more < 0) {
#ifdef DEBUG_VERBOSE
printf ("get_next_page: skipped %ld bytes\n", -more);
......@@ -513,7 +485,7 @@ oggz_read_sync (OGGZ * oggz)
/* If we've got a stop already, don't read more data in */
if (cb_ret == OGGZ_STOP_OK || cb_ret == OGGZ_STOP_ERR) return cb_ret;
if(oggz_get_next_page_7 (oggz, &og) < 0)
if(oggz_read_get_next_page (oggz, &og) < 0)
return OGGZ_READ_EMPTY; /* eof. leave uninitialized */
serialno = ogg_page_serialno (&og);
......@@ -566,12 +538,6 @@ oggz_read_sync (OGGZ * oggz)
reader->read_page (oggz, &og, serialno, reader->read_page_user_data);
}
#if 0
/* bitrate tracking; add the header's bytes here, the body bytes
are done by packet above */
vf->bittrack+=og.header_len*8;
#endif
ogg_stream_pagein(os, &og);
}
......@@ -601,27 +567,11 @@ oggz_read (OGGZ * oggz, long n)
cb_ret = oggz_read_sync (oggz);
#if 0
if (cb_ret == OGGZ_READ_EMPTY) {
/* If there's nothing to read yet, don't return 0 (eof) */
if (reader->current_unit == 0) cb_ret = 0;
else {
#if 0
printf ("oggz_read: EMPTY, current_unit %ld != 0\n",
reader->current_unit);
return 0;
#endif
}
}
#endif
while (cb_ret != OGGZ_STOP_ERR && cb_ret != OGGZ_STOP_OK &&
bytes_read > 0 && remaining > 0) {
bytes = MIN (remaining, CHUNKSIZE);
buffer = ogg_sync_buffer (&reader->ogg_sync, bytes);
if ((bytes_read = (long) oggz_io_read (oggz, buffer, bytes)) == 0) {
/* schyeah! */
}
bytes_read = (long) oggz_io_read (oggz, buffer, bytes);
if (bytes_read == OGGZ_ERR_SYSTEM) {
return OGGZ_ERR_SYSTEM;
}
......@@ -685,14 +635,6 @@ oggz_read_input (OGGZ * oggz, unsigned char * buf, long n)
cb_ret = oggz_read_sync (oggz);
#if 0
if (cb_ret == OGGZ_READ_EMPTY) {
/* If there's nothing to read yet, don't return 0 (eof) */
if (reader->current_unit == 0) cb_ret = 0;
else return 0;
}
#endif
while (cb_ret != OGGZ_STOP_ERR && cb_ret != OGGZ_STOP_OK &&
/* !oggz->eos && */ remaining > 0) {
bytes = MIN (remaining, 4096);
......
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