From 5a62c5cf9ce45542d1c90080791b0b4e9f5c24a3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Mar 2008 10:37:49 +0000 Subject: inputPlugins/oggvorbis: removed unused variables The local variable eof can actually be replaced with a simple "break". With a negative ret, the value of chunkpos can be invalidated, I am not sure if this might have been a bug. [ew: no, a negative ret will correspond to ret == OV_HOLE and ret will be reset to zero leaving chunkpos untouched (code cleaned up to make this more obvious] git-svn-id: https://svn.musicpd.org/mpd/trunk@7202 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/inputPlugins/oggvorbis_plugin.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index ec1c44ac6..539dc55b7 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -227,7 +227,6 @@ static int oggvorbis_decode(OutputBuffer * cb, DecoderControl * dc, OggCallbackData data; int current_section; int prev_section = -1; - int eof = 0; long ret; #define OGG_CHUNK_SIZE 4096 char chunk[OGG_CHUNK_SIZE]; @@ -278,7 +277,7 @@ static int oggvorbis_decode(OutputBuffer * cb, DecoderControl * dc, dc->totalTime = 0; dc->audioFormat.bits = 16; - while (!eof) { + while (1) { if (dc->seek) { if (0 == ov_time_seek_page(&vf, dc->seekWhere)) { clearOutputBuffer(cb); @@ -308,12 +307,12 @@ static int oggvorbis_decode(OutputBuffer * cb, DecoderControl * dc, prev_section = current_section; - if (ret <= 0 && ret != OV_HOLE) { - eof = 1; - break; + if (ret <= 0) { + if (ret == OV_HOLE) /* bad packet */ + ret = 0; + else /* break on EOF or other error */ + break; } - if (ret == OV_HOLE) - ret = 0; chunkpos += ret; -- cgit v1.2.3