more constness.
authorPierre Habouzit <madcoder@debian.org>
Sat, 28 Oct 2006 01:20:13 +0000 (03:20 +0200)
committerPierre Habouzit <madcoder@debian.org>
Sat, 28 Oct 2006 01:20:13 +0000 (03:20 +0200)
simplifications.

21 files changed:
commands.c
crypt.c
edit.c
handler.c
hash.c
hash.h
hdrline.c
help.c
history.c
history.h
init.c
keymap.c
mutt_crypt.h
mutt_sasl.c
pgpkey.c
remailer.c
rfc2047.c
sendlib.c
smime.c
xterm.c
xterm.h

index b71c77d..95a7d1d 100644 (file)
@@ -350,8 +350,8 @@ static void pipe_msg (HEADER * h, FILE * fp, int decode, int print)
 
 /* the following code is shared between printing and piping */
 
 
 /* the following code is shared between printing and piping */
 
-static int _mutt_pipe_message (HEADER * h, char *cmd,
-                               int decode, int print, int split, char *sep)
+static int _mutt_pipe_message(HEADER * h, char *cmd, int decode, int print,
+                              int split, const char *sep)
 {
 
   int i, rc = 0;
 {
 
   int i, rc = 0;
@@ -595,11 +595,11 @@ void mutt_enter_command (void)
 
 void mutt_display_address (ENVELOPE * env)
 {
 
 void mutt_display_address (ENVELOPE * env)
 {
-  char *pfx = NULL;
+  const char *pfx = NULL;
   char buf[SHORT_STRING];
   ADDRESS *adr = NULL;
 
   char buf[SHORT_STRING];
   ADDRESS *adr = NULL;
 
-  adr = mutt_get_address (env, &pfx);
+  adr = mutt_get_address(env, &pfx);
 
   if (!adr)
     return;
 
   if (!adr)
     return;
diff --git a/crypt.c b/crypt.c
index eac7a85..54d60fe 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -51,7 +51,7 @@
 
 
 /* print the current time to avoid spoofing of the signature output */
 
 
 /* print the current time to avoid spoofing of the signature output */
-void crypt_current_time (STATE * s, char *app_name)
+void crypt_current_time (STATE * s, const char *app_name)
 {
   time_t t;
   char p[STRING], tmp[STRING];
 {
   time_t t;
   char p[STRING], tmp[STRING];
diff --git a/edit.c b/edit.c
index 966d1be..ff581b0 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -35,7 +35,7 @@
  * SLcurses_waddnstr() can't take a "const char *", so this is only
  * declared "static" (sigh)
  */
  * SLcurses_waddnstr() can't take a "const char *", so this is only
  * declared "static" (sigh)
  */
-static char *EditorHelp = N_("\
+static const char *EditorHelp = N_("\
 ~~             insert a line begining with a single ~\n\
 ~b users       add users to the Bcc: field\n\
 ~c users       add users to the Cc: field\n\
 ~~             insert a line begining with a single ~\n\
 ~b users       add users to the Bcc: field\n\
 ~c users       add users to the Cc: field\n\
index adce68c..7da0547 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -585,16 +585,16 @@ static void enriched_putc (int c, struct enriched_state *stte)
 
 static void enriched_puts (const char *s, struct enriched_state *stte)
 {
 
 static void enriched_puts (const char *s, struct enriched_state *stte)
 {
-  char *c;
+  const char *p;
 
   if (stte->buff_len < stte->buff_used + str_len (s)) {
     stte->buff_len += LONG_STRING;
     mem_realloc (&stte->buffer, stte->buff_len + 1);
   }
 
   if (stte->buff_len < stte->buff_used + str_len (s)) {
     stte->buff_len += LONG_STRING;
     mem_realloc (&stte->buffer, stte->buff_len + 1);
   }
-  c = s;
-  while (*c) {
-    stte->buffer[stte->buff_used++] = *c;
-    c++;
+
+  p = s;
+  while (*p) {
+    stte->buffer[stte->buff_used++] = *p++;
   }
 }
 
   }
 }
 
@@ -1288,7 +1288,7 @@ void mutt_decode_attachment (BODY * b, STATE * s)
 
   if (istext) {
     if (s->flags & M_CHARCONV) {
 
   if (istext) {
     if (s->flags & M_CHARCONV) {
-      char *charset = mutt_get_parameter ("charset", b->parameter);
+      const char *charset = mutt_get_parameter ("charset", b->parameter);
 
       if (!option (OPTSTRICTMIME) && !charset)
         charset = mutt_get_first_charset (AssumedCharset);
 
       if (!option (OPTSTRICTMIME) && !charset)
         charset = mutt_get_first_charset (AssumedCharset);
diff --git a/hash.c b/hash.c
index 0e2192b..72225be 100644 (file)
--- a/hash.c
+++ b/hash.c
@@ -77,7 +77,7 @@ HASH *hash_resize (HASH * ptr, int nelem)
  * data         data to associate with `key'
  * allow_dup    if nonzero, duplicate keys are allowed in the table 
  */
  * data         data to associate with `key'
  * allow_dup    if nonzero, duplicate keys are allowed in the table 
  */
-int hash_insert (HASH * table, const char *key, const void *data, int allow_dup)
+int hash_insert (HASH * table, const char *key, void *data, int allow_dup)
 {
   struct hash_elem *ptr;
   int h;
 {
   struct hash_elem *ptr;
   int h;
diff --git a/hash.h b/hash.h
index 3c072c1..1a4f985 100644 (file)
--- a/hash.h
+++ b/hash.h
@@ -27,7 +27,7 @@ typedef struct {
 
 HASH *hash_create (int nelem);
 int hash_string (const unsigned char *s, int n);
 
 HASH *hash_create (int nelem);
 int hash_string (const unsigned char *s, int n);
-int hash_insert (HASH * table, const char *key, const void *data, int allow_dup);
+int hash_insert (HASH * table, const char *key, void *data, int allow_dup);
 HASH *hash_resize (HASH * table, int nelem);
 void *hash_find_hash (const HASH * table, int hash, const char *key);
 void hash_delete_hash (HASH * table, int hash, const char *key,
 HASH *hash_resize (HASH * table, int nelem);
 void *hash_find_hash (const HASH * table, int hash, const char *key);
 void hash_delete_hash (HASH * table, int hash, const char *key,
index bd83a43..716a5df 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
@@ -48,7 +48,7 @@ int mutt_is_subscribed_list (ADDRESS * addr)
  * return 1.  Otherwise, simply return 0.
  */
 static int
  * return 1.  Otherwise, simply return 0.
  */
 static int
-check_for_mailing_list (ADDRESS * adr, char *pfx, char *buf, int buflen)
+check_for_mailing_list (ADDRESS * adr, const char *pfx, char *buf, int buflen)
 {
   for (; adr; adr = adr->next) {
     if (mutt_is_subscribed_list (adr)) {
 {
   for (; adr; adr = adr->next) {
     if (mutt_is_subscribed_list (adr)) {
diff --git a/help.c b/help.c
index b9b896a..0545777 100644 (file)
--- a/help.c
+++ b/help.c
@@ -281,7 +281,7 @@ void mutt_help (int menu)
 {
   char t[_POSIX_PATH_MAX];
   char buf[SHORT_STRING];
 {
   char t[_POSIX_PATH_MAX];
   char buf[SHORT_STRING];
-  char *desc;
+  const char *desc;
   FILE *f;
   struct binding_t *funcs;
 
   FILE *f;
   struct binding_t *funcs;
 
index d61d0ce..66559c0 100644 (file)
--- a/history.c
+++ b/history.c
@@ -79,7 +79,7 @@ void mutt_history_add (history_class_t hclass, const char *s)
   h->cur = h->last;             /* reset to the last entry */
 }
 
   h->cur = h->last;             /* reset to the last entry */
 }
 
-char *mutt_history_next (history_class_t hclass)
+const char *mutt_history_next (history_class_t hclass)
 {
   int next;
   struct history *h = &History[hclass];
 {
   int next;
   struct history *h = &History[hclass];
@@ -94,7 +94,7 @@ char *mutt_history_next (history_class_t hclass)
   return (h->hist[h->cur] ? h->hist[h->cur] : "");
 }
 
   return (h->hist[h->cur] ? h->hist[h->cur] : "");
 }
 
-char *mutt_history_prev (history_class_t hclass)
+const char *mutt_history_prev (history_class_t hclass)
 {
   int prev;
   struct history *h = &History[hclass];
 {
   int prev;
   struct history *h = &History[hclass];
index aa4038e..c053b96 100644 (file)
--- a/history.h
+++ b/history.h
@@ -26,7 +26,7 @@ typedef enum history_class history_class_t;
 
 void mutt_init_history (void);
 void mutt_history_add (history_class_t, const char *);
 
 void mutt_init_history (void);
 void mutt_history_add (history_class_t, const char *);
-char *mutt_history_next (history_class_t);
-char *mutt_history_prev (history_class_t);
+const char *mutt_history_next (history_class_t);
+const char *mutt_history_prev (history_class_t);
 
 #endif
 
 #endif
diff --git a/init.c b/init.c
index e8c3b0a..6ac482f 100644 (file)
--- a/init.c
+++ b/init.c
@@ -206,7 +206,7 @@ static int bool_from_string (struct option_t* dst, const char* val,
 static void num_to_string (char* dst, size_t dstlen,
                            struct option_t* option) {
   /* XXX puke */
 static void num_to_string (char* dst, size_t dstlen,
                            struct option_t* option) {
   /* XXX puke */
-  const char* fmt = (str_cmp (option->option, "umask") == 0) ? 
+  const char* fmt = (str_cmp (option->option, "umask") == 0) ?
                     "%s=%04o" : "%s=%d";
   snprintf (dst, dstlen, fmt, option->option,
             *((short*) option->data));
                     "%s=%04o" : "%s=%d";
   snprintf (dst, dstlen, fmt, option->option,
             *((short*) option->data));
@@ -277,8 +277,8 @@ static void sys_to_string (char* dst, size_t dstlen,
      * if name starts with $folder, just strip it to keep hierarchy
      * $folder=imap://host, path=imap://host/inbox/b -> inbox/b
      */
      * if name starts with $folder, just strip it to keep hierarchy
      * $folder=imap://host, path=imap://host/inbox/b -> inbox/b
      */
-    if (Maildirlength > 0 && str_ncmp (CurrentFolder, Maildir, 
-                                      Maildirlength) == 0 && 
+    if (Maildirlength > 0 && str_ncmp (CurrentFolder, Maildir,
+                                      Maildirlength) == 0 &&
        str_len (CurrentFolder) > Maildirlength) {
      val = CurrentFolder + Maildirlength;
      if (Maildir[strlen(Maildir)-1]!='/')
        str_len (CurrentFolder) > Maildirlength) {
      val = CurrentFolder + Maildirlength;
      if (Maildir[strlen(Maildir)-1]!='/')
@@ -379,15 +379,14 @@ static int quad_from_string (struct option_t* dst, const char* val,
 static void sort_to_string (char* dst, size_t dstlen,
                             struct option_t* option) {
   const struct mapping_t *map = get_sortmap (option);
 static void sort_to_string (char* dst, size_t dstlen,
                             struct option_t* option) {
   const struct mapping_t *map = get_sortmap (option);
-  char* p = NULL;
+  const char *p = NULL;
 
   if (!map) {
     snprintf (dst, sizeof (dst), "%s=unknown", option->option);
     return;
   }
 
 
   if (!map) {
     snprintf (dst, sizeof (dst), "%s=unknown", option->option);
     return;
   }
 
-  p = mutt_getnamebyvalue (*((short *) option->data) & SORT_MASK,
-                           map);
+  p = mutt_getnamebyvalue(*((short *)option->data) & SORT_MASK, map);
 
   snprintf (dst, dstlen, "%s=%s%s%s", option->option,
             (*((short *) option->data) & SORT_REVERSE) ?
 
   snprintf (dst, dstlen, "%s=%s%s%s", option->option,
             (*((short *) option->data) & SORT_REVERSE) ?
@@ -1103,9 +1102,9 @@ static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata,
 
     if (!buf->data || *buf->data == '\0')
       continue;
 
     if (!buf->data || *buf->data == '\0')
       continue;
-    
+
     a = mem_malloc(sizeof(ATTACH_MATCH));
     a = mem_malloc(sizeof(ATTACH_MATCH));
-    
+
     /* some cheap hacks that I expect to remove */
     if (!str_casecmp(buf->data, "any"))
       a->major = str_dup("*/.*");
     /* some cheap hacks that I expect to remove */
     if (!str_casecmp(buf->data, "any"))
       a->major = str_dup("*/.*");
@@ -1113,7 +1112,7 @@ static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata,
       a->major = str_dup("cheap_hack/this_should_never_match");
     else
       a->major = str_dup(buf->data);
       a->major = str_dup("cheap_hack/this_should_never_match");
     else
       a->major = str_dup(buf->data);
-    
+
     if ((p = strchr(a->major, '/'))) {
       *p = '\0';
       ++p;
     if ((p = strchr(a->major, '/'))) {
       *p = '\0';
       ++p;
@@ -1128,10 +1127,10 @@ static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata,
     tmpminor[0] = '^';
     tmpminor[len+1] = '$';
     tmpminor[len+2] = '\0';
     tmpminor[0] = '^';
     tmpminor[len+1] = '$';
     tmpminor[len+2] = '\0';
-    
+
     a->major_int = mutt_check_mime_type(a->major);
     regcomp(&a->minor_rx, tmpminor, REG_ICASE|REG_EXTENDED);
     a->major_int = mutt_check_mime_type(a->major);
     regcomp(&a->minor_rx, tmpminor, REG_ICASE|REG_EXTENDED);
-    
+
     mem_free (&tmpminor);
 
     debug_print (5, ("parse_attach_list: added %s/%s [%d]\n",
     mem_free (&tmpminor);
 
     debug_print (5, ("parse_attach_list: added %s/%s [%d]\n",
@@ -1162,14 +1161,14 @@ static int parse_unattach_list (BUFFER *buf, BUFFER *s, LIST **ldata, BUFFER *er
 
   do {
     mutt_extract_token (buf, s, 0);
 
   do {
     mutt_extract_token (buf, s, 0);
-    
+
     if (!str_casecmp(buf->data, "any"))
       tmp = str_dup("*/.*");
     else if (!str_casecmp(buf->data, "none"))
       tmp = str_dup("cheap_hack/this_should_never_match");
     else
       tmp = str_dup(buf->data);
     if (!str_casecmp(buf->data, "any"))
       tmp = str_dup("*/.*");
     else if (!str_casecmp(buf->data, "none"))
       tmp = str_dup("cheap_hack/this_should_never_match");
     else
       tmp = str_dup(buf->data);
-    
+
     if ((minor = strchr(tmp, '/'))) {
       *minor = '\0';
       ++minor;
     if ((minor = strchr(tmp, '/'))) {
       *minor = '\0';
       ++minor;
@@ -1177,7 +1176,7 @@ static int parse_unattach_list (BUFFER *buf, BUFFER *s, LIST **ldata, BUFFER *er
       minor = "unknown";
     }
     major = mutt_check_mime_type(tmp);
       minor = "unknown";
     }
     major = mutt_check_mime_type(tmp);
-    
+
     /* We must do our own walk here because remove_from_list() will only
      * remove the LIST->data, not anything pointed to by the LIST->data. */
     lastp = NULL;
     /* We must do our own walk here because remove_from_list() will only
      * remove the LIST->data, not anything pointed to by the LIST->data. */
     lastp = NULL;
@@ -1190,26 +1189,26 @@ static int parse_unattach_list (BUFFER *buf, BUFFER *s, LIST **ldata, BUFFER *er
                         a->major, a->minor, a->major_int));
         regfree(&a->minor_rx);
         mem_free(&a->major);
                         a->major, a->minor, a->major_int));
         regfree(&a->minor_rx);
         mem_free(&a->major);
-        
+
         /* Relink backward */
         if (lastp)
           lastp->next = lp->next;
         else
           *ldata = lp->next;
         /* Relink backward */
         if (lastp)
           lastp->next = lp->next;
         else
           *ldata = lp->next;
-        
+
         newlp = lp->next;
         mem_free(&lp->data); /* same as a */
         mem_free(&lp);
         lp = newlp;
         continue;
       }
         newlp = lp->next;
         mem_free(&lp->data); /* same as a */
         mem_free(&lp);
         lp = newlp;
         continue;
       }
-        
+
       lastp = lp;
       lp = lp->next;
     }
   }
   while (MoreArgs (s));
       lastp = lp;
       lp = lp->next;
     }
   }
   while (MoreArgs (s));
-  
+
   mem_free (&tmp);
   _attachments_clean();
   return 0;
   mem_free (&tmp);
   _attachments_clean();
   return 0;
@@ -1222,23 +1221,23 @@ static int print_attach_list (LIST *lp, char op, const char *name) {
            ((ATTACH_MATCH *)lp->data)->minor);
     lp = lp->next;
   }
            ((ATTACH_MATCH *)lp->data)->minor);
     lp = lp->next;
   }
-  
+
   return 0;
 }
 
 static int parse_attachments (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) {
   char op, *category;
   LIST **listp;
   return 0;
 }
 
 static int parse_attachments (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) {
   char op, *category;
   LIST **listp;
-  
+
   mutt_extract_token(buf, s, 0);
   if (!buf->data || *buf->data == '\0') {
     strfcpy(err->data, _("attachments: no disposition"), err->dsize);
     return -1;
   }
   mutt_extract_token(buf, s, 0);
   if (!buf->data || *buf->data == '\0') {
     strfcpy(err->data, _("attachments: no disposition"), err->dsize);
     return -1;
   }
+
   category = buf->data;
   op = *category++;
   category = buf->data;
   op = *category++;
-  
+
   if (op == '?') {
     mutt_endwin (NULL);
     fflush (stdout);
   if (op == '?') {
     mutt_endwin (NULL);
     fflush (stdout);
@@ -1272,20 +1271,20 @@ static int parse_attachments (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER
     strfcpy(err->data, _("attachments: invalid disposition"), err->dsize);
     return -1;
   }
     strfcpy(err->data, _("attachments: invalid disposition"), err->dsize);
     return -1;
   }
-  
+
   return parse_attach_list(buf, s, listp, err);
 }
 
 static int parse_unattachments (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) {
   char op, *p;
   LIST **listp;
   return parse_attach_list(buf, s, listp, err);
 }
 
 static int parse_unattachments (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) {
   char op, *p;
   LIST **listp;
-  
+
   mutt_extract_token(buf, s, 0);
   if (!buf->data || *buf->data == '\0') {
     strfcpy(err->data, _("unattachments: no disposition"), err->dsize);
     return -1;
   }
   mutt_extract_token(buf, s, 0);
   if (!buf->data || *buf->data == '\0') {
     strfcpy(err->data, _("unattachments: no disposition"), err->dsize);
     return -1;
   }
-  
+
   p = buf->data;
   op = *p++;
   if (op != '+' && op != '-') {
   p = buf->data;
   op = *p++;
   if (op != '+' && op != '-') {
@@ -1308,7 +1307,7 @@ static int parse_unattachments (BUFFER *buf, BUFFER *s, unsigned long data, BUFF
     strfcpy(err->data, _("unattachments: invalid disposition"), err->dsize);
     return -1;
   }
     strfcpy(err->data, _("unattachments: invalid disposition"), err->dsize);
     return -1;
   }
-  
+
   return parse_unattach_list(buf, s, listp, err);
 }
 
   return parse_unattach_list(buf, s, listp, err);
 }
 
@@ -1853,7 +1852,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
     mutt_extract_token (tmp, s, M_TOKEN_EQUAL);
 
     /* resolve synonyms */
     mutt_extract_token (tmp, s, M_TOKEN_EQUAL);
 
     /* resolve synonyms */
-    if ((option = hash_find (ConfigOptions, tmp->data)) != NULL && 
+    if ((option = hash_find (ConfigOptions, tmp->data)) != NULL &&
         DTYPE (option->type == DT_SYN)) {
       struct option_t* newopt = hash_find (ConfigOptions, (char*) option->data);
       syn_add (newopt, option);
         DTYPE (option->type == DT_SYN)) {
       struct option_t* newopt = hash_find (ConfigOptions, (char*) option->data);
       syn_add (newopt, option);
@@ -2205,13 +2204,13 @@ finish:
 
 #define NUMVARS (sizeof (MuttVars)/sizeof (MuttVars[0]))
 #define NUMCOMMANDS (sizeof (Commands)/sizeof (Commands[0]))
 
 #define NUMVARS (sizeof (MuttVars)/sizeof (MuttVars[0]))
 #define NUMCOMMANDS (sizeof (Commands)/sizeof (Commands[0]))
-/* initial string that starts completion. No telling how much crap 
+/* initial string that starts completion. No telling how much crap
  * the user has typed so far. Allocate LONG_STRING just to be sure! */
 char User_typed[LONG_STRING] = { 0 };
 
 int Num_matched = 0;            /* Number of matches for completion */
 char Completed[STRING] = { 0 }; /* completed string (command or variable) */
  * the user has typed so far. Allocate LONG_STRING just to be sure! */
 char User_typed[LONG_STRING] = { 0 };
 
 int Num_matched = 0;            /* Number of matches for completion */
 char Completed[STRING] = { 0 }; /* completed string (command or variable) */
-char *Matches[MAX (NUMVARS, NUMCOMMANDS) + 1];  /* all the matches + User_typed */
+const char *Matches[MAX (NUMVARS, NUMCOMMANDS) + 1];  /* all the matches + User_typed */
 
 /* helper function for completion.  Changes the dest buffer if
    necessary/possible to aid completion.
 
 /* helper function for completion.  Changes the dest buffer if
    necessary/possible to aid completion.
@@ -2429,7 +2428,7 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
         snprintf (tmp, sizeof (tmp), "%d", (*((short *) option->data)));
       else if (DTYPE (option->type) == DT_SORT) {
         const struct mapping_t *map;
         snprintf (tmp, sizeof (tmp), "%d", (*((short *) option->data)));
       else if (DTYPE (option->type) == DT_SORT) {
         const struct mapping_t *map;
-        char *p;
+        const char *p;
 
         switch (option->type & DT_SUBTYPE_MASK) {
         case DT_SORT_ALIAS:
 
         switch (option->type & DT_SUBTYPE_MASK) {
         case DT_SORT_ALIAS:
@@ -2448,15 +2447,11 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
           map = SortMethods;
           break;
         }
           map = SortMethods;
           break;
         }
-        p =
-          mutt_getnamebyvalue (*((short *) option->data) & SORT_MASK,
-                               map);
-        snprintf (tmp, sizeof (tmp), "%s%s%s",
-                  (*((short *) option->data) & SORT_REVERSE) ?
-                  "reverse-" : "",
-                  (*((short *) option->data) & SORT_LAST) ? "last-" :
-                  "", p);
-      } 
+        p = mutt_getnamebyvalue(*((short *) option->data) & SORT_MASK, map);
+        snprintf(tmp, sizeof (tmp), "%s%s%s",
+                 (*((short *)option->data) & SORT_REVERSE) ? "reverse-" : "",
+                 (*((short *)option->data) & SORT_LAST) ? "last-" : "", p);
+      }
       else if (DTYPE (option->type) == DT_MAGIC) {
         const char *p;
         switch (DefaultMagic) {
       else if (DTYPE (option->type) == DT_MAGIC) {
         const char *p;
         switch (DefaultMagic) {
@@ -2582,7 +2577,7 @@ void mutt_init (int skip_sys_rc, LIST * commands)
   err.data = error;
   err.dsize = sizeof (error);
 
   err.data = error;
   err.dsize = sizeof (error);
 
-  /* use 3*sizeof(muttvars) instead of 2*sizeof() 
+  /* use 3*sizeof(muttvars) instead of 2*sizeof()
    * to have some room for $user_ vars */
   ConfigOptions = hash_create (sizeof (MuttVars) * 3);
   for (i = 0; MuttVars[i].option; i++) {
    * to have some room for $user_ vars */
   ConfigOptions = hash_create (sizeof (MuttVars) * 3);
   for (i = 0; MuttVars[i].option; i++) {
@@ -2594,7 +2589,7 @@ void mutt_init (int skip_sys_rc, LIST * commands)
                                DT_SYS, 0), 0);
   }
 
                                DT_SYS, 0), 0);
   }
 
-  /* 
+  /*
    * XXX - use something even more difficult to predict?
    */
   snprintf (AttachmentMarker, sizeof (AttachmentMarker),
    * XXX - use something even more difficult to predict?
    */
   snprintf (AttachmentMarker, sizeof (AttachmentMarker),
@@ -2667,9 +2662,9 @@ void mutt_init (int skip_sys_rc, LIST * commands)
     if ((f = safe_fopen (SYSCONFDIR "/nntpserver", "r"))) {
       buffer[0] = '\0';
       fgets (buffer, sizeof (buffer), f);
     if ((f = safe_fopen (SYSCONFDIR "/nntpserver", "r"))) {
       buffer[0] = '\0';
       fgets (buffer, sizeof (buffer), f);
-      p = (char*)&buffer;
+      p = buffer;
       SKIPWS (p);
       SKIPWS (p);
-      q = p;
+      q = (char*)p;
       while (*q && !isspace(*q))
         q++;
       *q = '\0';
       while (*q && !isspace(*q))
         q++;
       *q = '\0';
@@ -2762,13 +2757,13 @@ void mutt_init (int skip_sys_rc, LIST * commands)
 
 
   /*
 
 
   /*
-   * 
+   *
    *                       BIG FAT WARNING
    *                       BIG FAT WARNING
-   * 
+   *
    * When changing the code which looks for a configuration file,
    * please also change the corresponding code in muttbug.sh.in.
    * When changing the code which looks for a configuration file,
    * please also change the corresponding code in muttbug.sh.in.
-   * 
-   * 
+   *
+   *
    */
 
 
    */
 
 
index 2219c68..6a7f5c1 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -137,7 +137,7 @@ static int parse_keycode (const char *s)
   return -1;
 }
 
   return -1;
 }
 
-static int parsekeys (char *str, keycode_t * d, int max)
+static int parsekeys (const char *str, keycode_t * d, int max)
 {
   int n, len = max;
   char buff[SHORT_STRING];
 {
   int n, len = max;
   char buff[SHORT_STRING];
@@ -259,7 +259,7 @@ static int get_op (struct binding_t *bindings, const char *start, size_t len)
   return OP_NULL;
 }
 
   return OP_NULL;
 }
 
-static char *get_func (struct binding_t *bindings, int op)
+static const char *get_func (struct binding_t *bindings, int op)
 {
   int i;
 
 {
   int i;
 
@@ -457,7 +457,7 @@ static void create_bindings (struct binding_t *map, int menu)
 char *km_keyname (int c)
 {
   static char buf[10];
 char *km_keyname (int c)
 {
   static char buf[10];
-  char *p;
+  const char *p;
 
   if ((p = mutt_getnamebyvalue (c, KeyNames)))
     return p;
 
   if ((p = mutt_getnamebyvalue (c, KeyNames)))
     return p;
index 3d39aab..8d64d35 100644 (file)
@@ -121,7 +121,7 @@ void convert_to_7bit (BODY *);
 /*-- crypt.c --*/
 
 /* Print the current time. */
 /*-- crypt.c --*/
 
 /* Print the current time. */
-void crypt_current_time (STATE * s, char *app_name);
+void crypt_current_time (STATE * s, const char *app_name);
 
 /* Check out the type of encryption used and set the cached status
    values if there are any. */
 
 /* Check out the type of encryption used and set the cached status
    values if there are any. */
index 94783ae..6b6f0ea 100644 (file)
@@ -362,12 +362,12 @@ void mutt_sasl_setup_conn (CONNECTION * conn, sasl_conn_t * saslconn)
 
   sasldata->saslconn = saslconn;
   /* get ssf so we know whether we have to (en|de)code read/write */
 
   sasldata->saslconn = saslconn;
   /* get ssf so we know whether we have to (en|de)code read/write */
-  sasl_getprop (saslconn, SASL_SSF, (const void **) &sasldata->ssf);
+  sasl_getprop (saslconn, SASL_SSF, (const void **)(void *)&sasldata->ssf);
   debug_print (3, ("SASL protection strength: %u\n", *sasldata->ssf));
   /* Add SASL SSF to transport SSF */
   conn->ssf += *sasldata->ssf;
   sasl_getprop (saslconn, SASL_MAXOUTBUF,
   debug_print (3, ("SASL protection strength: %u\n", *sasldata->ssf));
   /* Add SASL SSF to transport SSF */
   conn->ssf += *sasldata->ssf;
   sasl_getprop (saslconn, SASL_MAXOUTBUF,
-                (const void **) &sasldata->pbufsize);
+                (const void **)(void *)&sasldata->pbufsize);
   debug_print (3, ("SASL protection buffer size: %u\n", *sasldata->pbufsize));
 
   /* clear input buffer */
   debug_print (3, ("SASL protection buffer size: %u\n", *sasldata->pbufsize));
 
   /* clear input buffer */
index 640f080..3804817 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -581,7 +581,7 @@ static pgp_key_t pgp_select_key (pgp_key_t keys, ADDRESS * p, const char *s)
       if (option (OPTPGPCHECKTRUST) &&
           (!pgp_id_is_valid (KeyTable[menu->current])
            || !pgp_id_is_strong (KeyTable[menu->current]))) {
       if (option (OPTPGPCHECKTRUST) &&
           (!pgp_id_is_valid (KeyTable[menu->current])
            || !pgp_id_is_strong (KeyTable[menu->current]))) {
-        char *s = "";
+        const char *s = "";
         char buff[LONG_STRING];
 
         if (KeyTable[menu->current]->flags & KEYFLAG_CANTUSE)
         char buff[LONG_STRING];
 
         if (KeyTable[menu->current]->flags & KEYFLAG_CANTUSE)
index 8f934b4..79d0c12 100644 (file)
@@ -484,7 +484,7 @@ void mix_make_chain (LIST ** chainp, int *redraw)
   int op;
 
   int i, j;
   int op;
 
   int i, j;
-  char *t;
+  const char *t;
 
   if (!(type2_list = mix_type2_list (&ttll))) {
     mutt_error _("Can't get mixmaster's type2.list!");
 
   if (!(type2_list = mix_type2_list (&ttll))) {
     mutt_error _("Can't get mixmaster's type2.list!");
index a81a849..e173254 100644 (file)
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -357,7 +357,7 @@ static int rfc2047_encode (const char *d, size_t dlen, int col,
   encoder_t encoder;
   char *tocode1 = 0;
   const char *tocode;
   encoder_t encoder;
   char *tocode1 = 0;
   const char *tocode;
-  char *icode = "UTF-8";
+  const char *icode = "UTF-8";
 
   /* Try to convert to UTF-8. */
   if (convert_string (d, dlen, fromcode, icode, &u, &ulen)) {
 
   /* Try to convert to UTF-8. */
   if (convert_string (d, dlen, fromcode, icode, &u, &ulen)) {
@@ -520,7 +520,7 @@ void _rfc2047_encode_string (char **pd, int encode_specials, int col)
 {
   char *e;
   size_t elen;
 {
   char *e;
   size_t elen;
-  char *charsets;
+  const char *charsets;
 
   if (!Charset || !*pd)
     return;
 
   if (!Charset || !*pd)
     return;
index d55cd55..7c8ab2b 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1612,19 +1612,13 @@ int mutt_write_rfc822_header (FILE * fp, ENVELOPE * env, BODY * attach,
   }
 
   if (mode == 0 && !privacy && option (OPTXMAILER) && !has_agent) {
   }
 
   if (mode == 0 && !privacy && option (OPTXMAILER) && !has_agent) {
-    struct utsname un;
-    char *os;
+    const char *os;
 
     if (OperatingSystem != NULL) {
       os = OperatingSystem;
 
     if (OperatingSystem != NULL) {
       os = OperatingSystem;
-    }
-    else {
-      if (uname (&un) == -1) {
-        os = "UNIX";
-      }
-      else {
-        os = un.sysname;
-      }
+    } else {
+      struct utsname un;
+      os = (uname(&un) == -1) ? "UNIX" : un.sysname;
     }
     /* Add a vanity header */
     fprintf (fp, "User-Agent: %s (%s)\n", mutt_make_version (0), os);
     }
     /* Add a vanity header */
     fprintf (fp, "User-Agent: %s (%s)\n", mutt_make_version (0), os);
@@ -1964,7 +1958,7 @@ static char **add_args (char **args, size_t * argslen, size_t * argsmax,
   return (args);
 }
 
   return (args);
 }
 
-static char **add_option(char **args, size_t * argslen, size_t * argsmax,
+static char **add_option(const char **args, size_t * argslen, size_t * argsmax,
                          const char *s)
 {
     if (*argslen == *argsmax) {
                          const char *s)
 {
     if (*argslen == *argsmax) {
diff --git a/smime.c b/smime.c
index 803e717..cba7100 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -303,7 +303,7 @@ static void smime_entry (char *s, size_t l, MUTTMENU * menu, int num)
 {
   smime_id *Table = (smime_id *) menu->data;
   smime_id this = Table[num];
 {
   smime_id *Table = (smime_id *) menu->data;
   smime_id this = Table[num];
-  char *truststate;
+  const char *truststate;
 
   switch (this.trust) {
   case 't':
 
   switch (this.trust) {
   case 't':
diff --git a/xterm.c b/xterm.c
index 1b2d852..5ce9a81 100644 (file)
--- a/xterm.c
+++ b/xterm.c
@@ -7,14 +7,14 @@
 #include "xterm.h"
 #include "lib/str.h"
 
 #include "xterm.h"
 #include "lib/str.h"
 
-void mutt_xterm_set_title (char *title) {
+void mutt_xterm_set_title (const char *title) {
   fputs ("\033]2;", stdout);
   fputs (NONULL (title), stdout);
   fputs ("\007", stdout);
   fflush (stdout);
 }
 
   fputs ("\033]2;", stdout);
   fputs (NONULL (title), stdout);
   fputs ("\007", stdout);
   fflush (stdout);
 }
 
-void mutt_xterm_set_icon (char *name) {
+void mutt_xterm_set_icon (const char *name) {
   fputs ("\033]1;", stdout);
   fputs (NONULL (name), stdout);
   fputs ("\007", stdout);
   fputs ("\033]1;", stdout);
   fputs (NONULL (name), stdout);
   fputs ("\007", stdout);
diff --git a/xterm.h b/xterm.h
index 62a8d7f..0e8f970 100644 (file)
--- a/xterm.h
+++ b/xterm.h
@@ -7,9 +7,9 @@
 #define MUTT_XTERM_H
 
 /* sets the current xterm's title */
 #define MUTT_XTERM_H
 
 /* sets the current xterm's title */
-void mutt_xterm_set_title (char *title);
+void mutt_xterm_set_title(const char *title);
 
 /* sets the current xterm's icon */
 
 /* sets the current xterm's icon */
-void mutt_xterm_set_icon (char *name);
+void mutt_xterm_set_icon(const char *name);
 
 #endif /* !MUTT_XTERM_H */
 
 #endif /* !MUTT_XTERM_H */