From 7dec2a8ec7925de14ec1bdfa5a7b4469cf7307ba Mon Sep 17 00:00:00 2001 From: Lefteris Chatzimparmpas Date: Mon, 20 Aug 2012 20:22:54 +0200 Subject: [PATCH] Enable extra compiler checks and correct warnings. --- src/Makefile | 2 +- src/log.c | 4 ++-- src/namespace.c | 4 ++-- src/response.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Makefile b/src/Makefile index 3938401..c1ec9d0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -16,7 +16,7 @@ LIBPCRE = -lpcre LIBSSL = -lssl LIBCRYPTO = -lcrypto -CFLAGS = -Wall -O -DCONFIG_SHAREDIR='"$(SHAREDIR)"' $(INCDIRS) $(MYCFLAGS) +CFLAGS = -Wall -Wextra -O -DCONFIG_SHAREDIR='"$(SHAREDIR)"' $(INCDIRS) $(MYCFLAGS) LDFLAGS = $(LIBDIRS) $(MYLDFLAGS) LIBS = -lm $(LIBLUA) $(LIBPCRE) $(LIBSSL) $(LIBCRYPTO) $(MYLIBS) diff --git a/src/log.c b/src/log.c index 63622d2..992b376 100644 --- a/src/log.c +++ b/src/log.c @@ -51,7 +51,7 @@ debug(const char *fmt,...) { va_list args; - if (opts.debug <= 0 || !debugfp) + if (!opts.debug || !debugfp) return; va_start(args, fmt); @@ -68,7 +68,7 @@ void debugc(char c) { - if (opts.debug <= 0 || !debugfp) + if (!opts.debug || !debugfp) return; fputc(c, debugfp); diff --git a/src/namespace.c b/src/namespace.c index 679fe5d..45b8087 100644 --- a/src/namespace.c +++ b/src/namespace.c @@ -308,12 +308,12 @@ reverse_conversion(const char *mbox) } /* Convert from Unicode to UTF-8. */ - if (ucp[0] >= 0x00 && ucp[0] <= 0x07) { + if (ucp[0] <= 0x07) { *out++ = 0xC0 | (ucp[0] << 2 & 0x1C) | (ucp[1] >> 6 & 0x03); *out++ = 0x80 | (ucp[1] & 0x3F); } else if ((ucp[0] >= 0x08 && ucp[0] <= 0xD7) || - (ucp[0] >= 0xE0 && ucp[0] <= 0xFF)) { + ucp[0] >= 0xE0) { *out++ = 0xE0 | (ucp[0] >> 4 & 0x0F); *out++ = 0x80 | (ucp[0] << 2 & 0x1C) | (ucp[1] >> 6 & 0x03); diff --git a/src/response.c b/src/response.c index 2cba1ea..3bc661b 100644 --- a/src/response.c +++ b/src/response.c @@ -168,7 +168,7 @@ int check_preauth(char *buf) { - if (xstrcasestr(ibuf.data, "* PREAUTH")) + if (xstrcasestr(buf, "* PREAUTH")) return 1; else return 0;