Add -Wwrite-strings and fix warnings.
authorCarl Worth <cworth@cworth.org>
Sun, 25 Oct 2009 22:55:23 +0000 (15:55 -0700)
committerCarl Worth <cworth@cworth.org>
Sun, 25 Oct 2009 22:55:23 +0000 (15:55 -0700)
Need to be const-clean when handling string literals.

Makefile
date.c

index 6e3ab26d3b8bc069c41ea85341d448be89d4b4fc..b2d5924b61756e608d664c1b3075f3982479d5f2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 PROGS=notmuch
 
-CXXWARNINGS_FLAGS=-Wall -Wextra
+CXXWARNINGS_FLAGS=-Wall -Wextra -Wwrite-strings
 CWARNINGS_FLAGS=$(CXXWARNINGS_FLAGS)
 
 CDEPENDS_FLAGS=`pkg-config --cflags glib-2.0 talloc`
diff --git a/date.c b/date.c
index c116bbd5f432f54dfa41b6aa991a0caccdd0b972..44f5a99acd8bb509b8058c20c0b482d93ab61c2b 100644 (file)
--- a/date.c
+++ b/date.c
@@ -79,7 +79,7 @@ static unsigned char gmime_datetok_table[256] = {
 
 /* hrm, is there a library for this stuff? */
 static struct {
-       char *name;
+       const char *name;
        int offset;
 } tz_offsets [] = {
        { "UT", 0 },
@@ -99,12 +99,12 @@ static struct {
        { "Y", 1200 },
 };
 
-static char *tm_months[] = {
+static const char *tm_months[] = {
        "Jan", "Feb", "Mar", "Apr", "May", "Jun",
        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
 };
 
-static char *tm_days[] = {
+static const char *tm_days[] = {
        "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
 };