aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:06 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:06 +0200
commitd186260016581a76205be6b34279a6c2a4a7dee4 (patch)
tree3bbcfc00ce57dad9c875d6d46047497320dbff56
parent4c06624988785007d85c2209dfc03868da5ab1e2 (diff)
downloadmpd-d186260016581a76205be6b34279a6c2a4a7dee4.tar.gz
mpd-d186260016581a76205be6b34279a6c2a4a7dee4.tar.xz
mpd-d186260016581a76205be6b34279a6c2a4a7dee4.zip
use break instead of local variable "eof"
Similar to previous patch: eliminate one variable by using "break". This also simplifies the code since we can remove one level of indent.
-rw-r--r--src/inputPlugins/audiofile_plugin.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c
index a50061d2b..6db342f82 100644
--- a/src/inputPlugins/audiofile_plugin.c
+++ b/src/inputPlugins/audiofile_plugin.c
@@ -88,10 +88,10 @@ static int audiofile_decode(struct decoder * decoder, char *path)
decoder_initialized(decoder, &audio_format, total_time);
{
- int ret, eof = 0, current = 0;
+ int ret, current = 0;
char chunk[CHUNK_SIZE];
- while (!eof) {
+ do {
if (dc.command == DECODE_COMMAND_SEEK) {
decoder_clear(decoder);
current = dc.seekWhere *
@@ -104,20 +104,16 @@ static int audiofile_decode(struct decoder * decoder, char *path)
afReadFrames(af_fp, AF_DEFAULT_TRACK, chunk,
CHUNK_SIZE / fs);
if (ret <= 0)
- eof = 1;
- else {
- current += ret;
- decoder_data(decoder, NULL,
- 1,
- chunk, ret * fs,
- (float)current /
- (float)audio_format.
- sampleRate, bitRate,
- NULL);
- if (dc.command == DECODE_COMMAND_STOP)
- break;
- }
- }
+
+ current += ret;
+ decoder_data(decoder, NULL,
+ 1,
+ chunk, ret * fs,
+ (float)current /
+ (float)audio_format.
+ sampleRate, bitRate,
+ NULL);
+ } while (dc.command != DECODE_COMMAND_STOP);
decoder_flush(decoder);
}