diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2013-07-13 17:14:11 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2013-07-13 17:15:54 +0200 |
commit | 6bb3e4fe7e2b902b047c76a0cdf5889715c693ff (patch) | |
tree | 3e9892cf6d7e38efb68b8a12131a9ee645a91c59 | |
parent | 4f9ffe876b017756ef0c6b79a4608a069023671a (diff) |
tprintf: Fix compiler warnings
Fix the following warning when compiling with
-W/-Wsign-compare/-Wunused-parameter:
tprintf.c: In function ‘__tprintf_flush_skip’:
tprintf.c:54:65: warning: unused parameter ‘max’ [-Wunused-parameter]
tprintf.c: In function ‘__tprintf_flush’:
tprintf.c:70:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
tprintf.c:76:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
tprintf.c:80:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
tprintf.c: In function ‘tprintf’:
tprintf.c:131:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r-- | tprintf.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -51,7 +51,7 @@ static inline void __tprintf_flush_newline(void) fputc(' ', stdout); } -static inline int __tprintf_flush_skip(char *buf, int i, size_t max) +static inline int __tprintf_flush_skip(char *buf, int i) { int val = buf[i]; @@ -63,9 +63,9 @@ static inline int __tprintf_flush_skip(char *buf, int i, size_t max) static void __tprintf_flush(void) { - int i; + size_t i; static ssize_t line_count = 0; - size_t term_len = term_curr_size; + ssize_t term_len = term_curr_size; for (i = 0; i < buffer_use; ++i) { if (buffer[i] == '\n') { @@ -78,7 +78,7 @@ static void __tprintf_flush(void) line_count = term_starting_size; while (i < buffer_use && - __tprintf_flush_skip(buffer, i, buffer_use)) + __tprintf_flush_skip(buffer, i)) i++; } @@ -128,7 +128,7 @@ void tprintf(char *msg, ...) if (ret < 0) panic("vsnprintf screwed up in tprintf!\n"); - if (ret > sizeof(buffer)) + if ((size_t) ret > sizeof(buffer)) panic("No mem in tprintf left!\n"); if (ret >= avail) { __tprintf_flush(); |