aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/decode.c6
-rw-r--r--src/log.h8
2 files changed, 10 insertions, 4 deletions
diff --git a/src/decode.c b/src/decode.c
index 8f8b0da68..80789337e 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -93,10 +93,12 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) {
chunks = (af->sampleRate*af->bits*af->channels/8.0/CHUNK_SIZE);
chunks = (chunks*pc->crossFade+0.5);
- if(chunks>BUFFERED_CHUNKS-buffered_before_play) {
+ if(chunks>(BUFFERED_CHUNKS-buffered_before_play)) {
chunks = BUFFERED_CHUNKS-buffered_before_play;
}
+ if(chunks<0) chunks = 0;
+
return chunks;
}
@@ -338,7 +340,7 @@ void decode() {
(fadePosition=cb->next-cb->begin+
BUFFERED_CHUNKS)<=crossFadeChunks)))
{
- if(nextChunk==-1) {
+ if(nextChunk<0) {
crossFadeChunks = fadePosition;
}
nextChunk = cb->begin+crossFadeChunks;
diff --git a/src/log.h b/src/log.h
index c652c6fe6..9112658be 100644
--- a/src/log.h
+++ b/src/log.h
@@ -27,9 +27,13 @@
extern int logLevel;
-#define ERROR(x, arg...) myfprintf(stderr, x , ##arg)
+#define ERROR(x, arg...) do { \
+ myfprintf(stderr, x , ##arg); \
+ } while(0);
-#define LOG(x, arg...) myfprintf(stdout, x , ##arg)
+#define LOG(x, arg...) do { \
+ myfprintf(stdout, x , ##arg); \
+ } while(0);
#define SECURE(x, arg...) do { \
if(logLevel>=LOG_LEVEL_SECURE) myfprintf(stdout, x , ##arg); \