From 8dfaf6265be52a582cc990f4332808d55063766f Mon Sep 17 00:00:00 2001 From: minus Date: Fri, 21 Aug 2015 16:53:11 +0200 Subject: fixed #108 signed/unsigned comparison --- sway/log.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sway/log.c') diff --git a/sway/log.c b/sway/log.c index e0734109..a1e89bad 100644 --- a/sway/log.c +++ b/sway/log.c @@ -10,7 +10,7 @@ #include int colored = 1; -int v = 0; +log_importance_t v = L_SILENT; static const char *verbosity_colors[] = { "", // L_SILENT @@ -19,7 +19,7 @@ static const char *verbosity_colors[] = { "\x1B[1;30m", // L_DEBUG }; -void init_log(int verbosity) { +void init_log(log_importance_t verbosity) { v = verbosity; /* set FD_CLOEXEC flag to prevent programs called with exec to write into logs */ int i; @@ -46,9 +46,9 @@ void sway_abort(const char *format, ...) { sway_terminate(); } -void sway_log(int verbosity, const char* format, ...) { +void sway_log(log_importance_t verbosity, const char* format, ...) { if (verbosity <= v) { - int c = verbosity; + unsigned int c = verbosity; if (c > sizeof(verbosity_colors) / sizeof(char *)) { c = sizeof(verbosity_colors) / sizeof(char *) - 1; } @@ -69,9 +69,9 @@ void sway_log(int verbosity, const char* format, ...) { } } -void sway_log_errno(int verbosity, char* format, ...) { +void sway_log_errno(log_importance_t verbosity, char* format, ...) { if (verbosity <= v) { - int c = verbosity; + unsigned int c = verbosity; if (c > sizeof(verbosity_colors) / sizeof(char *)) { c = sizeof(verbosity_colors) / sizeof(char *) - 1; } -- cgit v1.2.3