diff options
author | Max Kellermann <max@duempel.org> | 2008-04-12 04:06:52 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-04-12 04:06:52 +0000 |
commit | b60789dd8cc421151fd2d0bbd44c0635c1dabb67 (patch) | |
tree | 2674c12d06f7914e361030002a4a90ab2fb9babf | |
parent | c011ab810549394e407de215554236dfae9f8a26 (diff) | |
download | mpd-b60789dd8cc421151fd2d0bbd44c0635c1dabb67.tar.gz mpd-b60789dd8cc421151fd2d0bbd44c0635c1dabb67.tar.xz mpd-b60789dd8cc421151fd2d0bbd44c0635c1dabb67.zip |
fix sign compare warnings
Do explicit casts before comparing signed with unsigned. The one in
log.c actually fixes another warning: in the expanded macro, there may
be a check "logLevel>=0", which is always true.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7230 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r-- | src/decode.c | 14 | ||||
-rw-r--r-- | src/interface.c | 2 | ||||
-rw-r--r-- | src/log.c | 2 | ||||
-rw-r--r-- | src/outputBuffer.c | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/src/decode.c b/src/decode.c index e44e09dc0..2d4f1cd16 100644 --- a/src/decode.c +++ b/src/decode.c @@ -487,7 +487,7 @@ static void advanceOutputBufferTo(OutputBuffer * cb, PlayerControl * pc, while (cb->begin != to) { handleMetadata(cb, pc, previous, currentChunkSent, currentChunk); - if (cb->begin + 1 >= buffered_chunks) { + if ((unsigned)cb->begin + 1 >= buffered_chunks) { cb->begin = 0; } else cb->begin++; @@ -522,7 +522,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * kill(getppid(), SIGUSR1); while (decode_pid > 0 && - cb->end - cb->begin < bbp && + (unsigned)(cb->end - cb->begin) < bbp && cb->end != buffered_chunks - 1 && dc->state != DECODE_STATE_STOP) { processDecodeInput(); @@ -582,8 +582,8 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * if (end < cb->begin) test += buffered_chunks; nextChunk = cb->begin + crossFadeChunks; - if (nextChunk < test) { - if (nextChunk >= buffered_chunks) { + if ((unsigned)nextChunk < test) { + if ((unsigned)nextChunk >= buffered_chunks) { nextChunk -= buffered_chunks; } pcm_mix(cb->chunks + @@ -621,7 +621,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * } pc->totalPlayTime += sizeToTime * cb->chunkSize[cb->begin]; - if (cb->begin + 1 >= buffered_chunks) { + if ((unsigned)cb->begin + 1 >= buffered_chunks) { cb->begin = 0; } else cb->begin++; @@ -632,8 +632,8 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * test = end; if (end < cb->begin) test += buffered_chunks; - if (nextChunk < test) { - if (nextChunk >= buffered_chunks) { + if ((unsigned)nextChunk < test) { + if ((unsigned)nextChunk >= buffered_chunks) { nextChunk -= buffered_chunks; } advanceOutputBufferTo(cb, pc, diff --git a/src/interface.c b/src/interface.c index 9f0be0982..43c8b3654 100644 --- a/src/interface.c +++ b/src/interface.c @@ -644,7 +644,7 @@ static void flushInterfaceBuffer(Interface * interface) if (ret < 0) break; else if ((size_t)ret < buf->size) { - assert(interface->deferred_bytes >= ret); + assert(interface->deferred_bytes >= (size_t)ret); interface->deferred_bytes -= ret; buf->data = (char *)buf->data + ret; buf->size -= ret; @@ -169,7 +169,7 @@ void setup_log_output(const int use_stdout) #define log_func(func,level,fp) \ mpd_printf void func(const char *fmt, ...) \ { \ - if (logLevel >= level) { \ + if ((int)logLevel >= level) { \ va_list args; \ va_start(args, fmt); \ do_log(fp, fmt, args); \ diff --git a/src/outputBuffer.c b/src/outputBuffer.c index cda56d4b1..15b7b26d9 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -75,7 +75,7 @@ void clearOutputBuffer(OutputBuffer * cb) void flushOutputBuffer(OutputBuffer * cb) { if (currentChunk == cb->end) { - if ((cb->end + 1) >= buffered_chunks) { + if (((unsigned)cb->end + 1) >= buffered_chunks) { cb->end = 0; } else cb->end++; |