From 6bb3e4fe7e2b902b047c76a0cdf5889715c693ff Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sat, 13 Jul 2013 17:14:11 +0200 Subject: tprintf: Fix compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tprintf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tprintf.c') diff --git a/tprintf.c b/tprintf.c index 82623a9..0ca2375 100644 --- a/tprintf.c +++ b/tprintf.c @@ -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(); -- cgit v1.2.3-54-g00ecf r'>committer
diff options
context:
space:
mode: