Commit d1862600 authored by Max Kellermann's avatar Max Kellermann

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.
parent 4c066249
...@@ -88,10 +88,10 @@ static int audiofile_decode(struct decoder * decoder, char *path) ...@@ -88,10 +88,10 @@ static int audiofile_decode(struct decoder * decoder, char *path)
decoder_initialized(decoder, &audio_format, total_time); decoder_initialized(decoder, &audio_format, total_time);
{ {
int ret, eof = 0, current = 0; int ret, current = 0;
char chunk[CHUNK_SIZE]; char chunk[CHUNK_SIZE];
while (!eof) { do {
if (dc.command == DECODE_COMMAND_SEEK) { if (dc.command == DECODE_COMMAND_SEEK) {
decoder_clear(decoder); decoder_clear(decoder);
current = dc.seekWhere * current = dc.seekWhere *
...@@ -104,20 +104,16 @@ static int audiofile_decode(struct decoder * decoder, char *path) ...@@ -104,20 +104,16 @@ static int audiofile_decode(struct decoder * decoder, char *path)
afReadFrames(af_fp, AF_DEFAULT_TRACK, chunk, afReadFrames(af_fp, AF_DEFAULT_TRACK, chunk,
CHUNK_SIZE / fs); CHUNK_SIZE / fs);
if (ret <= 0) if (ret <= 0)
eof = 1;
else { current += ret;
current += ret; decoder_data(decoder, NULL,
decoder_data(decoder, NULL, 1,
1, chunk, ret * fs,
chunk, ret * fs, (float)current /
(float)current / (float)audio_format.
(float)audio_format. sampleRate, bitRate,
sampleRate, bitRate, NULL);
NULL); } while (dc.command != DECODE_COMMAND_STOP);
if (dc.command == DECODE_COMMAND_STOP)
break;
}
}
decoder_flush(decoder); decoder_flush(decoder);
} }
......
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