aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2009-10-25 15:39:53 -0700
committerCarl Worth <cworth@cworth.org>2009-10-25 15:52:14 -0700
commitcc48812cb55e046a77ce1b4aad33566acc5fbd47 (patch)
tree4f66f6c647f0ae7ac5eec68732bc9b6706b3beaf
parent067c547b236133cacbe7192b99bcd5487a08f7c8 (diff)
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.
-rw-r--r--Makefile4
-rw-r--r--message-file.c2
-rw-r--r--notmuch.c7
-rw-r--r--xutil.c3
4 files changed, 9 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 5188e5d..3a8cda9 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 cb2bf66..f625a93 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 c5fef0e..10782d4 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 <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 26761d7..6fa5eb0 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)