]> git.notmuchmail.org Git - notmuch/commitdiff
Add -Wextra and fix warnings.
authorCarl Worth <cworth@cworth.org>
Sun, 25 Oct 2009 22:39:53 +0000 (15:39 -0700)
committerCarl Worth <cworth@cworth.org>
Sun, 25 Oct 2009 22:52:14 +0000 (15:52 -0700)
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.

Makefile
message-file.c
notmuch.c
xutil.c

index 5188e5d50d9013adad266ee09d71c53f05d5392d..3a8cda90fb09751d013c58f8feca8c8952f7478f 100644 (file)
--- 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`
index cb2bf665006c4de4734f446e28c782c08a0f8a8a..f625a9300829293ff6352d062bc36f5b63a110a4 100644 (file)
@@ -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
index c5fef0e800961782a1941d2999a4be6f4c6146c0..10782d4deadf9c2979a44c02541fdd351b298ca0 100644 (file)
--- 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 <command> [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 26761d78e8914511a148a5fc2197175907ce2f69..6fa5eb0ddb49dfb12dcd0cf039d4165cd8f6f7cb 100644 (file)
--- 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)