From: Carl Worth Date: Sun, 25 Oct 2009 22:39:53 +0000 (-0700) Subject: Add -Wextra and fix warnings. X-Git-Tag: 0.1~707 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=cc48812cb55e046a77ce1b4aad33566acc5fbd47 Add -Wextra and fix warnings. When adding -Wextra we also add -Wno-ununsed-parameters since that function means well enough, but is really annoying in practice. So the warnings we fix here are basically all comparsions between signed and unsigned values. --- diff --git a/Makefile b/Makefile index 5188e5d5..3a8cda90 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PROGS=notmuch -CXXWARNINGS_FLAGS=-Wall -CWARNINGS_FLAGS=$(CXX_WARNINGS_FLAGS) +CXXWARNINGS_FLAGS=-Wall -Wextra -Wno-unused-parameter +CWARNINGS_FLAGS=$(CXXWARNINGS_FLAGS) CDEPENDS_FLAGS=`pkg-config --cflags glib-2.0 talloc` CXXDEPENDS_FLAGS=`pkg-config --cflags glib-2.0 talloc` `xapian-config --cxxflags` diff --git a/message-file.c b/message-file.c index cb2bf665..f625a930 100644 --- a/message-file.c +++ b/message-file.c @@ -162,7 +162,7 @@ copy_header_unfolding (header_value_closure_t *value, chunk++; if (value->len + 1 + strlen (chunk) + 1 > value->size) { - int new_size = value->size; + unsigned int new_size = value->size; if (value->size == 0) new_size = strlen (chunk) + 1; else diff --git a/notmuch.c b/notmuch.c index c5fef0e8..10782d4d 100644 --- a/notmuch.c +++ b/notmuch.c @@ -755,7 +755,8 @@ restore_command (int argc, char *argv[]) FILE *input; notmuch_database_t *notmuch = NULL; char *line = NULL; - size_t line_size, line_len; + size_t line_size; + ssize_t line_len; regex_t regex; int rerr; int ret = 0; @@ -893,7 +894,7 @@ void usage (void) { command_t *command; - int i; + unsigned int i; fprintf (stderr, "Usage: notmuch [args...]\n"); fprintf (stderr, "\n"); @@ -911,7 +912,7 @@ int main (int argc, char *argv[]) { command_t *command; - int i; + unsigned int i; if (argc == 1) return setup_command (0, NULL); diff --git a/xutil.c b/xutil.c index 26761d78..6fa5eb0d 100644 --- a/xutil.c +++ b/xutil.c @@ -113,7 +113,8 @@ int xregexec (const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags) { - int i, rerr; + unsigned int i; + int rerr; rerr = regexec (preg, string, nmatch, pmatch, eflags); if (rerr)