aboutsummaryrefslogtreecommitdiffstats
path: root/src/decode.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-04-12 04:12:36 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-12 04:12:36 +0000
commita5464282639e46550f3120126d0ba877dd91a44b (patch)
tree8639b2a9881a54bf28ea6f5188912cc0a248fab1 /src/decode.c
parentb89b019723ae0a3df4a162a08574b6fe5982ccdd (diff)
downloadmpd-a5464282639e46550f3120126d0ba877dd91a44b.tar.gz
mpd-a5464282639e46550f3120126d0ba877dd91a44b.tar.xz
mpd-a5464282639e46550f3120126d0ba877dd91a44b.zip
make variables more local
Declare the variables "test" and "fadePosition" in the scope where they are really used. This removes some of the clutter in the function decodeParent(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7261 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/decode.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/decode.c b/src/decode.c
index 59419ed1b..05e4c4a56 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -371,11 +371,9 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
1=enabled; -1=disabled */
int doCrossFade = 0;
unsigned int crossFadeChunks = 0;
- unsigned int fadePosition;
/** the position of the next cross-faded chunk in the next
song */
int nextChunk = -1;
- unsigned int test;
int decodeWaitedOn = 0;
static const char silence[CHUNK_SIZE];
double sizeToTime = 0.0;
@@ -496,6 +494,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
if (pause)
player_sleep();
else if (cb->begin != end && cb->begin != next) {
+ unsigned int fadePosition;
if (doCrossFade == 1 && next >= 0 &&
((next > cb->begin &&
(fadePosition = next - cb->begin)
@@ -504,6 +503,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
(fadePosition = next - cb->begin +
buffered_chunks) <= crossFadeChunks))) {
/* perform cross fade */
+ unsigned int test = end;
if (nextChunk < 0) {
/* beginning of the cross fade
- adjust crossFadeChunks
@@ -512,7 +512,6 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
chunks in the old song */
crossFadeChunks = fadePosition;
}
- test = end;
if (end < cb->begin)
test += buffered_chunks;
nextChunk = cb->begin + crossFadeChunks;
@@ -576,8 +575,8 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
/* the cross-fade is finished; skip
the section which was cross-faded
(and thus already played) */
+ unsigned int test = end;
nextChunk = cb->begin + crossFadeChunks;
- test = end;
if (end < cb->begin)
test += buffered_chunks;
if ((unsigned)nextChunk < test) {