a whole lot of size_t -> ssize_t.
authorPierre Habouzit <madcoder@debian.org>
Mon, 13 Nov 2006 10:20:19 +0000 (11:20 +0100)
committerPierre Habouzit <madcoder@debian.org>
Mon, 13 Nov 2006 10:20:19 +0000 (11:20 +0100)
remove old cruft too.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
59 files changed:
base64.c
browser.c
browser.h
charset.c
charset.h
commands.c
complete.c
compose.c
editmsg.c
from.c
hcache.c
hdrline.c
headers.c
help.c
hook.c
imap/browse.c
imap/imap.c
imap/imap_private.h
imap/message.c
imap/message.h
imap/utf7.c
imap/util.c
init.c
lib-crypt/crypt-gpgme.c
lib-crypt/pgp.c
lib-crypt/pgpinvoke.c
lib-crypt/pgpkey.c
lib-crypt/pgppacket.c
lib-crypt/smime.c
lib-lib/buffer.c
lib-lib/buffer.h
lib-lib/file.c
lib-lib/file.h
lib-sys/mutt_socket.c
lib-sys/mutt_socket.h
lib-sys/mutt_ssl_gnutls.c
lib-ui/curs_lib.c
main.c
mh.c
mutt_sasl.c
mutt_sasl.h
muttlib.c
mx.c
nntp/newsrc.c
nntp/nntp.c
nntp/nntp.h
pattern.c
pop/pop.c
pop/pop.h
pop/pop_auth.c
pop/pop_lib.c
postpone.c
protos.h
query.c
recvattach.c
recvattach.h
rfc1524.c
rfc1524.h
sendlib.c

index 0b72009..a5e6cf3 100644 (file)
--- a/base64.c
+++ b/base64.c
@@ -48,8 +48,8 @@
 #include "mutt.h"
 
 /* raw bytes to null-terminated base 64 string */
 #include "mutt.h"
 
 /* raw bytes to null-terminated base 64 string */
-void mutt_to_base64 (unsigned char *out, const unsigned char *in, size_t len,
-                     size_t olen)
+void mutt_to_base64 (unsigned char *out, const unsigned char *in, ssize_t len,
+                     ssize_t olen)
 {
   while (len >= 3 && olen > 10) {
     *out++ = __m_b64chars[in[0] >> 2];
 {
   while (len >= 3 && olen > 10) {
     *out++ = __m_b64chars[in[0] >> 2];
index c6ee31b..69351d0 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -77,7 +77,7 @@ static char LastDirBackup[_POSIX_PATH_MAX] = "";
 /* Frees up the memory allocated for the local-global variables.  */
 static void destroy_state (struct browser_state *state)
 {
 /* Frees up the memory allocated for the local-global variables.  */
 static void destroy_state (struct browser_state *state)
 {
-  unsigned int c;
+  int c;
 
   for (c = 0; c < state->entrylen; c++) {
     p_delete(&((state->entry)[c].name));
 
   for (c = 0; c < state->entrylen; c++) {
     p_delete(&((state->entry)[c].name));
@@ -160,7 +160,7 @@ static int link_is_dir (const char *folder, const char *path)
     return 0;
 }
 
     return 0;
 }
 
-static const char *folder_format_str (char *dest, size_t destlen, char op,
+static const char *folder_format_str (char *dest, ssize_t destlen, char op,
                                       const char *src, const char *fmt,
                                       const char *ifstring,
                                       const char *elsestring,
                                       const char *src, const char *fmt,
                                       const char *ifstring,
                                       const char *elsestring,
@@ -324,7 +324,7 @@ static const char *folder_format_str (char *dest, size_t destlen, char op,
 }
 
 #ifdef USE_NNTP
 }
 
 #ifdef USE_NNTP
-static const char *newsgroup_format_str (char *dest, size_t destlen, char op,
+static const char *newsgroup_format_str (char *dest, ssize_t destlen, char op,
                                          const char *src, const char *fmt,
                                          const char *ifstring,
                                          const char *elsestring,
                                          const char *src, const char *fmt,
                                          const char *ifstring,
                                          const char *elsestring,
@@ -653,7 +653,7 @@ static int select_file_search (MUTTMENU * menu, regex_t * re, int n)
           (re, ((struct folder_file *) menu->data)[n].name, 0, NULL, 0));
 }
 
           (re, ((struct folder_file *) menu->data)[n].name, 0, NULL, 0));
 }
 
-static void folder_entry (char *s, size_t slen, MUTTMENU * menu, int num)
+static void folder_entry (char *s, ssize_t slen, MUTTMENU * menu, int num)
 {
   FOLDER folder;
 
 {
   FOLDER folder;
 
@@ -671,7 +671,7 @@ static void folder_entry (char *s, size_t slen, MUTTMENU * menu, int num)
 }
 
 static void init_menu (struct browser_state *state, MUTTMENU * menu,
 }
 
 static void init_menu (struct browser_state *state, MUTTMENU * menu,
-                       char *title, size_t titlelen, int buffy)
+                       char *title, ssize_t titlelen, int buffy)
 {
   char path[_POSIX_PATH_MAX];
 
 {
   char path[_POSIX_PATH_MAX];
 
@@ -729,7 +729,7 @@ static int file_tag (MUTTMENU * menu, int n, int m)
   return ff->tagged - ot;
 }
 
   return ff->tagged - ot;
 }
 
-void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
+void _mutt_select_file (char *f, ssize_t flen, int flags, char ***files,
                         int *numfiles)
 {
   char buf[_POSIX_PATH_MAX];
                         int *numfiles)
 {
   char buf[_POSIX_PATH_MAX];
@@ -918,7 +918,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
             url_parse_ciss (&url, state.entry[menu->current].name);
             if (url.path &&
                 (state.entry[menu->current].delim != '\0') &&
             url_parse_ciss (&url, state.entry[menu->current].name);
             if (url.path &&
                 (state.entry[menu->current].delim != '\0') &&
-                (n < sizeof (LastDir))) {
+                (n < ssizeof (LastDir))) {
               LastDir[n] = '\0';
               LastDir[n - 1] = state.entry[menu->current].delim;
             }
               LastDir[n] = '\0';
               LastDir[n - 1] = state.entry[menu->current].delim;
             }
@@ -981,7 +981,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
       if (multiple) {
         char **tfiles;
         int j;
       if (multiple) {
         char **tfiles;
         int j;
-        unsigned int h;
+        int h;
 
         if (menu->tagged) {
           *numfiles = menu->tagged;
 
         if (menu->tagged) {
           *numfiles = menu->tagged;
@@ -1112,9 +1112,9 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
       if (!state.imap_browse)
       {
         /* add '/' at the end of the directory name if not already there */
       if (!state.imap_browse)
       {
         /* add '/' at the end of the directory name if not already there */
-        size_t len = m_strlen(LastDir);
+        ssize_t len = m_strlen(LastDir);
 
 
-        if (len && LastDir[len - 1] != '/' && sizeof (buf) > len)
+        if (len && LastDir[len - 1] != '/' && ssizeof(buf) > len)
           buf[len] = '/';
       }
 
           buf[len] = '/';
       }
 
index 5edd06f..91764b6 100644 (file)
--- a/browser.h
+++ b/browser.h
@@ -37,8 +37,8 @@ struct folder_file {
 
 struct browser_state {
   struct folder_file *entry;
 
 struct browser_state {
   struct folder_file *entry;
-  unsigned int entrylen;        /* number of real entries */
-  unsigned int entrymax;        /* max entry */
+  int entrylen;        /* number of real entries */
+  int entrymax;        /* max entry */
   short imap_browse;
   char *folder;
   unsigned noselect:1;
   short imap_browse;
   char *folder;
   unsigned noselect:1;
index 08c4b0f..0652ffc 100644 (file)
--- a/charset.c
+++ b/charset.c
@@ -212,9 +212,9 @@ void mutt_set_langinfo_charset (void)
 
 #endif
 
 
 #endif
 
-void mutt_canonical_charset (char *dest, size_t dlen, const char *name)
+void mutt_canonical_charset (char *dest, ssize_t dlen, const char *name)
 {
 {
-  size_t i;
+  ssize_t i;
   char *p;
   char scratch[LONG_STRING];
 
   char *p;
   char scratch[LONG_STRING];
 
@@ -297,19 +297,19 @@ iconv_t mutt_iconv_open (const char *tocode, const char *fromcode, int flags)
  * if you're supplying an outrepl, the target charset should be.
  */
 
  * if you're supplying an outrepl, the target charset should be.
  */
 
-size_t mutt_iconv (iconv_t cd, const char **inbuf, size_t * inbytesleft,
-                   char **outbuf, size_t * outbytesleft,
+ssize_t mutt_iconv(iconv_t cd, const char **inbuf, ssize_t *inbytesleft,
+                   char **outbuf, ssize_t *outbytesleft,
                    const char **inrepls, const char *outrepl)
 {
                    const char **inrepls, const char *outrepl)
 {
-  size_t ret = 0, ret1;
+  ssize_t ret = 0, ret1;
   const char *ib = *inbuf;
   const char *ib = *inbuf;
-  size_t ibl = *inbytesleft;
+  ssize_t ibl = *inbytesleft;
   char *ob = *outbuf;
   char *ob = *outbuf;
-  size_t obl = *outbytesleft;
+  ssize_t obl = *outbytesleft;
 
   for (;;) {
     ret1 = my_iconv(cd, &ib, &ibl, &ob, &obl);
 
   for (;;) {
     ret1 = my_iconv(cd, &ib, &ibl, &ob, &obl);
-    if (ret1 != (size_t) - 1)
+    if (ret1 != -1)
       ret += ret1;
     if (ibl && obl && errno == EILSEQ) {
       if (inrepls) {
       ret += ret1;
     if (ibl && obl && errno == EILSEQ) {
       if (inrepls) {
@@ -318,9 +318,9 @@ size_t mutt_iconv (iconv_t cd, const char **inbuf, size_t * inbytesleft,
 
         for (t = inrepls; *t; t++) {
           const char *ib1 = *t;
 
         for (t = inrepls; *t; t++) {
           const char *ib1 = *t;
-          size_t ibl1 = m_strlen(*t);
+          ssize_t ibl1 = m_strlen(*t);
           char *ob1 = ob;
           char *ob1 = ob;
-          size_t obl1 = obl;
+          ssize_t obl1 = obl;
 
           my_iconv(cd, &ib1, &ibl1, &ob1, &obl1);
           if (!ibl1) {
 
           my_iconv(cd, &ib1, &ibl1, &ob1, &obl1);
           if (!ibl1) {
@@ -338,7 +338,7 @@ size_t mutt_iconv (iconv_t cd, const char **inbuf, size_t * inbytesleft,
         outrepl = "?";
       my_iconv(cd, 0, 0, &ob, &obl);
       if (obl) {
         outrepl = "?";
       my_iconv(cd, 0, 0, &ob, &obl);
       if (obl) {
-        size_t n = m_strlen(outrepl);
+        ssize_t n = m_strlen(outrepl);
 
         if (n > obl) {
           outrepl = "?";
 
         if (n > obl) {
           outrepl = "?";
@@ -378,7 +378,7 @@ int mutt_convert_string (char **ps, const char *from, const char *to,
     int len;
     const char *ib;
     char *buf, *ob;
     int len;
     const char *ib;
     char *buf, *ob;
-    size_t ibl, obl;
+    ssize_t ibl, obl;
     const char **inrepls = NULL;
     const char *outrepl = NULL;
 
     const char **inrepls = NULL;
     const char *outrepl = NULL;
 
@@ -421,7 +421,7 @@ struct fgetconv_s {
   char *p;
   char *ob;
   char *ib;
   char *p;
   char *ob;
   char *ib;
-  size_t ibl;
+  ssize_t ibl;
   const char **inrepls;
 };
 
   const char **inrepls;
 };
 
@@ -454,10 +454,10 @@ FGETCONV *fgetconv_open (FILE * file, const char *from, const char *to,
   return (FGETCONV *) fc;
 }
 
   return (FGETCONV *) fc;
 }
 
-char *fgetconvs (char *buf, size_t l, FGETCONV * _fc)
+char *fgetconvs (char *buf, ssize_t l, FGETCONV * _fc)
 {
   int c;
 {
   int c;
-  size_t r;
+  ssize_t r;
 
   for (r = 0; r + 1 < l;) {
     if ((c = fgetconv (_fc)) == EOF)
 
   for (r = 0; r + 1 < l;) {
     if ((c = fgetconv (_fc)) == EOF)
@@ -490,7 +490,7 @@ int fgetconv (FGETCONV * _fc)
   /* Try to convert some more */
   fc->p = fc->ob = fc->bufo;
   if (fc->ibl) {
   /* Try to convert some more */
   fc->p = fc->ob = fc->bufo;
   if (fc->ibl) {
-    size_t obl = sizeof (fc->bufo);
+    ssize_t obl = ssizeof(fc->bufo);
 
     my_iconv(fc->cd, (const char **) &fc->ib, &fc->ibl, &fc->ob, &obl);
     if (fc->p < fc->ob)
 
     my_iconv(fc->cd, (const char **) &fc->ib, &fc->ibl, &fc->ob, &obl);
     if (fc->p < fc->ob)
@@ -514,7 +514,7 @@ int fgetconv (FGETCONV * _fc)
 
   /* Try harder this time to convert some */
   if (fc->ibl) {
 
   /* Try harder this time to convert some */
   if (fc->ibl) {
-    size_t obl = sizeof (fc->bufo);
+    ssize_t obl = ssizeof(fc->bufo);
 
     mutt_iconv (fc->cd, (const char **) &fc->ib, &fc->ibl, &fc->ob,
                 &obl, fc->inrepls, 0);
 
     mutt_iconv (fc->cd, (const char **) &fc->ib, &fc->ibl, &fc->ob,
                 &obl, fc->inrepls, 0);
@@ -550,19 +550,19 @@ const char *mutt_get_first_charset (const char *charset)
   return fcharset;
 }
 
   return fcharset;
 }
 
-static size_t convert_string (const char *f, size_t flen,
+static ssize_t convert_string (const char *f, ssize_t flen,
                               const char *from, const char *to,
                               const char *from, const char *to,
-                              char **t, size_t * tlen)
+                              char **t, ssize_t * tlen)
 {
   iconv_t cd;
   char *buf, *ob;
 {
   iconv_t cd;
   char *buf, *ob;
-  size_t obl;
+  ssize_t obl;
   ssize_t n;
   int e;
 
   cd = mutt_iconv_open (to, from, 0);
   if (cd == (iconv_t) (-1))
   ssize_t n;
   int e;
 
   cd = mutt_iconv_open (to, from, 0);
   if (cd == (iconv_t) (-1))
-    return (size_t) (-1);
+    return -1;
   obl = 4 * flen + 1;
   ob = buf = xmalloc(obl);
   n = my_iconv(cd, &f, &flen, &ob, &obl);
   obl = 4 * flen + 1;
   ob = buf = xmalloc(obl);
   n = my_iconv(cd, &f, &flen, &ob, &obl);
@@ -571,7 +571,7 @@ static size_t convert_string (const char *f, size_t flen,
     p_delete(&buf);
     iconv_close (cd);
     errno = e;
     p_delete(&buf);
     iconv_close (cd);
     errno = e;
-    return (size_t) (-1);
+    return -1;
   }
   *ob = '\0';
 
   }
   *ob = '\0';
 
@@ -592,9 +592,9 @@ int mutt_convert_nonmime_string (char **ps)
     char *u = *ps;
     char *s = NULL;
     char *fromcode;
     char *u = *ps;
     char *s = NULL;
     char *fromcode;
-    size_t m, n;
-    size_t ulen = m_strlen(*ps);
-    size_t slen;
+    ssize_t m, n;
+    ssize_t ulen = m_strlen(*ps);
+    ssize_t slen;
 
     if (!u || !*u)
       return 0;
 
     if (!u || !*u)
       return 0;
@@ -606,7 +606,7 @@ int mutt_convert_nonmime_string (char **ps)
     fromcode = p_dupstr(c, n);
     m = convert_string (u, ulen, fromcode, Charset, &s, &slen);
     p_delete(&fromcode);
     fromcode = p_dupstr(c, n);
     m = convert_string (u, ulen, fromcode, Charset, &s, &slen);
     p_delete(&fromcode);
-    if (m != (size_t) (-1)) {
+    if (m != -1) {
       p_delete(ps);
       *ps = s;
       return 0;
       p_delete(ps);
       *ps = s;
       return 0;
index 738cd73..fd85199 100644 (file)
--- a/charset.h
+++ b/charset.h
@@ -41,14 +41,14 @@ const char *mutt_get_first_charset (const char *);
 int mutt_convert_nonmime_string (char **);
 
 iconv_t mutt_iconv_open (const char *, const char *, int);
 int mutt_convert_nonmime_string (char **);
 
 iconv_t mutt_iconv_open (const char *, const char *, int);
-size_t mutt_iconv (iconv_t, const char **, size_t *, char **, size_t *,
-                   const char **, const char *);
+ssize_t mutt_iconv (iconv_t, const char **, ssize_t *, char **, ssize_t *,
+                    const char **, const char *);
 
 typedef void *FGETCONV;
 
 FGETCONV *fgetconv_open (FILE *, const char *, const char *, int);
 int fgetconv (FGETCONV *);
 
 typedef void *FGETCONV;
 
 FGETCONV *fgetconv_open (FILE *, const char *, const char *, int);
 int fgetconv (FGETCONV *);
-char *fgetconvs (char *, size_t, FGETCONV *);
+char *fgetconvs (char *, ssize_t, FGETCONV *);
 void fgetconv_close (FGETCONV **);
 
 void mutt_set_langinfo_charset (void);
 void fgetconv_close (FGETCONV **);
 
 void mutt_set_langinfo_charset (void);
index dc0a6f4..01ea639 100644 (file)
@@ -242,7 +242,7 @@ void ci_bounce_message (HEADER * h, int *redraw)
   char prompt[SHORT_STRING];
   char buf[HUGE_STRING] = { 0 };
   address_t *adr = NULL;
   char prompt[SHORT_STRING];
   char buf[HUGE_STRING] = { 0 };
   address_t *adr = NULL;
-  char *err = NULL;
+  const char *err = NULL;
   int rc;
 
   if (h)
   int rc;
 
   if (h)
index e1815c7..40af1a6 100644 (file)
  *
  * return 0 if ok, -1 if no matches
  */
  *
  * return 0 if ok, -1 if no matches
  */
-int mutt_complete (char *s, size_t slen)
+int mutt_complete (char *s, ssize_t slen)
 {
   char *p;
   DIR *dirp = NULL;
   struct dirent *de;
   int i, init = 0;
 {
   char *p;
   DIR *dirp = NULL;
   struct dirent *de;
   int i, init = 0;
-  size_t len;
+  ssize_t len;
   char dirpart[_POSIX_PATH_MAX], exp_dirpart[_POSIX_PATH_MAX];
   char filepart[_POSIX_PATH_MAX];
 
   char dirpart[_POSIX_PATH_MAX], exp_dirpart[_POSIX_PATH_MAX];
   char filepart[_POSIX_PATH_MAX];
 
@@ -140,7 +140,7 @@ int mutt_complete (char *s, size_t slen)
       }
       else {
         *p = 0;
       }
       else {
         *p = 0;
-        len = (size_t) (p - s);
+        len = p - s;
         memcpy(dirpart, s, len);
         dirpart[len] = 0;
         p++;
         memcpy(dirpart, s, len);
         dirpart[len] = 0;
         p++;
index 2e96e7d..4bf5cf1 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -313,7 +313,7 @@ static void draw_envelope (HEADER * msg, char *fcc)
 static int edit_address_list (int line, address_t ** addr)
 {
   char buf[HUGE_STRING] = "";   /* needs to be large for alias expansion */
 static int edit_address_list (int line, address_t ** addr)
 {
   char buf[HUGE_STRING] = "";   /* needs to be large for alias expansion */
-  char *err = NULL;
+  const char *err = NULL;
 
   mutt_addrlist_to_local (*addr);
   rfc822_write_address (buf, sizeof (buf), *addr, 0);
 
   mutt_addrlist_to_local (*addr);
   rfc822_write_address (buf, sizeof (buf), *addr, 0);
@@ -400,7 +400,7 @@ static void update_idx (MUTTMENU * menu, ATTACHPTR ** idx, short idxlen)
 
 static unsigned long cum_attachs_size (MUTTMENU * menu)
 {
 
 static unsigned long cum_attachs_size (MUTTMENU * menu)
 {
-  size_t s;
+  ssize_t s;
   unsigned short i;
   ATTACHPTR **idx = menu->data;
   CONTENT *info;
   unsigned short i;
   ATTACHPTR **idx = menu->data;
   CONTENT *info;
@@ -442,7 +442,7 @@ static unsigned long cum_attachs_size (MUTTMENU * menu)
  * help when modifying this function.
  */
 
  * help when modifying this function.
  */
 
-static const char *compose_format_str (char *buf, size_t buflen, char op,
+static const char *compose_format_str (char *buf, ssize_t buflen, char op,
                                        const char *src, const char *prefix,
                                        const char *ifstring,
                                        const char *elsestring,
                                        const char *src, const char *prefix,
                                        const char *ifstring,
                                        const char *elsestring,
@@ -508,7 +508,7 @@ static void compose_status_line (char *buf, ssize_t buflen, MUTTMENU * menu,
  */
 int mutt_compose_menu (HEADER * msg,    /* structure for new message */
                        char *fcc,       /* where to save a copy of the message */
  */
 int mutt_compose_menu (HEADER * msg,    /* structure for new message */
                        char *fcc,       /* where to save a copy of the message */
-                       size_t fcclen, HEADER * cur)
+                       ssize_t fcclen, HEADER * cur)
 {                               /* current message */
   char helpstr[SHORT_STRING];
   char buf[LONG_STRING];
 {                               /* current message */
   char helpstr[SHORT_STRING];
   char buf[LONG_STRING];
index cb6616f..f511749 100644 (file)
--- a/editmsg.c
+++ b/editmsg.c
@@ -55,7 +55,7 @@ static int edit_one_message (CONTEXT * ctx, HEADER * cur)
 
   struct stat sb;
   time_t mtime = 0;
 
   struct stat sb;
   time_t mtime = 0;
-  size_t size = 0;
+  ssize_t size = 0;
 
   mutt_mktemp (tmp);
 
 
   mutt_mktemp (tmp);
 
diff --git a/from.c b/from.c
index eafdfe6..a53944a 100644 (file)
--- a/from.c
+++ b/from.c
@@ -57,7 +57,7 @@ static int is_day_name (const char *s)
  * From [ <return-path> ] <weekday> <month> <day> <time> [ <timezone> ] <year>
  */
 
  * From [ <return-path> ] <weekday> <month> <day> <time> [ <timezone> ] <year>
  */
 
-int is_from (const char *s, char *path, size_t pathlen, time_t * tp)
+int is_from (const char *s, char *path, ssize_t pathlen, time_t * tp)
 {
   struct tm tm;
   int yr;
 {
   struct tm tm;
   int yr;
@@ -76,7 +76,7 @@ int is_from (const char *s, char *path, size_t pathlen, time_t * tp)
 
   if (!is_day_name (s)) {
     const char *p;
 
   if (!is_day_name (s)) {
     const char *p;
-    size_t len;
+    ssize_t len;
     short q = 0;
 
     for (p = s; *p && (q || !ISSPACE (*p)); p++) {
     short q = 0;
 
     for (p = s; *p && (q || !ISSPACE (*p)); p++) {
@@ -93,7 +93,7 @@ int is_from (const char *s, char *path, size_t pathlen, time_t * tp)
       return 0;
 
     if (path) {
       return 0;
 
     if (path) {
-      len = (size_t) (p - s);
+      len = p - s;
       if (len + 1 > pathlen)
         len = pathlen - 1;
       memcpy (path, s, len);
       if (len + 1 > pathlen)
         len = pathlen - 1;
       memcpy (path, s, len);
index 714c204..4b9e757 100644 (file)
--- a/hcache.c
+++ b/hcache.c
@@ -85,13 +85,13 @@ static void *lazy_malloc (size_t siz)
 
 static void lazy_realloc(void *ptr, ssize_t siz)
 {
 
 static void lazy_realloc(void *ptr, ssize_t siz)
 {
-  void **p = (void **) ptr;
+  char **p = ptr;
 
   if (p != NULL && 0 < siz && siz < 4096) {
     return;
   }
 
 
   if (p != NULL && 0 < siz && siz < 4096) {
     return;
   }
 
-  p_realloc(p, siz);
+  p_realloc(&p, siz);
 }
 
 static unsigned char *dump_int (unsigned int i, unsigned char *d, int *off)
 }
 
 static unsigned char *dump_int (unsigned int i, unsigned char *d, int *off)
index 82ab690..765a2fa 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
@@ -79,7 +79,7 @@ static int check_for_mailing_list_addr (address_t * adr, char *buf, int buflen)
 }
 
 
 }
 
 
-static int first_mailing_list (char *buf, size_t buflen, address_t * a)
+static int first_mailing_list (char *buf, ssize_t buflen, address_t * a)
 {
   for (; a; a = a->next) {
     if (mutt_is_subscribed_list (a)) {
 {
   for (; a; a = a->next) {
     if (mutt_is_subscribed_list (a)) {
@@ -90,7 +90,7 @@ static int first_mailing_list (char *buf, size_t buflen, address_t * a)
   return 0;
 }
 
   return 0;
 }
 
-static void make_from (ENVELOPE * hdr, char *buf, size_t len, int do_lists)
+static void make_from (ENVELOPE * hdr, char *buf, ssize_t len, int do_lists)
 {
   int me;
 
 {
   int me;
 
@@ -113,7 +113,7 @@ static void make_from (ENVELOPE * hdr, char *buf, size_t len, int do_lists)
     *buf = 0;
 }
 
     *buf = 0;
 }
 
-static void make_from_addr (ENVELOPE * hdr, char *buf, size_t len,
+static void make_from_addr (ENVELOPE * hdr, char *buf, ssize_t len,
                             int do_lists)
 {
   int me;
                             int do_lists)
 {
   int me;
@@ -220,7 +220,7 @@ struct hdr_format_info {
 };
 
 static const char *hdr_format_str (char *dest,
 };
 
 static const char *hdr_format_str (char *dest,
-                                   size_t destlen,
+                                   ssize_t destlen,
                                    char op,
                                    const char *src,
                                    const char *prefix,
                                    char op,
                                    const char *src,
                                    const char *prefix,
@@ -239,7 +239,7 @@ static const char *hdr_format_str (char *dest,
 
 #define THREAD_NEW (threads && hdr->collapsed && hdr->num_hidden > 1 && mutt_thread_contains_unread (ctx, hdr) == 1)
 #define THREAD_OLD (threads && hdr->collapsed && hdr->num_hidden > 1 && mutt_thread_contains_unread (ctx, hdr) == 2)
 
 #define THREAD_NEW (threads && hdr->collapsed && hdr->num_hidden > 1 && mutt_thread_contains_unread (ctx, hdr) == 1)
 #define THREAD_OLD (threads && hdr->collapsed && hdr->num_hidden > 1 && mutt_thread_contains_unread (ctx, hdr) == 2)
-  size_t len;
+  ssize_t len;
 
   hdr = hfi->hdr;
   ctx = hfi->ctx;
 
   hdr = hfi->hdr;
   ctx = hfi->ctx;
@@ -734,7 +734,7 @@ static const char *hdr_format_str (char *dest,
 }
 
 void
 }
 
 void
-_mutt_make_string (char *dest, size_t destlen, const char *s, CONTEXT * ctx,
+_mutt_make_string (char *dest, ssize_t destlen, const char *s, CONTEXT * ctx,
                    HEADER * hdr, format_flag flags)
 {
   struct hdr_format_info hfi;
                    HEADER * hdr, format_flag flags)
 {
   struct hdr_format_info hfi;
index 71bc481..193a122 100644 (file)
--- a/headers.c
+++ b/headers.c
@@ -26,7 +26,7 @@
 
 void mutt_edit_headers (const char *editor,
                         const char *body,
 
 void mutt_edit_headers (const char *editor,
                         const char *body,
-                        HEADER * msg, char *fcc, size_t fcclen)
+                        HEADER * msg, char *fcc, ssize_t fcclen)
 {
   char path[_POSIX_PATH_MAX];   /* tempfile used to edit headers + body */
   char buffer[LONG_STRING];
 {
   char path[_POSIX_PATH_MAX];   /* tempfile used to edit headers + body */
   char buffer[LONG_STRING];
diff --git a/help.c b/help.c
index 627f4c2..0199398 100644 (file)
--- a/help.c
+++ b/help.c
@@ -50,7 +50,7 @@ static struct binding_t *help_lookupFunction (int op, int menu)
   return (NULL);
 }
 
   return (NULL);
 }
 
-void mutt_make_help (char *d, size_t dlen, char *txt, int menu, int op)
+void mutt_make_help (char *d, ssize_t dlen, char *txt, int menu, int op)
 {
   char buf[SHORT_STRING];
 
 {
   char buf[SHORT_STRING];
 
@@ -61,11 +61,11 @@ void mutt_make_help (char *d, size_t dlen, char *txt, int menu, int op)
     d[0] = 0;
 }
 
     d[0] = 0;
 }
 
-char *mutt_compile_help (char *buf, size_t buflen, int menu,
+char *mutt_compile_help (char *buf, ssize_t buflen, int menu,
                          struct mapping_t *items)
 {
   int i;
                          struct mapping_t *items)
 {
   int i;
-  size_t len;
+  ssize_t len;
   char *pbuf = buf;
 
   for (i = 0; items[i].name && buflen > 2; i++) {
   char *pbuf = buf;
 
   for (i = 0; items[i].name && buflen > 2; i++) {
@@ -87,16 +87,16 @@ static int print_macro (FILE * f, int maxwidth, const char **macro)
   int n = maxwidth;
   wchar_t wc;
   int w;
   int n = maxwidth;
   wchar_t wc;
   int w;
-  size_t k;
-  size_t len = m_strlen(*macro);
+  ssize_t k;
+  ssize_t len = m_strlen(*macro);
   mbstate_t mbstate1, mbstate2;
 
   p_clear(&mbstate1, 1);
   p_clear(&mbstate2, 1);
   for (; len && (k = mbrtowc (&wc, *macro, len, &mbstate1));
        *macro += k, len -= k) {
   mbstate_t mbstate1, mbstate2;
 
   p_clear(&mbstate1, 1);
   p_clear(&mbstate2, 1);
   for (; len && (k = mbrtowc (&wc, *macro, len, &mbstate1));
        *macro += k, len -= k) {
-    if (k == (size_t) (-1) || k == (size_t) (-2)) {
-      k = (k == (size_t) (-1)) ? 1 : len;
+    if (k == -1 || k == -2) {
+      k = (k == -1) ? 1 : len;
       wc = replacement_char ();
     }
     /* glibc-2.1.3's wcwidth() returns 1 for unprintable chars! */
       wc = replacement_char ();
     }
     /* glibc-2.1.3's wcwidth() returns 1 for unprintable chars! */
@@ -106,10 +106,10 @@ static int print_macro (FILE * f, int maxwidth, const char **macro)
       n -= w;
       {
         char buf[MB_LEN_MAX * 2];
       n -= w;
       {
         char buf[MB_LEN_MAX * 2];
-        size_t n1, n2;
+        ssize_t n1, n2;
 
 
-        if ((n1 = wcrtomb (buf, wc, &mbstate2)) != (size_t) (-1) &&
-            (n2 = wcrtomb (buf + n1, 0, &mbstate2)) != (size_t) (-1))
+        if ((n1 = wcrtomb(buf, wc, &mbstate2)) != -1 &&
+            (n2 = wcrtomb(buf + n1, 0, &mbstate2)) != -1)
           fputs (buf, f);
       }
     }
           fputs (buf, f);
       }
     }
diff --git a/hook.c b/hook.c
index 27f0afa..bb8e30f 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -43,8 +43,8 @@ static HOOK *Hooks = NULL;
 
 static unsigned long current_hook_type = 0;
 
 
 static unsigned long current_hook_type = 0;
 
-int mutt_parse_hook (BUFFER * buf __attribute__ ((unused)), BUFFER * s, unsigned long data,
-                     BUFFER * err)
+int mutt_parse_hook (BUFFER * buf __attribute__ ((unused)), BUFFER * s,
+                     unsigned long data, BUFFER * err)
 {
   HOOK *ptr;
   BUFFER command, pattern;
 {
   HOOK *ptr;
   BUFFER command, pattern;
@@ -210,7 +210,7 @@ static void delete_hook (HOOK * h)
 }
 
 /* Deletes all hooks of type ``type'', or all defined hooks if ``type'' is 0 */
 }
 
 /* Deletes all hooks of type ``type'', or all defined hooks if ``type'' is 0 */
-static void delete_hooks (unsigned long type)
+static void delete_hooks (long type)
 {
   HOOK *h;
   HOOK *prev;
 {
   HOOK *h;
   HOOK *prev;
@@ -344,7 +344,7 @@ void mutt_message_hook (CONTEXT * ctx, HEADER * hdr, int type)
 }
 
 static int
 }
 
 static int
-mutt_addr_hook (char *path, size_t pathlen, unsigned long type, CONTEXT * ctx,
+mutt_addr_hook (char *path, ssize_t pathlen, unsigned long type, CONTEXT * ctx,
                 HEADER * hdr)
 {
   HOOK *hook;
                 HEADER * hdr)
 {
   HOOK *hook;
@@ -364,7 +364,7 @@ mutt_addr_hook (char *path, size_t pathlen, unsigned long type, CONTEXT * ctx,
   return -1;
 }
 
   return -1;
 }
 
-void mutt_default_save (char *path, size_t pathlen, HEADER * hdr)
+void mutt_default_save (char *path, ssize_t pathlen, HEADER * hdr)
 {
   *path = 0;
   if (mutt_addr_hook (path, pathlen, M_SAVEHOOK, Context, hdr) != 0) {
 {
   *path = 0;
   if (mutt_addr_hook (path, pathlen, M_SAVEHOOK, Context, hdr) != 0) {
@@ -390,7 +390,7 @@ void mutt_default_save (char *path, size_t pathlen, HEADER * hdr)
   }
 }
 
   }
 }
 
-void mutt_select_fcc (char *path, size_t pathlen, HEADER * hdr)
+void mutt_select_fcc (char *path, ssize_t pathlen, HEADER * hdr)
 {
   address_t *adr;
   char buf[_POSIX_PATH_MAX];
 {
   address_t *adr;
   char buf[_POSIX_PATH_MAX];
index e70ffbd..2cc16f8 100644 (file)
@@ -264,7 +264,7 @@ int imap_mailbox_create (const char *folder)
 
   /* append a delimiter if necessary */
   n = m_strlen(buf);
 
   /* append a delimiter if necessary */
   n = m_strlen(buf);
-  if (n && (n < sizeof (buf) - 1) && (buf[n - 1] != idata->delim)) {
+  if (n && (n < ssizeof (buf) - 1) && (buf[n - 1] != idata->delim)) {
     buf[n++] = idata->delim;
     buf[n] = '\0';
   }
     buf[n++] = idata->delim;
     buf[n] = '\0';
   }
@@ -419,7 +419,7 @@ static void imap_add_folder (char delim, char *folder, int noselect,
   (state->entry)[state->entrylen].name = m_strdup(tmp);
 
   /* mark desc with delim in browser if it can have subfolders */
   (state->entry)[state->entrylen].name = m_strdup(tmp);
 
   /* mark desc with delim in browser if it can have subfolders */
-  if (!isparent && !noinferiors && m_strlen(relpath) < sizeof (relpath) - 1) {
+  if (!isparent && !noinferiors && m_strlen(relpath) < ssizeof (relpath) - 1) {
     relpath[m_strlen(relpath) + 1] = '\0';
     relpath[m_strlen(relpath)] = delim;
   }
     relpath[m_strlen(relpath) + 1] = '\0';
     relpath[m_strlen(relpath)] = delim;
   }
index dbe6f76..fb4b3ac 100644 (file)
@@ -1487,7 +1487,7 @@ fail:
 /* trim dest to the length of the longest prefix it shares with src,
  * returning the length of the trimmed string */
 static int longest_common_prefix (char *dest, const char* src,
 /* trim dest to the length of the longest prefix it shares with src,
  * returning the length of the trimmed string */
 static int longest_common_prefix (char *dest, const char* src,
-                                  int start, size_t dlen) {
+                                  int start, ssize_t dlen) {
   int pos = start;
 
   while (pos < dlen && dest[pos] && dest[pos] == src[pos])
   int pos = start;
 
   while (pos < dlen && dest[pos] && dest[pos] == src[pos])
@@ -1499,7 +1499,7 @@ static int longest_common_prefix (char *dest, const char* src,
 
 /* look for IMAP URLs to complete from defined mailboxes. Could be extended
  * to complete over open connections and account/folder hooks too. */
 
 /* look for IMAP URLs to complete from defined mailboxes. Could be extended
  * to complete over open connections and account/folder hooks too. */
-static int imap_complete_hosts (char *dest, size_t len) {
+static int imap_complete_hosts (char *dest, ssize_t len) {
   BUFFY* mailbox;
   CONNECTION* conn;
   int rc = -1;
   BUFFY* mailbox;
   CONNECTION* conn;
   int rc = -1;
index 2e9095c..2bdebe6 100644 (file)
@@ -204,7 +204,7 @@ void imap_error (const char *where, const char *msg);
 IMAP_DATA *imap_new_idata (void);
 void imap_free_idata (IMAP_DATA ** idata);
 char *imap_fix_path (IMAP_DATA * idata, char *mailbox, char *path,
 IMAP_DATA *imap_new_idata (void);
 void imap_free_idata (IMAP_DATA ** idata);
 char *imap_fix_path (IMAP_DATA * idata, char *mailbox, char *path,
-                     size_t plen);
+                     ssize_t plen);
 int imap_get_literal_count (const char *buf, long *bytes);
 char *imap_get_qualifier (char *buf);
 char *imap_next_word (char *s);
 int imap_get_literal_count (const char *buf, long *bytes);
 char *imap_get_qualifier (char *buf);
 char *imap_next_word (char *s);
index 9e7b39b..92afea8 100644 (file)
@@ -184,7 +184,7 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend)
                                     ((msgno + 1) >= fetchlast)));
 
       if ((mfhrc < -1) || ((rc != IMAP_CMD_CONTINUE) && (rc != IMAP_CMD_OK))) {
                                     ((msgno + 1) >= fetchlast)));
 
       if ((mfhrc < -1) || ((rc != IMAP_CMD_CONTINUE) && (rc != IMAP_CMD_OK))) {
-        imap_free_header_data ((void **) &h.data);
+        imap_free_header_data((void *)&h.data);
         fclose (fp);
         mutt_hcache_close (hc);
         return -1;
         fclose (fp);
         mutt_hcache_close (hc);
         return -1;
@@ -327,7 +327,7 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
   int uid;
   int cacheno;
   IMAP_CACHE *cache;
   int uid;
   int cacheno;
   IMAP_CACHE *cache;
-  int read;
+  int isread;
   int rc;
   progress_t bar;
 
   int rc;
   progress_t bar;
 
@@ -389,7 +389,7 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
         if (ascii_strncasecmp ("UID", pc, 3) == 0) {
           pc = imap_next_word (pc);
           uid = atoi (pc);
         if (ascii_strncasecmp ("UID", pc, 3) == 0) {
           pc = imap_next_word (pc);
           uid = atoi (pc);
-          if (uid != HEADER_DATA (h)->uid)
+          if (uid != HEADER_DATA(h)->uid)
             mutt_error (_
                         ("The message index is incorrect. Try reopening the mailbox."));
         }
             mutt_error (_
                         ("The message index is incorrect. Try reopening the mailbox."));
         }
@@ -449,15 +449,15 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
    * the server's notion of 'read' and if it differs from the message info
    * picked up in mutt_read_rfc822_header, we mark the message (and context
    * changed). Another possiblity: ignore Status on IMAP?*/
    * the server's notion of 'read' and if it differs from the message info
    * picked up in mutt_read_rfc822_header, we mark the message (and context
    * changed). Another possiblity: ignore Status on IMAP?*/
-  read = h->read;
+  isread = h->read;
   newenv = mutt_read_rfc822_header (msg->fp, h, 0, 0);
   mutt_merge_envelopes(h->env, &newenv);
 
   /* see above. We want the new status in h->read, so we unset it manually
    * and let mutt_set_flag set it correctly, updating context. */
   newenv = mutt_read_rfc822_header (msg->fp, h, 0, 0);
   mutt_merge_envelopes(h->env, &newenv);
 
   /* see above. We want the new status in h->read, so we unset it manually
    * and let mutt_set_flag set it correctly, updating context. */
-  if (read != h->read) {
-    h->read = read;
-    mutt_set_flag (ctx, h, M_NEW, read);
+  if (isread != h->read) {
+    h->read = isread;
+    mutt_set_flag (ctx, h, M_NEW, isread);
   }
 
   h->lines = 0;
   }
 
   h->lines = 0;
index 4072e37..5657deb 100644 (file)
@@ -16,7 +16,7 @@
 /* -- data structures -- */
 /* IMAP-specific header data, stored as HEADER->data */
 typedef struct imap_header_data {
 /* -- data structures -- */
 /* IMAP-specific header data, stored as HEADER->data */
 typedef struct imap_header_data {
-  unsigned int uid;             /* 32-bit Message UID */
+  int uid;                  /* 32-bit Message UID */
   string_list_t *keywords;
 } IMAP_HEADER_DATA;
 
   string_list_t *keywords;
 } IMAP_HEADER_DATA;
 
@@ -28,7 +28,7 @@ typedef struct {
   unsigned int replied:1;
   unsigned int changed:1;
 
   unsigned int replied:1;
   unsigned int changed:1;
 
-  unsigned int sid;
+  int sid;
 
   IMAP_HEADER_DATA *data;
 
 
   IMAP_HEADER_DATA *data;
 
index e2b3340..e9ae15d 100644 (file)
@@ -111,8 +111,8 @@ bail:
  * Unicode characters above U+FFFF are replaced by U+FFFE.
  * If input data is invalid, return 0 and don't store anything.
  */
  * Unicode characters above U+FFFF are replaced by U+FFFE.
  * If input data is invalid, return 0 and don't store anything.
  */
-static char *utf8_to_utf7 (const char *u8, size_t u8len, char **u7,
-                           size_t * u7len)
+static char *utf8_to_utf7 (const char *u8, ssize_t u8len, char **u7,
+                           ssize_t * u7len)
 {
   char *buf, *p;
   int ch;
 {
   char *buf, *p;
   int ch;
index 9a1a9a3..8ddca9e 100644 (file)
@@ -214,7 +214,7 @@ void imap_free_idata (IMAP_DATA ** idata)
  * Moreover, IMAP servers may dislike the path ending with the delimiter.
  */
 char *imap_fix_path (IMAP_DATA * idata, char *mailbox, char *path,
  * Moreover, IMAP servers may dislike the path ending with the delimiter.
  */
 char *imap_fix_path (IMAP_DATA * idata, char *mailbox, char *path,
-                     size_t plen)
+                     ssize_t plen)
 {
   int x = 0;
 
 {
   int x = 0;
 
@@ -474,7 +474,7 @@ int imap_wordcasecmp (const char *a, const char *b)
  * 
  */
 
  * 
  */
 
-static RETSIGTYPE alrm_handler (int sig)
+static RETSIGTYPE alrm_handler (int sig __attribute__((unused)))
 {
   /* empty */
 }
 {
   /* empty */
 }
diff --git a/init.c b/init.c
index 8bd2854..c55a0da 100644 (file)
--- a/init.c
+++ b/init.c
@@ -63,7 +63,7 @@
 static const struct mapping_t* get_sortmap (struct option_t* option);
 static int parse_sort (struct option_t* dst, const char *s,
                        const struct mapping_t *map,
 static const struct mapping_t* get_sortmap (struct option_t* option);
 static int parse_sort (struct option_t* dst, const char *s,
                        const struct mapping_t *map,
-                       char* errbuf, size_t errlen);
+                       char* errbuf, ssize_t errlen);
 
 static HASH *ConfigOptions = NULL;
 
 
 static HASH *ConfigOptions = NULL;
 
@@ -84,22 +84,22 @@ static int CurRCLine = 0;
 
 /* prototypes for checking for special vars */
 static int check_dsn_return (const char* option, unsigned long val,
 
 /* prototypes for checking for special vars */
 static int check_dsn_return (const char* option, unsigned long val,
-                             char* errbuf, size_t errlen);
+                             char* errbuf, ssize_t errlen);
 static int check_dsn_notify (const char* option, unsigned long val,
 static int check_dsn_notify (const char* option, unsigned long val,
-                             char* errbuf, size_t errlen);
+                             char* errbuf, ssize_t errlen);
 static int check_history    (const char* option, unsigned long val,
 static int check_history    (const char* option, unsigned long val,
-                             char* errbuf, size_t errlen);
+                             char* errbuf, ssize_t errlen);
 /* this checks that numbers are >= 0 */
 static int check_num        (const char* option, unsigned long val,
 /* this checks that numbers are >= 0 */
 static int check_num        (const char* option, unsigned long val,
-                             char* errbuf, size_t errlen);
+                             char* errbuf, ssize_t errlen);
 #ifdef DEBUG
 static int check_debug      (const char* option, unsigned long val,
 #ifdef DEBUG
 static int check_debug      (const char* option, unsigned long val,
-                             char* errbuf, size_t errlen);
+                             char* errbuf, ssize_t errlen);
 #endif
 
 /* use this to check only */
 static int check_special (const char* option, unsigned long val,
 #endif
 
 /* use this to check only */
 static int check_special (const char* option, unsigned long val,
-                          char* errbuf, size_t errlen);
+                          char* errbuf, ssize_t errlen);
 
 /* variable <-> sanity check function mappings
  * when changing these, make sure the proper _from_string handler
 
 /* variable <-> sanity check function mappings
  * when changing these, make sure the proper _from_string handler
@@ -108,7 +108,7 @@ static int check_special (const char* option, unsigned long val,
 static struct {
   const char* name;
   int (*check) (const char* option, unsigned long val,
 static struct {
   const char* name;
   int (*check) (const char* option, unsigned long val,
-                char* errbuf, size_t errlen);
+                char* errbuf, ssize_t errlen);
 } SpecialVars[] = {
   { "dsn_notify",               check_dsn_notify },
   { "dsn_return",               check_dsn_return },
 } SpecialVars[] = {
   { "dsn_notify",               check_dsn_notify },
   { "dsn_return",               check_dsn_return },
@@ -125,44 +125,44 @@ static struct {
 };
 
 /* protos for config type handles: convert value to string */
 };
 
 /* protos for config type handles: convert value to string */
-static void bool_to_string  (char* dst, size_t dstlen, struct option_t* option);
-static void num_to_string   (char* dst, size_t dstlen, struct option_t* option);
-static void str_to_string   (char* dst, size_t dstlen, struct option_t* option);
-static void quad_to_string  (char* dst, size_t dstlen, struct option_t* option);
-static void sort_to_string  (char* dst, size_t dstlen, struct option_t* option);
-static void rx_to_string    (char* dst, size_t dstlen, struct option_t* option);
-static void magic_to_string (char* dst, size_t dstlen, struct option_t* option);
-static void addr_to_string  (char* dst, size_t dstlen, struct option_t* option);
-static void user_to_string  (char* dst, size_t dstlen, struct option_t* option);
-static void sys_to_string   (char* dst, size_t dstlen, struct option_t* option);
+static void bool_to_string  (char* dst, ssize_t dstlen, struct option_t* option);
+static void num_to_string   (char* dst, ssize_t dstlen, struct option_t* option);
+static void str_to_string   (char* dst, ssize_t dstlen, struct option_t* option);
+static void quad_to_string  (char* dst, ssize_t dstlen, struct option_t* option);
+static void sort_to_string  (char* dst, ssize_t dstlen, struct option_t* option);
+static void rx_to_string    (char* dst, ssize_t dstlen, struct option_t* option);
+static void magic_to_string (char* dst, ssize_t dstlen, struct option_t* option);
+static void addr_to_string  (char* dst, ssize_t dstlen, struct option_t* option);
+static void user_to_string  (char* dst, ssize_t dstlen, struct option_t* option);
+static void sys_to_string   (char* dst, ssize_t dstlen, struct option_t* option);
 
 /* protos for config type handles: convert to value from string */
 static int bool_from_string  (struct option_t* dst, const char* val,
 
 /* protos for config type handles: convert to value from string */
 static int bool_from_string  (struct option_t* dst, const char* val,
-                              char* errbuf, size_t errlen);
+                              char* errbuf, ssize_t errlen);
 static int num_from_string   (struct option_t* dst, const char* val,
 static int num_from_string   (struct option_t* dst, const char* val,
-                              char* errbuf, size_t errlen);
+                              char* errbuf, ssize_t errlen);
 static int str_from_string   (struct option_t* dst, const char* val,
 static int str_from_string   (struct option_t* dst, const char* val,
-                              char* errbuf, size_t errlen);
+                              char* errbuf, ssize_t errlen);
 static int path_from_string  (struct option_t* dst, const char* val,
 static int path_from_string  (struct option_t* dst, const char* val,
-                              char* errbuf, size_t errlen);
+                              char* errbuf, ssize_t errlen);
 static int quad_from_string  (struct option_t* dst, const char* val,
 static int quad_from_string  (struct option_t* dst, const char* val,
-                              char* errbuf, size_t errlen);
+                              char* errbuf, ssize_t errlen);
 static int sort_from_string  (struct option_t* dst, const char* val,
 static int sort_from_string  (struct option_t* dst, const char* val,
-                              char* errbuf, size_t errlen);
+                              char* errbuf, ssize_t errlen);
 static int rx_from_string    (struct option_t* dst, const char* val,
 static int rx_from_string    (struct option_t* dst, const char* val,
-                              char* errbuf, size_t errlen);
+                              char* errbuf, ssize_t errlen);
 static int magic_from_string (struct option_t* dst, const char* val,
 static int magic_from_string (struct option_t* dst, const char* val,
-                              char* errbuf, size_t errlen);
+                              char* errbuf, ssize_t errlen);
 static int addr_from_string  (struct option_t* dst, const char* val,
 static int addr_from_string  (struct option_t* dst, const char* val,
-                              char* errbuf, size_t errlen);
+                              char* errbuf, ssize_t errlen);
 static int user_from_string  (struct option_t* dst, const char* val,
 static int user_from_string  (struct option_t* dst, const char* val,
-                              char* errbuf, size_t errlen);
+                              char* errbuf, ssize_t errlen);
 
 static struct {
   unsigned short type;
 
 static struct {
   unsigned short type;
-  void (*opt_to_string) (char* dst, size_t dstlen, struct option_t* option);
+  void (*opt_to_string) (char* dst, ssize_t dstlen, struct option_t* option);
   int (*opt_from_string) (struct option_t* dst, const char* val,
   int (*opt_from_string) (struct option_t* dst, const char* val,
-                          char* errbuf, size_t errlen);
+                          char* errbuf, ssize_t errlen);
 } FuncTable[] = {
   { 0,          NULL,             NULL }, /* there's no DT_ type with 0 */
   { DT_BOOL,    bool_to_string,   bool_from_string },
 } FuncTable[] = {
   { 0,          NULL,             NULL }, /* there's no DT_ type with 0 */
   { DT_BOOL,    bool_to_string,   bool_from_string },
@@ -181,7 +181,7 @@ static struct {
   { DT_SYS,     sys_to_string,    NULL },
 };
 
   { DT_SYS,     sys_to_string,    NULL },
 };
 
-static void bool_to_string (char* dst, size_t dstlen,
+static void bool_to_string (char* dst, ssize_t dstlen,
                             struct option_t* option) {
   snprintf (dst, dstlen, "%s=%s", option->option,
             option (option->data) ? "yes" : "no");
                             struct option_t* option) {
   snprintf (dst, dstlen, "%s=%s", option->option,
             option (option->data) ? "yes" : "no");
@@ -189,7 +189,7 @@ static void bool_to_string (char* dst, size_t dstlen,
 
 static int bool_from_string (struct option_t* dst, const char* val,
                              char* errbuf __attribute__ ((unused)),
 
 static int bool_from_string (struct option_t* dst, const char* val,
                              char* errbuf __attribute__ ((unused)),
-                             size_t errlen __attribute__ ((unused))) {
+                             ssize_t errlen __attribute__ ((unused))) {
   int flag = -1;
 
   if (!dst)
   int flag = -1;
 
   if (!dst)
@@ -208,7 +208,7 @@ static int bool_from_string (struct option_t* dst, const char* val,
   return (1);
 }
 
   return (1);
 }
 
-static void num_to_string (char* dst, size_t dstlen,
+static void num_to_string (char* dst, ssize_t dstlen,
                            struct option_t* option) {
   /* XXX puke */
   const char* fmt = (m_strcmp(option->option, "umask") == 0) ?
                            struct option_t* option) {
   /* XXX puke */
   const char* fmt = (m_strcmp(option->option, "umask") == 0) ?
@@ -218,7 +218,7 @@ static void num_to_string (char* dst, size_t dstlen,
 }
 
 static int num_from_string (struct option_t* dst, const char* val,
 }
 
 static int num_from_string (struct option_t* dst, const char* val,
-                            char* errbuf, size_t errlen) {
+                            char* errbuf, ssize_t errlen) {
   int num = 0, old = 0;
   char* t = NULL;
 
   int num = 0, old = 0;
   char* t = NULL;
 
@@ -248,19 +248,19 @@ static int num_from_string (struct option_t* dst, const char* val,
   return (1);
 }
 
   return (1);
 }
 
-static void str_to_string (char* dst, size_t dstlen,
+static void str_to_string (char* dst, ssize_t dstlen,
                            struct option_t* option) {
   snprintf (dst, dstlen, "%s=\"%s\"", option->option,
             NONULL (*((char**) option->data)));
 }
 
                            struct option_t* option) {
   snprintf (dst, dstlen, "%s=\"%s\"", option->option,
             NONULL (*((char**) option->data)));
 }
 
-static void user_to_string (char* dst, size_t dstlen,
+static void user_to_string (char* dst, ssize_t dstlen,
                             struct option_t* option) {
   snprintf (dst, dstlen, "%s=\"%s\"", option->option,
             NONULL (((char*) option->data)));
 }
 
                             struct option_t* option) {
   snprintf (dst, dstlen, "%s=\"%s\"", option->option,
             NONULL (((char*) option->data)));
 }
 
-static void sys_to_string (char* dst, size_t dstlen,
+static void sys_to_string (char* dst, ssize_t dstlen,
                            struct option_t* option) {
   char *val = NULL, *t = NULL;
   int clean = 0;
                            struct option_t* option) {
   char *val = NULL, *t = NULL;
   int clean = 0;
@@ -304,7 +304,7 @@ static void sys_to_string (char* dst, size_t dstlen,
 }
 
 static int path_from_string (struct option_t* dst, const char* val,
 }
 
 static int path_from_string (struct option_t* dst, const char* val,
-                             char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) {
+                             char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) {
   char path[_POSIX_PATH_MAX];
 
   if (!dst)
   char path[_POSIX_PATH_MAX];
 
   if (!dst)
@@ -323,7 +323,7 @@ static int path_from_string (struct option_t* dst, const char* val,
 }
 
 static int str_from_string (struct option_t* dst, const char* val,
 }
 
 static int str_from_string (struct option_t* dst, const char* val,
-                            char* errbuf, size_t errlen) {
+                            char* errbuf, ssize_t errlen) {
   if (!dst)
     return (0);
 
   if (!dst)
     return (0);
 
@@ -335,7 +335,7 @@ static int str_from_string (struct option_t* dst, const char* val,
 }
 
 static int user_from_string (struct option_t* dst, const char* val,
 }
 
 static int user_from_string (struct option_t* dst, const char* val,
-                             char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) {
+                             char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) {
   /* if dst == NULL, we may get here in case the user did unset it,
    * see parse_set() where item is free()'d before coming here; so
    * just silently ignore it */
   /* if dst == NULL, we may get here in case the user did unset it,
    * see parse_set() where item is free()'d before coming here; so
    * just silently ignore it */
@@ -352,7 +352,7 @@ static int user_from_string (struct option_t* dst, const char* val,
   return (1);
 }
 
   return (1);
 }
 
-static void quad_to_string (char* dst, size_t dstlen,
+static void quad_to_string (char* dst, ssize_t dstlen,
                             struct option_t* option) {
   const char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
   snprintf (dst, dstlen, "%s=%s", option->option,
                             struct option_t* option) {
   const char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
   snprintf (dst, dstlen, "%s=%s", option->option,
@@ -360,7 +360,7 @@ static void quad_to_string (char* dst, size_t dstlen,
 }
 
 static int quad_from_string (struct option_t* dst, const char* val,
 }
 
 static int quad_from_string (struct option_t* dst, const char* val,
-                             char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) {
+                             char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) {
   int flag = -1;
 
   if (!dst)
   int flag = -1;
 
   if (!dst)
@@ -381,7 +381,7 @@ static int quad_from_string (struct option_t* dst, const char* val,
   return (1);
 }
 
   return (1);
 }
 
-static void sort_to_string (char* dst, size_t dstlen,
+static void sort_to_string (char* dst, ssize_t dstlen,
                             struct option_t* option) {
   const struct mapping_t *map = get_sortmap (option);
   const char *p = NULL;
                             struct option_t* option) {
   const struct mapping_t *map = get_sortmap (option);
   const char *p = NULL;
@@ -401,7 +401,7 @@ static void sort_to_string (char* dst, size_t dstlen,
 }
 
 static int sort_from_string (struct option_t* dst, const char* val,
 }
 
 static int sort_from_string (struct option_t* dst, const char* val,
-                             char* errbuf, size_t errlen) {
+                             char* errbuf, ssize_t errlen) {
   const struct mapping_t *map = NULL;
   if (!(map = get_sortmap (dst))) {
     if (errbuf)
   const struct mapping_t *map = NULL;
   if (!(map = get_sortmap (dst))) {
     if (errbuf)
@@ -414,7 +414,7 @@ static int sort_from_string (struct option_t* dst, const char* val,
   return (1);
 }
 
   return (1);
 }
 
-static void rx_to_string (char* dst, size_t dstlen,
+static void rx_to_string (char* dst, ssize_t dstlen,
                           struct option_t* option) {
   rx_t* p = (rx_t*) option->data;
   snprintf (dst, dstlen, "%s=\"%s\"", option->option,
                           struct option_t* option) {
   rx_t* p = (rx_t*) option->data;
   snprintf (dst, dstlen, "%s=\"%s\"", option->option,
@@ -422,7 +422,7 @@ static void rx_to_string (char* dst, size_t dstlen,
 }
 
 static int rx_from_string (struct option_t* dst, const char* val,
 }
 
 static int rx_from_string (struct option_t* dst, const char* val,
-                           char* errbuf, size_t errlen) {
+                           char* errbuf, ssize_t errlen) {
   rx_t* p = NULL;
   regex_t* rx = NULL;
   int flags = 0, e = 0, not = 0;
   rx_t* p = NULL;
   regex_t* rx = NULL;
   int flags = 0, e = 0, not = 0;
@@ -480,7 +480,7 @@ static int rx_from_string (struct option_t* dst, const char* val,
   return (1);
 }
 
   return (1);
 }
 
-static void magic_to_string (char* dst, size_t dstlen,
+static void magic_to_string (char* dst, ssize_t dstlen,
                              struct option_t* option) {
   const char* s = NULL;
   switch (option->data) {
                              struct option_t* option) {
   const char* s = NULL;
   switch (option->data) {
@@ -494,7 +494,7 @@ static void magic_to_string (char* dst, size_t dstlen,
 }
 
 static int magic_from_string (struct option_t* dst, const char* val,
 }
 
 static int magic_from_string (struct option_t* dst, const char* val,
-                              char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) {
+                              char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) {
   int flag = -1;
 
   if (!dst || !val || !*val)
   int flag = -1;
 
   if (!dst || !val || !*val)
@@ -516,7 +516,7 @@ static int magic_from_string (struct option_t* dst, const char* val,
 
 }
 
 
 }
 
-static void addr_to_string (char* dst, size_t dstlen,
+static void addr_to_string (char* dst, ssize_t dstlen,
                             struct option_t* option) {
   char s[HUGE_STRING];
   s[0] = '\0';
                             struct option_t* option) {
   char s[HUGE_STRING];
   s[0] = '\0';
@@ -525,7 +525,7 @@ static void addr_to_string (char* dst, size_t dstlen,
 }
 
 static int addr_from_string (struct option_t* dst, const char* val,
 }
 
 static int addr_from_string (struct option_t* dst, const char* val,
-                             char* errbuf __attribute__ ((unused)), size_t errlen __attribute__ ((unused))) {
+                             char* errbuf __attribute__ ((unused)), ssize_t errlen __attribute__ ((unused))) {
   if (!dst)
     return (0);
   address_list_wipe((address_t**) dst->data);
   if (!dst)
     return (0);
   address_list_wipe((address_t**) dst->data);
@@ -534,10 +534,10 @@ static int addr_from_string (struct option_t* dst, const char* val,
   return (1);
 }
 
   return (1);
 }
 
-int mutt_option_value (const char* val, char* dst, size_t dstlen) {
+int mutt_option_value (const char* val, char* dst, ssize_t dstlen) {
   struct option_t* option = NULL;
   char* tmp = NULL, *t = NULL;
   struct option_t* option = NULL;
   char* tmp = NULL, *t = NULL;
-  size_t l = 0;
+  ssize_t l = 0;
 
   if (!(option = hash_find (ConfigOptions, val))) {
     debug_print (1, ("var '%s' not found\n", val));
 
   if (!(option = hash_find (ConfigOptions, val))) {
     debug_print (1, ("var '%s' not found\n", val));
@@ -1428,7 +1428,7 @@ static int parse_alias (BUFFER * buf, BUFFER * s,
 {
   alias_t *tmp = Aliases;
   alias_t *last = NULL;
 {
   alias_t *tmp = Aliases;
   alias_t *last = NULL;
-  char *estr = NULL;
+  const char *estr = NULL;
 
   if (!MoreArgs (s)) {
     m_strcpy(err->data, err->dsize, _("alias: no address"));
 
   if (!MoreArgs (s)) {
     m_strcpy(err->data, err->dsize, _("alias: no address"));
@@ -1498,7 +1498,7 @@ parse_unmy_hdr (BUFFER * buf, BUFFER * s,
   string_list_t *last = NULL;
   string_list_t *tmp = UserHeader;
   string_list_t *ptr;
   string_list_t *last = NULL;
   string_list_t *tmp = UserHeader;
   string_list_t *ptr;
-  size_t l;
+  ssize_t l;
 
   do {
     mutt_extract_token (buf, s, 0);
 
   do {
     mutt_extract_token (buf, s, 0);
@@ -1539,7 +1539,7 @@ static int parse_my_hdr (BUFFER * buf, BUFFER * s, unsigned long data __attribut
                          BUFFER * err)
 {
   string_list_t *tmp;
                          BUFFER * err)
 {
   string_list_t *tmp;
-  size_t keylen;
+  ssize_t keylen;
   char *p;
 
   mutt_extract_token (buf, s, M_TOKEN_SPACE | M_TOKEN_QUOTE);
   char *p;
 
   mutt_extract_token (buf, s, M_TOKEN_SPACE | M_TOKEN_QUOTE);
@@ -1576,7 +1576,7 @@ static int parse_my_hdr (BUFFER * buf, BUFFER * s, unsigned long data __attribut
 
 static int
 parse_sort (struct option_t* dst, const char *s, const struct mapping_t *map,
 
 static int
 parse_sort (struct option_t* dst, const char *s, const struct mapping_t *map,
-            char* errbuf, size_t errlen) {
+            char* errbuf, ssize_t errlen) {
   int i, flags = 0;
 
   if (m_strncmp("reverse-", s, 8) == 0) {
   int i, flags = 0;
 
   if (m_strncmp("reverse-", s, 8) == 0) {
@@ -1649,7 +1649,7 @@ static void del_option (void* p) {
 
 static int init_expand (char** dst, struct option_t* src) {
   BUFFER token, in;
 
 static int init_expand (char** dst, struct option_t* src) {
   BUFFER token, in;
-  size_t len = 0;
+  ssize_t len = 0;
 
   p_delete(dst);
 
 
   p_delete(dst);
 
@@ -1724,7 +1724,7 @@ static void mutt_restore_default (const char* name __attribute__ ((unused)),
 
 /* check whether value for $dsn_return would be valid */
 static int check_dsn_return (const char* option __attribute__ ((unused)), unsigned long p,
 
 /* check whether value for $dsn_return would be valid */
 static int check_dsn_return (const char* option __attribute__ ((unused)), unsigned long p,
-                             char* errbuf, size_t errlen) {
+                             char* errbuf, ssize_t errlen) {
   char* val = (char*) p;
   if (val && *val && m_strncmp(val, "hdrs", 4) != 0 &&
       m_strncmp(val, "full", 4) != 0) {
   char* val = (char*) p;
   if (val && *val && m_strncmp(val, "hdrs", 4) != 0 &&
       m_strncmp(val, "full", 4) != 0) {
@@ -1737,9 +1737,9 @@ static int check_dsn_return (const char* option __attribute__ ((unused)), unsign
 
 /* check whether value for $dsn_notify would be valid */
 static int check_dsn_notify (const char* option, unsigned long p,
 
 /* check whether value for $dsn_notify would be valid */
 static int check_dsn_notify (const char* option, unsigned long p,
-                             char* errbuf, size_t errlen) {
+                             char* errbuf, ssize_t errlen) {
   list2_t* list = NULL;
   list2_t* list = NULL;
-  size_t i = 0;
+  ssize_t i = 0;
   int rc = 1;
   char* val = (char*) p;
 
   int rc = 1;
   char* val = (char*) p;
 
@@ -1765,7 +1765,7 @@ static int check_dsn_notify (const char* option, unsigned long p,
 }
 
 static int check_num (const char* option, unsigned long p,
 }
 
 static int check_num (const char* option, unsigned long p,
-                      char* errbuf, size_t errlen) {
+                      char* errbuf, ssize_t errlen) {
   if ((int) p < 0) {
     if (errbuf)
       snprintf (errbuf, errlen, _("'%d' is invalid for $%s"), (int) p, option);
   if ((int) p < 0) {
     if (errbuf)
       snprintf (errbuf, errlen, _("'%d' is invalid for $%s"), (int) p, option);
@@ -1776,7 +1776,7 @@ static int check_num (const char* option, unsigned long p,
 
 #ifdef DEBUG
 static int check_debug (const char* option, unsigned long p,
 
 #ifdef DEBUG
 static int check_debug (const char* option, unsigned long p,
-                        char* errbuf, size_t errlen) {
+                        char* errbuf, ssize_t errlen) {
   if ((int) p <= DEBUG_MAX_LEVEL &&
       (int) p >= DEBUG_MIN_LEVEL)
     return (1);
   if ((int) p <= DEBUG_MAX_LEVEL &&
       (int) p >= DEBUG_MIN_LEVEL)
     return (1);
@@ -1788,7 +1788,7 @@ static int check_debug (const char* option, unsigned long p,
 #endif
 
 static int check_history (const char* option __attribute__ ((unused)), unsigned long p,
 #endif
 
 static int check_history (const char* option __attribute__ ((unused)), unsigned long p,
-                          char* errbuf, size_t errlen) {
+                          char* errbuf, ssize_t errlen) {
   if (!check_num ("history", p, errbuf, errlen))
     return (0);
   mutt_init_history ();
   if (!check_num ("history", p, errbuf, errlen))
     return (0);
   mutt_init_history ();
@@ -1796,7 +1796,7 @@ static int check_history (const char* option __attribute__ ((unused)), unsigned
 }
 
 static int check_special (const char* name, unsigned long val,
 }
 
 static int check_special (const char* name, unsigned long val,
-                          char* errbuf, size_t errlen) {
+                          char* errbuf, ssize_t errlen) {
   int i = 0;
 
   for (i = 0; SpecialVars[i].name; i++) {
   int i = 0;
 
   for (i = 0; SpecialVars[i].name; i++) {
@@ -1996,7 +1996,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
             hash_delete (ConfigOptions, option->option,
                          option, del_option);
           else
             hash_delete (ConfigOptions, option->option,
                          option, del_option);
           else
-            p_delete((void **)&option->data);
+            p_delete((void **)(void *)&option->data);
           break;
         }
       }
           break;
         }
       }
@@ -2091,7 +2091,7 @@ static int source_rc (const char *rcfile, BUFFER * err)
   BUFFER token;
   char *linebuf = NULL;
   char *currentline = NULL;
   BUFFER token;
   char *linebuf = NULL;
   char *currentline = NULL;
-  size_t buflen;
+  ssize_t buflen;
   pid_t pid;
 
   debug_print (2, ("reading configuration file '%s'.\n", rcfile));
   pid_t pid;
 
   debug_print (2, ("reading configuration file '%s'.\n", rcfile));
@@ -2102,7 +2102,7 @@ static int source_rc (const char *rcfile, BUFFER * err)
   }
 
   p_clear(&token, 1);
   }
 
   p_clear(&token, 1);
-  while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line)) != NULL) {
+  while ((linebuf = mutt_read_line(linebuf, &buflen, f, &line)) != NULL) {
     conv = ConfigCharset && (*ConfigCharset) && Charset;
     if (conv) {
       currentline = m_strdup(linebuf);
     conv = ConfigCharset && (*ConfigCharset) && Charset;
     if (conv) {
       currentline = m_strdup(linebuf);
@@ -2233,7 +2233,7 @@ char User_typed[LONG_STRING] = { 0 };
 
 int Num_matched = 0;            /* Number of matches for completion */
 char Completed[STRING] = { 0 }; /* completed string (command or variable) */
 
 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.
@@ -2257,7 +2257,7 @@ static void candidate (char *dest, char *try, const char *src, int len)
   }
 }
 
   }
 }
 
-int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
+int mutt_command_complete (char *buffer, ssize_t len, int pos, int numtabs)
 {
   char *pt = buffer;
   int num;
 {
   char *pt = buffer;
   int num;
@@ -2401,7 +2401,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
   return 1;
 }
 
   return 1;
 }
 
-int mutt_var_value_complete (char *buffer, size_t len, int pos)
+int mutt_var_value_complete (char *buffer, ssize_t len, int pos)
 {
   char var[STRING], *pt = buffer;
   int spaces;
 {
   char var[STRING], *pt = buffer;
   int spaces;
@@ -2429,7 +2429,7 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
     else {
       char tmp[LONG_STRING], tmp2[LONG_STRING];
       char *s, *d;
     else {
       char tmp[LONG_STRING], tmp2[LONG_STRING];
       char *s, *d;
-      size_t dlen = buffer + len - pt - spaces;
+      ssize_t dlen = buffer + len - pt - spaces;
       const char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
 
       tmp[0] = '\0';
       const char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
 
       tmp[0] = '\0';
@@ -2907,7 +2907,7 @@ static void opt_sel_diff (const char* key __attribute__ ((unused)),
 
 /* dump out the value of all the variables we have */
 int mutt_dump_variables (int full) {
 
 /* dump out the value of all the variables we have */
 int mutt_dump_variables (int full) {
-  size_t i = 0;
+  ssize_t i = 0;
   char outbuf[STRING];
   list2_t* tmp = NULL;
   struct option_t* option = NULL;
   char outbuf[STRING];
   list2_t* tmp = NULL;
   struct option_t* option = NULL;
index 5be0147..accd171 100644 (file)
@@ -109,7 +109,7 @@ typedef struct crypt_keyinfo {
 } crypt_key_t;
 
 typedef struct crypt_entry {
 } crypt_key_t;
 
 typedef struct crypt_entry {
-  size_t num;
+  ssize_t num;
   crypt_key_t *key;
 } crypt_entry_t;
 
   crypt_key_t *key;
 } crypt_entry_t;
 
@@ -132,7 +132,7 @@ static int digit_or_letter (const unsigned char *s)
 
 /* Print the utf-8 encoded string BUF of length LEN bytes to stream
    FP. Convert the character set. */
 
 /* Print the utf-8 encoded string BUF of length LEN bytes to stream
    FP. Convert the character set. */
-static void print_utf8 (FILE * fp, const char *buf, size_t len)
+static void print_utf8 (FILE * fp, const char *buf, ssize_t len)
 {
   char *tstr;
 
 {
   char *tstr;
 
@@ -253,8 +253,8 @@ static int crypt_id_is_strong (crypt_key_t * key)
 {
   gpgme_validity_t val = GPGME_VALIDITY_UNKNOWN;
   gpgme_user_id_t uid = NULL;
 {
   gpgme_validity_t val = GPGME_VALIDITY_UNKNOWN;
   gpgme_user_id_t uid = NULL;
-  unsigned int is_strong = 0;
-  unsigned int i = 0;
+  int is_strong = 0;
+  int i = 0;
 
   if ((key->flags & KEYFLAG_ISX509))
     return 1;
 
   if ((key->flags & KEYFLAG_ISX509))
     return 1;
@@ -476,7 +476,7 @@ static char *data_object_to_tempfile (gpgme_data_t data, FILE ** ret_fp)
   int err;
   char tempfile[_POSIX_PATH_MAX];
   FILE *fp;
   int err;
   char tempfile[_POSIX_PATH_MAX];
   FILE *fp;
-  size_t nread = 0;
+  ssize_t nread = 0;
 
   mutt_mktemp (tempfile);
   fp = safe_fopen (tempfile, "w+");
 
   mutt_mktemp (tempfile);
   fp = safe_fopen (tempfile, "w+");
@@ -538,7 +538,7 @@ static gpgme_key_t *create_recipient_set (const char *keylist,
     do {
       while (*s == ' ')
         s++;
     do {
       while (*s == ' ')
         s++;
-      for (i = 0; *s && *s != ' ' && i < sizeof (buf) - 1;)
+      for (i = 0; *s && *s != ' ' && i < ssizeof(buf) - 1;)
         buf[i++] = *s++;
       buf[i] = 0;
       if (*buf) {
         buf[i++] = *s++;
       buf[i] = 0;
       if (*buf) {
@@ -676,7 +676,7 @@ static char *encrypt_gpgme_object (gpgme_data_t plaintext, gpgme_key_t * rset,
    which must have been allocated by the caller with size BUFLEN.
    Returns 0 on success or -1 in case of an error.  The return string
    is truncted to BUFLEN - 1. */
    which must have been allocated by the caller with size BUFLEN.
    Returns 0 on success or -1 in case of an error.  The return string
    is truncted to BUFLEN - 1. */
-static int get_micalg (gpgme_ctx_t ctx, char *buf, size_t buflen)
+static int get_micalg (gpgme_ctx_t ctx, char *buf, ssize_t buflen)
 {
   gpgme_sign_result_t result = NULL;
   const char *algorithm_name = NULL;
 {
   gpgme_sign_result_t result = NULL;
   const char *algorithm_name = NULL;
@@ -958,7 +958,7 @@ static int show_sig_summary (unsigned long sum,
   if ((sum & GPGME_SIGSUM_SIG_EXPIRED)) {
     gpgme_verify_result_t result;
     gpgme_signature_t sig;
   if ((sum & GPGME_SIGSUM_SIG_EXPIRED)) {
     gpgme_verify_result_t result;
     gpgme_signature_t sig;
-    unsigned int i;
+    int i;
 
     result = gpgme_op_verify_result (ctx);
 
 
     result = gpgme_op_verify_result (ctx);
 
@@ -991,7 +991,7 @@ static int show_sig_summary (unsigned long sum,
     const char *t0 = NULL, *t1 = NULL;
     gpgme_verify_result_t result;
     gpgme_signature_t sig;
     const char *t0 = NULL, *t1 = NULL;
     gpgme_verify_result_t result;
     gpgme_signature_t sig;
-    unsigned int i;
+    int i;
 
     state_attach_puts (_("A system error occurred"), s);
 
 
     state_attach_puts (_("A system error occurred"), s);
 
@@ -1284,18 +1284,17 @@ static int verify_one (BODY * sigbdy, STATE * s,
   if (!badsig) {
     gpgme_verify_result_t result;
     gpgme_sig_notation_t notation;
   if (!badsig) {
     gpgme_verify_result_t result;
     gpgme_sig_notation_t notation;
-    gpgme_signature_t signature;
+    gpgme_signature_t sig;
 
     result = gpgme_op_verify_result (ctx);
     if (result) {
 
     result = gpgme_op_verify_result (ctx);
     if (result) {
-      for (signature = result->signatures; signature;
-           signature = signature->next) {
-        if (signature->notations) {
+      for (sig = result->signatures; sig; sig = sig->next) {
+        if (sig->notations) {
           state_attach_puts ("*** Begin Notation (signature by: ", s);
           state_attach_puts ("*** Begin Notation (signature by: ", s);
-          state_attach_puts (signature->fpr, s);
+          state_attach_puts (sig->fpr, s);
           state_attach_puts (") ***\n", s);
           state_attach_puts (") ***\n", s);
-          for (notation = signature->notations; notation;
-               notation = notation->next) {
+          for (notation = sig->notations; notation; notation = notation->next)
+          {
             if (notation->name) {
               state_attach_puts (notation->name, s);
               state_attach_puts ("=", s);
             if (notation->name) {
               state_attach_puts (notation->name, s);
               state_attach_puts ("=", s);
@@ -1347,7 +1346,7 @@ static BODY *decrypt_part (BODY * a, STATE * s, FILE * fpout, int is_smime,
 {
   struct stat info;
   BODY *tattach;
 {
   struct stat info;
   BODY *tattach;
-  int err;
+  int err = 0;
   gpgme_ctx_t ctx;
   gpgme_data_t ciphertext, plaintext;
   int maybe_signed = 0;
   gpgme_ctx_t ctx;
   gpgme_data_t ciphertext, plaintext;
   int maybe_signed = 0;
@@ -1518,7 +1517,7 @@ int smime_gpgme_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b,
   FILE *tmpfp = NULL;
   int is_signed;
   long saved_b_offset;
   FILE *tmpfp = NULL;
   int is_signed;
   long saved_b_offset;
-  size_t saved_b_length;
+  ssize_t saved_b_length;
   int saved_b_type;
 
   if (!mutt_is_application_smime (b))
   int saved_b_type;
 
   if (!mutt_is_application_smime (b))
@@ -2157,14 +2156,11 @@ int smime_gpgme_application_handler (BODY * a, STATE * s)
  * %[...] date of key using strftime(3)
  */
 
  * %[...] date of key using strftime(3)
  */
 
-static const char *crypt_entry_fmt (char *dest,
-                                    size_t destlen,
-                                    char op,
-                                    const char *src,
-                                    const char *prefix,
-                                    const char *ifstring,
-                                    const char *elsestring,
-                                    unsigned long data, format_flag flags)
+static const char *
+crypt_entry_fmt (char *dest, ssize_t destlen, char op,
+                 const char *src, const char *prefix,
+                 const char *ifstring, const char *elsestring,
+                 unsigned long data, format_flag flags)
 {
   char fmt[16];
   crypt_entry_t *entry;
 {
   char fmt[16];
   crypt_entry_t *entry;
@@ -2190,7 +2186,7 @@ static const char *crypt_entry_fmt (char *dest,
       char buf2[SHORT_STRING], *p;
       int do_locales;
       struct tm *tm;
       char buf2[SHORT_STRING], *p;
       int do_locales;
       struct tm *tm;
-      size_t len;
+      ssize_t len;
 
       p = dest;
 
 
       p = dest;
 
@@ -2305,7 +2301,7 @@ static const char *crypt_entry_fmt (char *dest,
       s = "x";
     else {
       gpgme_user_id_t uid = NULL;
       s = "x";
     else {
       gpgme_user_id_t uid = NULL;
-      unsigned int i = 0;
+      int i = 0;
 
       for (i = 0, uid = key->kobj->uids; uid && (i < key->idx);
            i++, uid = uid->next);
 
       for (i = 0, uid = key->kobj->uids; uid && (i < key->idx);
            i++, uid = uid->next);
@@ -2353,7 +2349,7 @@ static const char *crypt_entry_fmt (char *dest,
 }
 
 /* Used by the display fucntion to format a line. */
 }
 
 /* Used by the display fucntion to format a line. */
-static void crypt_entry (char *s, size_t l, MUTTMENU * menu, int num)
+static void crypt_entry (char *s, ssize_t l, MUTTMENU * menu, int num)
 {
   crypt_key_t **key_table = (crypt_key_t **) menu->data;
   crypt_entry_t entry;
 {
   crypt_key_t **key_table = (crypt_key_t **) menu->data;
   crypt_entry_t entry;
@@ -2532,7 +2528,7 @@ static const unsigned char *parse_dn_part (struct dn_array_s *array,
                                            const unsigned char *string)
 {
   const unsigned char *s, *s1;
                                            const unsigned char *string)
 {
   const unsigned char *s, *s1;
-  size_t n;
+  ssize_t n;
   unsigned char *p;
 
   /* parse attributeType */
   unsigned char *p;
 
   /* parse attributeType */
@@ -2611,7 +2607,7 @@ static const unsigned char *parse_dn_part (struct dn_array_s *array,
 static struct dn_array_s *parse_dn (const unsigned char *string)
 {
   struct dn_array_s *array;
 static struct dn_array_s *parse_dn (const unsigned char *string)
 {
   struct dn_array_s *array;
-  size_t arrayidx, arraysize;
+  ssize_t arrayidx, arraysize;
   int i;
 
   arraysize = 7;                /* C,ST,L,O,OU,CN,email */
   int i;
 
   arraysize = 7;                /* C,ST,L,O,OU,CN,email */
@@ -3026,7 +3022,7 @@ static char *list_to_pattern (string_list_t * list)
   string_list_t *l;
   char *pattern, *p;
   const char *s;
   string_list_t *l;
   char *pattern, *p;
   const char *s;
-  size_t n;
+  ssize_t n;
 
   n = 0;
   for (l = list; l; l = l->next) {
 
   n = 0;
   for (l = list; l; l = l->next) {
@@ -3099,7 +3095,7 @@ static crypt_key_t *get_candidates (string_list_t * hints, unsigned int app,
        escaped pappert but simple strings passed in an array to the
        keylist_ext_start function. */
     string_list_t *l;
        escaped pappert but simple strings passed in an array to the
        keylist_ext_start function. */
     string_list_t *l;
-    size_t n;
+    ssize_t n;
     char **patarr;
 
     for (l = hints, n = 0; l; l = l->next) {
     char **patarr;
 
     for (l = hints, n = 0; l; l = l->next) {
@@ -3369,7 +3365,7 @@ static crypt_key_t *crypt_select_key (crypt_key_t * keys,
         else {
           gpgme_validity_t val = GPGME_VALIDITY_UNKNOWN;
           gpgme_user_id_t uid = NULL;
         else {
           gpgme_validity_t val = GPGME_VALIDITY_UNKNOWN;
           gpgme_user_id_t uid = NULL;
-          unsigned int j = 0;
+          int j = 0;
 
           warn_s = "??";
 
 
           warn_s = "??";
 
@@ -3661,8 +3657,8 @@ static char *find_keys (address_t * to, address_t * cc, address_t * bcc,
                         unsigned int app)
 {
   char *keyID, *keylist = NULL, *t;
                         unsigned int app)
 {
   char *keyID, *keylist = NULL, *t;
-  size_t keylist_size = 0;
-  size_t keylist_used = 0;
+  ssize_t keylist_size = 0;
+  ssize_t keylist_used = 0;
   address_t *tmp = NULL, *addr = NULL;
   address_t **last = &tmp;
   address_t *p, *q;
   address_t *tmp = NULL, *addr = NULL;
   address_t **last = &tmp;
   address_t *p, *q;
@@ -3906,7 +3902,7 @@ int smime_gpgme_send_menu (HEADER * msg, int *redraw)
   return gpgme_send_menu (msg, redraw, 1);
 }
 
   return gpgme_send_menu (msg, redraw, 1);
 }
 
-static int verify_sender (HEADER * h, gpgme_protocol_t protocol)
+static int verify_sender (HEADER * h, gpgme_protocol_t protocol __attribute__((unused)))
 {
   address_t *sender = NULL;
   unsigned int ret = 1;
 {
   address_t *sender = NULL;
   unsigned int ret = 1;
index 7147bf1..82f874e 100644 (file)
@@ -148,7 +148,7 @@ static int pgp_copy_checksig (FILE * fpin, FILE * fpout)
   if (PgpGoodSign.pattern) {
     char *line = NULL;
     int lineno = 0;
   if (PgpGoodSign.pattern) {
     char *line = NULL;
     int lineno = 0;
-    size_t linelen;
+    ssize_t linelen;
 
     while ((line = mutt_read_line (line, &linelen, fpin, &lineno)) != NULL) {
       if (regexec (PgpGoodSign.rx, line, 0, NULL, 0) == 0) {
 
     while ((line = mutt_read_line (line, &linelen, fpin, &lineno)) != NULL) {
       if (regexec (PgpGoodSign.rx, line, 0, NULL, 0) == 0) {
index 38accec..f95cc81 100644 (file)
@@ -55,14 +55,11 @@ struct pgp_command_context {
 };
 
 
 };
 
 
-const char *_mutt_fmt_pgp_command (char *dest,
-                                   size_t destlen,
-                                   char op,
-                                   const char *src,
-                                   const char *prefix,
-                                   const char *ifstring,
-                                   const char *elsestring,
-                                   unsigned long data, format_flag flags)
+const char *
+_mutt_fmt_pgp_command(char *dest, ssize_t destlen,
+                      char op, const char *src, const char *prefix,
+                      const char *ifstring, const char *elsestring,
+                      unsigned long data, format_flag flags)
 {
   char fmt[16];
   struct pgp_command_context *cctx = (struct pgp_command_context *) data;
 {
   char fmt[16];
   struct pgp_command_context *cctx = (struct pgp_command_context *) data;
@@ -141,7 +138,7 @@ const char *_mutt_fmt_pgp_command (char *dest,
   return (src);
 }
 
   return (src);
 }
 
-void mutt_pgp_command (char *d, size_t dlen, struct pgp_command_context *cctx,
+void mutt_pgp_command (char *d, ssize_t dlen, struct pgp_command_context *cctx,
                        const char *fmt)
 {
   mutt_FormatString (d, dlen, NONULL (fmt), _mutt_fmt_pgp_command,
                        const char *fmt)
 {
   mutt_FormatString (d, dlen, NONULL (fmt), _mutt_fmt_pgp_command,
index d9e2de3..ef99d75 100644 (file)
@@ -111,18 +111,15 @@ static pgp_key_t pgp_principal_key (pgp_key_t key)
  */
 
 typedef struct pgp_entry {
  */
 
 typedef struct pgp_entry {
-  size_t num;
+  ssize_t num;
   pgp_uid_t *uid;
 } pgp_entry_t;
 
   pgp_uid_t *uid;
 } pgp_entry_t;
 
-static const char *pgp_entry_fmt (char *dest,
-                                  size_t destlen,
-                                  char op,
-                                  const char *src,
-                                  const char *prefix,
-                                  const char *ifstring,
-                                  const char *elsestring,
-                                  unsigned long data, format_flag flags)
+static const char *
+pgp_entry_fmt (char *dest, ssize_t destlen, char op,
+               const char *src, const char *prefix,
+               const char *ifstring, const char *elsestring,
+               unsigned long data, format_flag flags)
 {
   char fmt[16];
   pgp_entry_t *entry;
 {
   char fmt[16];
   pgp_entry_t *entry;
@@ -150,7 +147,7 @@ static const char *pgp_entry_fmt (char *dest,
       char buf2[SHORT_STRING], *p;
       int do_locales;
       struct tm *tm;
       char buf2[SHORT_STRING], *p;
       int do_locales;
       struct tm *tm;
-      size_t len;
+      ssize_t len;
 
       p = dest;
 
 
       p = dest;
 
@@ -264,7 +261,7 @@ static const char *pgp_entry_fmt (char *dest,
   return (src);
 }
 
   return (src);
 }
 
-static void pgp_entry (char *s, size_t l, MUTTMENU * menu, int num)
+static void pgp_entry (char *s, ssize_t l, MUTTMENU * menu, int num)
 {
   pgp_uid_t **KeyTable = (pgp_uid_t **) menu->data;
   pgp_entry_t entry;
 {
   pgp_uid_t **KeyTable = (pgp_uid_t **) menu->data;
   pgp_entry_t entry;
@@ -583,26 +580,26 @@ static pgp_key_t pgp_select_key (pgp_key_t keys, address_t * 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]))) {
-        const char *s = "";
+        const char *q = "";
         char buff[LONG_STRING];
 
         if (KeyTable[menu->current]->flags & KEYFLAG_CANTUSE)
         char buff[LONG_STRING];
 
         if (KeyTable[menu->current]->flags & KEYFLAG_CANTUSE)
-          s = N_("ID is expired/disabled/revoked.");
+          q = N_("ID is expired/disabled/revoked.");
         else
           switch (KeyTable[menu->current]->trust & 0x03) {
           case 0:
         else
           switch (KeyTable[menu->current]->trust & 0x03) {
           case 0:
-            s = N_("ID has undefined validity.");
+            q = N_("ID has undefined validity.");
             break;
           case 1:
             break;
           case 1:
-            s = N_("ID is not valid.");
+            q = N_("ID is not valid.");
             break;
           case 2:
             break;
           case 2:
-            s = N_("ID is only marginally valid.");
+            q = N_("ID is only marginally valid.");
             break;
           }
 
         snprintf (buff, sizeof (buff),
             break;
           }
 
         snprintf (buff, sizeof (buff),
-                  _("%s Do you really want to use the key?"), _(s));
+                  _("%s Do you really want to use the key?"), _(q));
 
         if (mutt_yesorno (buff, M_NO) != M_YES) {
           mutt_clear_error ();
 
         if (mutt_yesorno (buff, M_NO) != M_YES) {
           mutt_clear_error ();
index 39ebdf2..450f8aa 100644 (file)
@@ -65,7 +65,7 @@ unsigned char *pgp_read_packet (FILE * fp, size_t * len)
   startpos = ftello (fp);
 
   if (!plen) {
   startpos = ftello (fp);
 
   if (!plen) {
-    pbuf = p_new(char, plen = CHUNKSIZE);
+    pbuf = p_new(unsigned char, plen = CHUNKSIZE);
   }
 
   if (fread (&ctb, 1, 1, fp) < 1) {
   }
 
   if (fread (&ctb, 1, 1, fp) < 1) {
index 1683a87..5e9fae0 100644 (file)
@@ -134,15 +134,11 @@ int smime_valid_passphrase (void)
 
 /* This is almost identical to ppgp's invoking interface. */
 
 
 /* This is almost identical to ppgp's invoking interface. */
 
-static const char *_mutt_fmt_smime_command (char *dest,
-                                            size_t destlen,
-                                            char op,
-                                            const char *src,
-                                            const char *prefix,
-                                            const char *ifstring,
-                                            const char *elsestring,
-                                            unsigned long data,
-                                            format_flag flags)
+static const char *
+_mutt_fmt_smime_command (char *dest, ssize_t destlen, char op,
+                         const char *src, const char *prefix,
+                         const char *ifstring, const char *elsestring,
+                         unsigned long data, format_flag flags)
 {
   char fmt[16];
   struct smime_command_context *cctx = (struct smime_command_context *) data;
 {
   char fmt[16];
   struct smime_command_context *cctx = (struct smime_command_context *) data;
@@ -256,7 +252,7 @@ static const char *_mutt_fmt_smime_command (char *dest,
 
 
 
 
 
 
-static void mutt_smime_command (char *d, size_t dlen,
+static void mutt_smime_command (char *d, ssize_t dlen,
                                 struct smime_command_context *cctx,
                                 const char *fmt)
 {
                                 struct smime_command_context *cctx,
                                 const char *fmt)
 {
@@ -309,7 +305,7 @@ static pid_t smime_invoke (FILE ** smimein, FILE ** smimeout,
    return certificate file name.
 */
 
    return certificate file name.
 */
 
-static void smime_entry (char *s, size_t l, MUTTMENU * menu, int num)
+static void smime_entry (char *s, ssize_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];
@@ -349,14 +345,15 @@ static void smime_entry (char *s, size_t l, MUTTMENU * menu, int num)
 
 
 
 
 
 
-char *smime_ask_for_key (char *prompt, char *mailbox, short public)
+char *smime_ask_for_key (char *prompt, char *mailbox __attribute__((unused)),
+                         short public)
 {
   char *fname;
   smime_id *Table;
   long cert_num;                /* Will contain the number of certificates.
                                  * To be able to get it, the .index file will be read twice... */
   char index_file[_POSIX_PATH_MAX];
 {
   char *fname;
   smime_id *Table;
   long cert_num;                /* Will contain the number of certificates.
                                  * To be able to get it, the .index file will be read twice... */
   char index_file[_POSIX_PATH_MAX];
-  FILE *index;
+  FILE *idx;
   char buf[LONG_STRING];
   char fields[5][STRING];
   int numFields, hash_suffix, done, cur;        /* The current entry */
   char buf[LONG_STRING];
   char fields[5][STRING];
   int numFields, hash_suffix, done, cur;        /* The current entry */
@@ -371,18 +368,18 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public)
   snprintf (index_file, sizeof (index_file), "%s/.index",
             public ? NONULL (SmimeCertificates) : NONULL (SmimeKeys));
 
   snprintf (index_file, sizeof (index_file), "%s/.index",
             public ? NONULL (SmimeCertificates) : NONULL (SmimeKeys));
 
-  index = fopen (index_file, "r");
-  if (index == NULL) {
+  idx = fopen (index_file, "r");
+  if (idx == NULL) {
     mutt_perror (index_file);
     return NULL;
   }
   /* Count Lines */
   cert_num = 0;
     mutt_perror (index_file);
     return NULL;
   }
   /* Count Lines */
   cert_num = 0;
-  while (!feof (index)) {
-    if (fgets (buf, sizeof (buf), index))
+  while (!feof (idx)) {
+    if (fgets (buf, sizeof (buf), idx))
       cert_num++;
   }
       cert_num++;
   }
-  fclose (index);
+  fclose (idx);
 
   for (;;) {
     *qry = 0;
 
   for (;;) {
     *qry = 0;
@@ -392,20 +389,20 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public)
               _("S/MIME certificates matching \"%s\"."), qry);
 
 
               _("S/MIME certificates matching \"%s\"."), qry);
 
 
-    index = fopen (index_file, "r");
-    if (index == NULL) {
+    idx = fopen (index_file, "r");
+    if (idx == NULL) {
       mutt_perror (index_file);
       return NULL;
     }
     /* Read Entries */
     cur = 0;
     Table = p_new(smime_id, cert_num);
       mutt_perror (index_file);
       return NULL;
     }
     /* Read Entries */
     cur = 0;
     Table = p_new(smime_id, cert_num);
-    while (!feof (index)) {
+    while (!feof (idx)) {
       numFields =
       numFields =
-        fscanf (index, MUTT_FORMAT (STRING) " %x.%i " MUTT_FORMAT (STRING),
+        fscanf (idx, MUTT_FORMAT (STRING) " %x.%i " MUTT_FORMAT (STRING),
                 fields[0], &hash, &hash_suffix, fields[2]);
       if (public)
                 fields[0], &hash, &hash_suffix, fields[2]);
       if (public)
-        fscanf (index, MUTT_FORMAT (STRING) " " MUTT_FORMAT (STRING) "\n",
+        fscanf (idx, MUTT_FORMAT (STRING) " " MUTT_FORMAT (STRING) "\n",
                 fields[3], fields[4]);
 
       /* 0=email 1=name 2=nick 3=intermediate 4=trust */
                 fields[3], fields[4]);
 
       /* 0=email 1=name 2=nick 3=intermediate 4=trust */
@@ -425,7 +422,7 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public)
 
       cur++;
     }
 
       cur++;
     }
-    fclose (index);
+    fclose (idx);
 
     /* Make Helpstring */
     helpstr[0] = 0;
 
     /* Make Helpstring */
     helpstr[0] = 0;
@@ -731,8 +728,8 @@ void smime_getkeys (ENVELOPE * env)
 char *smime_findKeys (address_t * to, address_t * cc, address_t * bcc)
 {
   char *keyID, *keylist = NULL;
 char *smime_findKeys (address_t * to, address_t * cc, address_t * bcc)
 {
   char *keyID, *keylist = NULL;
-  size_t keylist_size = 0;
-  size_t keylist_used = 0;
+  ssize_t keylist_size = 0;
+  ssize_t keylist_used = 0;
   address_t *tmp = NULL, *addr = NULL;
   address_t **last = &tmp;
   address_t *p, *q;
   address_t *tmp = NULL, *addr = NULL;
   address_t **last = &tmp;
   address_t *p, *q;
@@ -1056,7 +1053,7 @@ static char *smime_extract_signer_certificate (char *infile)
 
 /* Add a certificate and update index file (externally). */
 
 
 /* Add a certificate and update index file (externally). */
 
-void smime_invoke_import (char *infile, char *mailbox)
+void smime_invoke_import (char *infile, char *mailbox __attribute__((notused)))
 {
   char tmpfname[_POSIX_PATH_MAX], *certfile = NULL, buf[STRING];
   FILE *smimein = NULL, *fpout = NULL, *fperr = NULL;
 {
   char tmpfname[_POSIX_PATH_MAX], *certfile = NULL, buf[STRING];
   FILE *smimein = NULL, *fpout = NULL, *fperr = NULL;
@@ -1505,7 +1502,7 @@ int smime_verify_one (BODY * sigbdy, STATE * s, const char *tempfile)
   int badsig = -1;
 
   long tmpoffset = 0;
   int badsig = -1;
 
   long tmpoffset = 0;
-  size_t tmplength = 0;
+  ssize_t tmplength = 0;
   int origType = sigbdy->type;
   char *savePrefix = NULL;
 
   int origType = sigbdy->type;
   char *savePrefix = NULL;
 
@@ -1567,7 +1564,7 @@ int smime_verify_one (BODY * sigbdy, STATE * s, const char *tempfile)
     else {
       char *line = NULL;
       int lineno = 0;
     else {
       char *line = NULL;
       int lineno = 0;
-      size_t linelen;
+      ssize_t linelen;
 
       fflush (smimeerr);
       rewind (smimeerr);
 
       fflush (smimeerr);
       rewind (smimeerr);
@@ -1782,7 +1779,7 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile)
   if (type & SIGNOPAQUE) {
     char *line = NULL;
     int lineno = 0;
   if (type & SIGNOPAQUE) {
     char *line = NULL;
     int lineno = 0;
-    size_t linelen;
+    ssize_t linelen;
 
     rewind (smimeerr);
 
 
     rewind (smimeerr);
 
@@ -1811,7 +1808,7 @@ int smime_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, BODY ** cur)
   char tempfile[_POSIX_PATH_MAX];
   STATE s;
   long tmpoffset = b->offset;
   char tempfile[_POSIX_PATH_MAX];
   STATE s;
   long tmpoffset = b->offset;
-  size_t tmplength = b->length;
+  ssize_t tmplength = b->length;
   int origType = b->type;
   FILE *tmpfp = NULL;
   int rv = 0;
   int origType = b->type;
   FILE *tmpfp = NULL;
   int rv = 0;
index 6feb958..dccca24 100644 (file)
@@ -87,7 +87,7 @@ void mutt_buffer_free(BUFFER **p)
 /* dynamically grows a BUFFER to accomodate s, in increments of 128 bytes.
  * Always one byte bigger than necessary for the null terminator, and
  * the buffer is always null-terminated */
 /* dynamically grows a BUFFER to accomodate s, in increments of 128 bytes.
  * Always one byte bigger than necessary for the null terminator, and
  * the buffer is always null-terminated */
-void mutt_buffer_add(BUFFER *buf, const char *s, size_t len)
+void mutt_buffer_add(BUFFER *buf, const char *s, ssize_t len)
 {
     size_t offset;
 
 {
     size_t offset;
 
@@ -194,7 +194,7 @@ int mutt_extract_token(BUFFER *dest, BUFFER *tok, int flags)
             FILE *fp;
             pid_t pid;
             char *cmd, *ptr;
             FILE *fp;
             pid_t pid;
             char *cmd, *ptr;
-            size_t expnlen;
+            ssize_t expnlen;
             BUFFER expn;
             int line = 0;
 
             BUFFER expn;
             int line = 0;
 
index 41a508f..0fc562d 100644 (file)
@@ -44,7 +44,7 @@
 typedef struct {
     char *data;          /* pointer to data */
     char *dptr;          /* current read/write position */
 typedef struct {
     char *data;          /* pointer to data */
     char *dptr;          /* current read/write position */
-    size_t dsize;        /* length of data */
+    ssize_t dsize;       /* length of data */
     int destroy;         /* destroy `data' when done? */
 } BUFFER;
 
     int destroy;         /* destroy `data' when done? */
 } BUFFER;
 
@@ -54,7 +54,7 @@ void mutt_buffer_free(BUFFER **);
 BUFFER *mutt_buffer_from(BUFFER *, const char *);
 int mutt_extract_token(BUFFER *, BUFFER *, int);
 
 BUFFER *mutt_buffer_from(BUFFER *, const char *);
 int mutt_extract_token(BUFFER *, BUFFER *, int);
 
-void mutt_buffer_add(BUFFER *, const char *, size_t);
+void mutt_buffer_add(BUFFER *, const char *, ssize_t);
 static inline void mutt_buffer_addstr(BUFFER *b, const char *s) {
     mutt_buffer_add(b, s, m_strlen(s));
 }
 static inline void mutt_buffer_addstr(BUFFER *b, const char *s) {
     mutt_buffer_add(b, s, m_strlen(s));
 }
index 22bb68c..985015f 100644 (file)
@@ -259,9 +259,9 @@ int safe_fclose(FILE **f)
  * If a line ends with "\", this char and the linefeed is removed,
  * and the next line is read too.
  */
  * If a line ends with "\", this char and the linefeed is removed,
  * and the next line is read too.
  */
-char *mutt_read_line(char *s, size_t *size, FILE * fp, int *line)
+char *mutt_read_line(char *s, ssize_t *size, FILE * fp, int *line)
 {
 {
-    size_t offset = 0;
+    ssize_t offset = 0;
     char *ch;
 
     if (!s) {
     char *ch;
 
     if (!s) {
@@ -310,7 +310,7 @@ int mutt_copy_stream(FILE *fin, FILE *fout)
     char buf[BUFSIZ];
     size_t l;
 
     char buf[BUFSIZ];
     size_t l;
 
-    while ((l = fread(buf, 1, sizeof (buf), fin)) > 0) {
+    while ((l = fread(buf, 1, sizeof(buf), fin)) > 0) {
         if (fwrite(buf, 1, l, fout) != l)
             return -1;
     }
         if (fwrite(buf, 1, l, fout) != l)
             return -1;
     }
@@ -318,12 +318,12 @@ int mutt_copy_stream(FILE *fin, FILE *fout)
     return 0;
 }
 
     return 0;
 }
 
-int mutt_copy_bytes(FILE *in, FILE *out, size_t size)
+int mutt_copy_bytes(FILE *in, FILE *out, ssize_t size)
 {
     char buf[BUFSIZ];
 
     while (size > 0) {
 {
     char buf[BUFSIZ];
 
     while (size > 0) {
-        size_t chunk = MIN(size, sizeof(buf));
+        size_t chunk = MIN(size, ssizeof(buf));
 
         if ((chunk = fread(buf, 1, chunk, in)) < 1)
             break;
 
         if ((chunk = fread(buf, 1, chunk, in)) < 1)
             break;
index 2f168e3..2b73551 100644 (file)
@@ -52,10 +52,10 @@ void mutt_unlink(const char *);
 FILE *safe_fopen(const char *, const char *);
 int safe_fclose(FILE **);
 
 FILE *safe_fopen(const char *, const char *);
 int safe_fclose(FILE **);
 
-char *mutt_read_line(char *, size_t *, FILE *, int *);
+char *mutt_read_line(char *, ssize_t *, FILE *, int *);
 
 int mutt_copy_stream(FILE *, FILE *);
 
 int mutt_copy_stream(FILE *, FILE *);
-int mutt_copy_bytes(FILE *, FILE *, size_t);
+int mutt_copy_bytes(FILE *, FILE *, ssize_t);
 
 /****************************************************************************/
 /* ligben-like funcs                                                        */
 
 /****************************************************************************/
 /* ligben-like funcs                                                        */
index 82d9c4d..b085c17 100644 (file)
@@ -71,7 +71,7 @@ int mutt_socket_close (CONNECTION * conn)
   return rc;
 }
 
   return rc;
 }
 
-int mutt_socket_read (CONNECTION * conn, char *buf, size_t len)
+int mutt_socket_read (CONNECTION * conn, char *buf, ssize_t len)
 {
   int rc;
 
 {
   int rc;
 
@@ -336,7 +336,7 @@ int raw_socket_close (CONNECTION * conn)
   return close (conn->fd);
 }
 
   return close (conn->fd);
 }
 
-int raw_socket_read (CONNECTION * conn, char *buf, size_t len)
+int raw_socket_read (CONNECTION * conn, char *buf, ssize_t len)
 {
   int rc;
 
 {
   int rc;
 
@@ -349,7 +349,7 @@ int raw_socket_read (CONNECTION * conn, char *buf, size_t len)
   return rc;
 }
 
   return rc;
 }
 
-int raw_socket_write (CONNECTION * conn, const char *buf, size_t count)
+int raw_socket_write (CONNECTION * conn, const char *buf, ssize_t count)
 {
   int rc;
 
 {
   int rc;
 
index 9369b2a..84664e1 100644 (file)
@@ -34,16 +34,16 @@ typedef struct _connection {
   struct _connection *next;
 
   void *sockdata;
   struct _connection *next;
 
   void *sockdata;
-  int (*conn_read) (struct _connection * conn, char *buf, size_t len);
+  int (*conn_read) (struct _connection * conn, char *buf, ssize_t len);
   int (*conn_write) (struct _connection * conn, const char *buf,
   int (*conn_write) (struct _connection * conn, const char *buf,
-                     size_t count);
+                     ssize_t count);
   int (*conn_open) (struct _connection * conn);
   int (*conn_close) (struct _connection * conn);
 } CONNECTION;
 
 int mutt_socket_open (CONNECTION * conn);
 int mutt_socket_close (CONNECTION * conn);
   int (*conn_open) (struct _connection * conn);
   int (*conn_close) (struct _connection * conn);
 } CONNECTION;
 
 int mutt_socket_open (CONNECTION * conn);
 int mutt_socket_close (CONNECTION * conn);
-int mutt_socket_read (CONNECTION * conn, char *buf, size_t len);
+int mutt_socket_read (CONNECTION * conn, char *buf, ssize_t len);
 int mutt_socket_readchar (CONNECTION * conn, char *c);
 
 #define mutt_socket_readln(A,B,C) mutt_socket_readln_d(A,B,C,M_SOCK_LOG_CMD)
 int mutt_socket_readchar (CONNECTION * conn, char *c);
 
 #define mutt_socket_readln(A,B,C) mutt_socket_readln_d(A,B,C,M_SOCK_LOG_CMD)
@@ -58,8 +58,8 @@ void mutt_socket_free (CONNECTION * conn);
 CONNECTION *mutt_conn_find (const CONNECTION * start,
                             const ACCOUNT * account);
 
 CONNECTION *mutt_conn_find (const CONNECTION * start,
                             const ACCOUNT * account);
 
-int raw_socket_read (CONNECTION * conn, char *buf, size_t len);
-int raw_socket_write (CONNECTION * conn, const char *buf, size_t count);
+int raw_socket_read (CONNECTION * conn, char *buf, ssize_t len);
+int raw_socket_write (CONNECTION * conn, const char *buf, ssize_t count);
 int raw_socket_open (CONNECTION * conn);
 int raw_socket_close (CONNECTION * conn);
 
 int raw_socket_open (CONNECTION * conn);
 int raw_socket_close (CONNECTION * conn);
 
index a679048..37248b8 100644 (file)
@@ -39,8 +39,8 @@ typedef struct _tlssockdata {
 } tlssockdata;
 
 /* local prototypes */
 } tlssockdata;
 
 /* local prototypes */
-static int tls_socket_read (CONNECTION * conn, char *buf, size_t len);
-static int tls_socket_write (CONNECTION * conn, const char *buf, size_t len);
+static int tls_socket_read (CONNECTION * conn, char *buf, ssize_t len);
+static int tls_socket_write (CONNECTION * conn, const char *buf, ssize_t len);
 static int tls_socket_open (CONNECTION * conn);
 static int tls_socket_close (CONNECTION * conn);
 static int tls_starttls_close (CONNECTION * conn);
 static int tls_socket_open (CONNECTION * conn);
 static int tls_socket_close (CONNECTION * conn);
 static int tls_starttls_close (CONNECTION * conn);
@@ -82,7 +82,7 @@ int mutt_ssl_socket_setup (CONNECTION * conn)
   return 0;
 }
 
   return 0;
 }
 
-static int tls_socket_read (CONNECTION * conn, char *buf, size_t len)
+static int tls_socket_read (CONNECTION * conn, char *buf, ssize_t len)
 {
   tlssockdata *data = conn->sockdata;
   int ret;
 {
   tlssockdata *data = conn->sockdata;
   int ret;
@@ -102,7 +102,7 @@ static int tls_socket_read (CONNECTION * conn, char *buf, size_t len)
   return ret;
 }
 
   return ret;
 }
 
-static int tls_socket_write (CONNECTION * conn, const char *buf, size_t len)
+static int tls_socket_write (CONNECTION * conn, const char *buf, ssize_t len)
 {
   tlssockdata *data = conn->sockdata;
   int ret;
 {
   tlssockdata *data = conn->sockdata;
   int ret;
@@ -354,12 +354,12 @@ static void tls_fingerprint (gnutls_digest_algorithm algo,
                              char *s, int l, const gnutls_datum * data)
 {
   unsigned char md[36];
                              char *s, int l, const gnutls_datum * data)
 {
   unsigned char md[36];
-  size_t n;
+  ssize_t n;
   int j;
 
   n = 36;
 
   int j;
 
   n = 36;
 
-  if (gnutls_fingerprint (algo, data, (char *) md, &n) < 0) {
+  if (gnutls_fingerprint(algo, data, (char *) md, &n) < 0) {
     snprintf (s, l, _("[unable to calculate]"));
   }
   else {
     snprintf (s, l, _("[unable to calculate]"));
   }
   else {
@@ -373,7 +373,7 @@ static void tls_fingerprint (gnutls_digest_algorithm algo,
   }
 }
 
   }
 }
 
-static char *tls_make_date (time_t t, char *s, size_t len)
+static char *tls_make_date (time_t t, char *s, ssize_t len)
 {
   struct tm *l = gmtime (&t);
 
 {
   struct tm *l = gmtime (&t);
 
@@ -393,7 +393,7 @@ static int tls_check_stored_hostname (const gnutls_datum * cert,
   char buf[80];
   FILE *fp;
   char *linestr = NULL;
   char buf[80];
   FILE *fp;
   char *linestr = NULL;
-  size_t linestrsize;
+  ssize_t linestrsize;
   int linenum = 0;
   regex_t preg;
   regmatch_t pmatch[3];
   int linenum = 0;
   regex_t preg;
   regmatch_t pmatch[3];
@@ -442,7 +442,7 @@ static int tls_check_certificate (CONNECTION * conn)
   char helpstr[SHORT_STRING];
   char buf[SHORT_STRING];
   char fpbuf[SHORT_STRING];
   char helpstr[SHORT_STRING];
   char buf[SHORT_STRING];
   char fpbuf[SHORT_STRING];
-  size_t buflen;
+  ssize_t buflen;
   char dn_common_name[SHORT_STRING];
   char dn_email[SHORT_STRING];
   char dn_organization[SHORT_STRING];
   char dn_common_name[SHORT_STRING];
   char dn_email[SHORT_STRING];
   char dn_organization[SHORT_STRING];
index 3a59d64..1cc7aa6 100644 (file)
@@ -51,8 +51,8 @@
  * is impossible to unget function keys in SLang, so roll our own input
  * buffering routines.
  */
  * is impossible to unget function keys in SLang, so roll our own input
  * buffering routines.
  */
-size_t UngetCount = 0;
-static size_t UngetBufLen = 0;
+ssize_t UngetCount = 0;
+static ssize_t UngetBufLen = 0;
 static event_t *KeyEvent;
 
 void mutt_refresh (void)
 static event_t *KeyEvent;
 
 void mutt_refresh (void)
@@ -116,7 +116,7 @@ event_t mutt_getch (void)
   return (ch == ctrl ('G') ? err : ret);
 }
 
   return (ch == ctrl ('G') ? err : ret);
 }
 
-int _mutt_get_field ( const char *field, char *buf, size_t buflen,
+int _mutt_get_field ( const char *field, char *buf, ssize_t buflen,
                      int complete, int multiple, char ***files, int *numfiles)
 {
   int ret;
                      int complete, int multiple, char ***files, int *numfiles)
 {
   int ret;
@@ -140,7 +140,7 @@ int _mutt_get_field ( const char *field, char *buf, size_t buflen,
   return (ret);
 }
 
   return (ret);
 }
 
-int mutt_get_field_unbuffered (char *msg, char *buf, size_t buflen, int flags)
+int mutt_get_field_unbuffered (char *msg, char *buf, ssize_t buflen, int flags)
 {
   int rc;
 
 {
   int rc;
 
@@ -176,7 +176,7 @@ int mutt_yesorno (const char *msg, int def)
   char *yes = _("yes");
   char *no = _("no");
   char *answer_string;
   char *yes = _("yes");
   char *no = _("no");
   char *answer_string;
-  size_t answer_string_len;
+  ssize_t answer_string_len;
 
 #ifdef HAVE_LANGINFO_YESEXPR
   char *expr;
 
 #ifdef HAVE_LANGINFO_YESEXPR
   char *expr;
@@ -437,7 +437,7 @@ int mutt_do_pager (const char *banner,
   return rc;
 }
 
   return rc;
 }
 
-int _mutt_enter_fname (const char *prompt, char *buf, size_t blen,
+int _mutt_enter_fname (const char *prompt, char *buf, ssize_t blen,
                        int *redraw, int buffy, int multiple, char ***files,
                        int *numfiles)
 {
                        int *redraw, int buffy, int multiple, char ***files,
                        int *numfiles)
 {
@@ -562,11 +562,11 @@ int mutt_addwch (wchar_t wc)
 {
   char buf[MB_LEN_MAX * 2];
   mbstate_t mbstate;
 {
   char buf[MB_LEN_MAX * 2];
   mbstate_t mbstate;
-  size_t n1, n2;
+  ssize_t n1, n2;
 
   p_clear(&mbstate, 1);
 
   p_clear(&mbstate, 1);
-  if ((n1 = wcrtomb (buf, wc, &mbstate)) == (size_t) (-1) ||
-      (n2 = wcrtomb (buf + n1, 0, &mbstate)) == (size_t) (-1))
+  if ((n1 = wcrtomb(buf, wc, &mbstate)) == -1 ||
+      (n2 = wcrtomb(buf + n1, 0, &mbstate)) == -1)
     return -1;                  /* ERR */
   else
     return addstr (buf);
     return -1;                  /* ERR */
   else
     return addstr (buf);
@@ -643,8 +643,7 @@ void mutt_format_string (char *dest, ssize_t destlen,
  * the number of character cells when printed.
  */
 
  * the number of character cells when printed.
  */
 
-static void mutt_format_s_x (char *dest,
-                             size_t destlen,
+static void mutt_format_s_x (char *dest, ssize_t destlen,
                              const char *prefix, const char *s, int arboreal)
 {
   int right_justify = 1;
                              const char *prefix, const char *s, int arboreal)
 {
   int right_justify = 1;
@@ -666,14 +665,14 @@ static void mutt_format_s_x (char *dest,
                       right_justify, ' ', s, m_strlen(s), arboreal);
 }
 
                       right_justify, ' ', s, m_strlen(s), arboreal);
 }
 
-void mutt_format_s (char *dest,
-                    size_t destlen, const char *prefix, const char *s)
+void mutt_format_s (char *dest, ssize_t destlen,
+                    const char *prefix, const char *s)
 {
   mutt_format_s_x (dest, destlen, prefix, s, 0);
 }
 
 {
   mutt_format_s_x (dest, destlen, prefix, s, 0);
 }
 
-void mutt_format_s_tree (char *dest,
-                         size_t destlen, const char *prefix, const char *s)
+void mutt_format_s_tree (char *dest, ssize_t destlen,
+                         const char *prefix, const char *s)
 {
   mutt_format_s_x (dest, destlen, prefix, s, 1);
 }
 {
   mutt_format_s_x (dest, destlen, prefix, s, 1);
 }
@@ -687,14 +686,14 @@ void mutt_paddstr (int n, const char *s)
 {
   wchar_t wc;
   int w;
 {
   wchar_t wc;
   int w;
-  size_t k;
-  size_t len = m_strlen(s);
+  ssize_t k;
+  ssize_t len = m_strlen(s);
   mbstate_t mbstate;
 
   p_clear(&mbstate, 1);
   for (; len && (k = mbrtowc (&wc, s, len, &mbstate)); s += k, len -= k) {
   mbstate_t mbstate;
 
   p_clear(&mbstate, 1);
   for (; len && (k = mbrtowc (&wc, s, len, &mbstate)); s += k, len -= k) {
-    if (k == (size_t) (-1) || k == (size_t) (-2)) {
-      k = (k == (size_t) (-1)) ? 1 : len;
+    if (k == -1 || k == -2) {
+      k = (k == -1) ? 1 : len;
       wc = replacement_char ();
     }
     if (!IsWPrint (wc))
       wc = replacement_char ();
     }
     if (!IsWPrint (wc))
@@ -720,7 +719,7 @@ int mutt_strwidth (const char *s)
 {
   wchar_t wc;
   int w;
 {
   wchar_t wc;
   int w;
-  size_t k, n;
+  ssize_t k, n;
   mbstate_t mbstate;
 
   if (!s)
   mbstate_t mbstate;
 
   if (!s)
@@ -730,8 +729,8 @@ int mutt_strwidth (const char *s)
 
   p_clear(&mbstate, 1);
   for (w = 0; n && (k = mbrtowc (&wc, s, n, &mbstate)); s += k, n -= k) {
 
   p_clear(&mbstate, 1);
   for (w = 0; n && (k = mbrtowc (&wc, s, n, &mbstate)); s += k, n -= k) {
-    if (k == (size_t) (-1) || k == (size_t) (-2)) {
-      k = (k == (size_t) (-1)) ? 1 : n;
+    if (k == -1 || k == -2) {
+      k = (k == -1) ? 1 : n;
       wc = replacement_char ();
     }
     if (!IsWPrint (wc))
       wc = replacement_char ();
     }
     if (!IsWPrint (wc))
diff --git a/main.c b/main.c
index e3a0b83..8451c72 100644 (file)
--- a/main.c
+++ b/main.c
@@ -15,7 +15,7 @@
 
 #define MAIN_C 1
 
 
 #define MAIN_C 1
 
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
 # include "config.h"
 #endif
 
@@ -69,11 +69,11 @@ extern int optind;
 #endif
 
 #ifdef USE_HCACHE
 #endif
 
 #ifdef USE_HCACHE
-#if HAVE_QDBM
+#if defined(HAVE_QDBM)
 #include <depot.h>
 #include <depot.h>
-#elif HAVE_GDBM
+#elif defined(HAVE_GDBM)
 #include <gdbm.h>
 #include <gdbm.h>
-#elif HAVE_DB4
+#elif defined(HAVE_DB4)
 #include <db.h>
 #endif
 #endif
 #include <db.h>
 #endif
 #endif
@@ -236,11 +236,11 @@ static void show_version (void)
 #endif
 
 #ifdef USE_HCACHE
 #endif
 
 #ifdef USE_HCACHE
-#if HAVE_QDBM
+#if defined(HAVE_QDBM)
   printf ("  qdbm %s\n", dpversion);
   printf ("  qdbm %s\n", dpversion);
-#elif HAVE_GDBM
+#elif defined(HAVE_GDBM)
   printf ("  gdbm %s\n", gdbm_version);
   printf ("  gdbm %s\n", gdbm_version);
-#elif HAVE_DB4
+#elif defined(HAVE_DB4)
   printf ("  DB4 %d.%d.%d\n", DB_VERSION_MAJOR, DB_VERSION_MINOR,
           DB_VERSION_PATCH);
 #endif
   printf ("  DB4 %d.%d.%d\n", DB_VERSION_MAJOR, DB_VERSION_MINOR,
           DB_VERSION_PATCH);
 #endif
@@ -407,7 +407,7 @@ static void show_version (void)
          "-HAVE_LANGINFO_YESEXPR  "
 #endif
          "\n  "
          "-HAVE_LANGINFO_YESEXPR  "
 #endif
          "\n  "
-#if HAVE_ICONV
+#ifdef HAVE_ICONV
          "+HAVE_ICONV  "
 #else
          "-HAVE_ICONV  "
          "+HAVE_ICONV  "
 #else
          "-HAVE_ICONV  "
@@ -417,17 +417,17 @@ static void show_version (void)
 #else
          "-ICONV_NONTRANS  "
 #endif
 #else
          "-ICONV_NONTRANS  "
 #endif
-#if HAVE_LIBIDN
+#ifdef HAVE_LIBIDN
          "+HAVE_LIBIDN  "
 #else
          "-HAVE_LIBIDN  "
 #endif
          "+HAVE_LIBIDN  "
 #else
          "-HAVE_LIBIDN  "
 #endif
-#if HAVE_GETSID
+#ifdef HAVE_GETSID
          "+HAVE_GETSID  "
 #else
          "-HAVE_GETSID  "
 #endif
          "+HAVE_GETSID  "
 #else
          "-HAVE_GETSID  "
 #endif
-#if HAVE_GETADDRINFO
+#ifdef HAVE_GETADDRINFO
          "+HAVE_GETADDRINFO  "
 #else
          "-HAVE_GETADDRINFO  "
          "+HAVE_GETADDRINFO  "
 #else
          "-HAVE_GETADDRINFO  "
@@ -481,10 +481,10 @@ static void start_curses (void)
   keypad (stdscr, TRUE);
   cbreak ();
   noecho ();
   keypad (stdscr, TRUE);
   cbreak ();
   noecho ();
-#if HAVE_TYPEAHEAD
+#ifdef HAVE_TYPEAHEAD
   typeahead (-1);               /* simulate smooth scrolling */
 #endif
   typeahead (-1);               /* simulate smooth scrolling */
 #endif
-#if HAVE_META
+#ifdef HAVE_META
   meta (stdscr, TRUE);
 #endif
 }
   meta (stdscr, TRUE);
 #endif
 }
@@ -518,7 +518,7 @@ int main (int argc, char **argv)
   int dump_variables = -1;
 
   /* initialize random number for tmp file creation */ 
   int dump_variables = -1;
 
   /* initialize random number for tmp file creation */ 
-  srand ((unsigned int) time (NULL));
+  srand48((unsigned int) time (NULL));
   
   /* sanity check against stupid administrators */
   
   
   /* sanity check against stupid administrators */
   
@@ -538,7 +538,7 @@ int main (int argc, char **argv)
 
   mutt_error = mutt_nocurses_error;
   mutt_message = mutt_nocurses_error;
 
   mutt_error = mutt_nocurses_error;
   mutt_message = mutt_nocurses_error;
-  SRAND (time (NULL));
+  srand48 (time (NULL));
   umask (077);
 
   p_clear(Options, countof(Options));
   umask (077);
 
   p_clear(Options, countof(Options));
@@ -721,12 +721,12 @@ int main (int argc, char **argv)
     address_t *a;
 
     for (; alias_queries; alias_queries = alias_queries->next) {
     address_t *a;
 
     for (; alias_queries; alias_queries = alias_queries->next) {
-      if ((a = alias_lookup(alias_queries->data))) {
+      if ((a = address_list_dup(alias_lookup(alias_queries->data)))) {
         /* output in machine-readable form */
         mutt_addrlist_to_idna (a, NULL);
         mutt_write_address_list (a, stdout, 0, 0);
         /* output in machine-readable form */
         mutt_addrlist_to_idna (a, NULL);
         mutt_write_address_list (a, stdout, 0, 0);
-      }
-      else {
+        address_list_wipe(&a);
+      else {
         rv = 1;
         printf ("%s\n", alias_queries->data);
       }
         rv = 1;
         printf ("%s\n", alias_queries->data);
       }
diff --git a/mh.c b/mh.c
index 5a68171..baff9e4 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -756,9 +756,7 @@ static int maildir_move_to_context (CONTEXT * ctx, struct maildir **md)
 #ifdef USE_HCACHE
 static size_t maildir_hcache_keylen (const char *fn)
 {
 #ifdef USE_HCACHE
 static size_t maildir_hcache_keylen (const char *fn)
 {
-  const char *p = strchr (fn, ':');
-
-  return p ? (size_t) (p - fn) : m_strlen(fn);
+    return m_strchrnul(fn, ':') - fn;
 }
 #endif
 
 }
 #endif
 
index 956b164..d904164 100644 (file)
@@ -91,9 +91,9 @@ static int mutt_sasl_cb_pass (sasl_conn_t * conn, void *context, int id,
 /* socket wrappers for a SASL security layer */
 static int mutt_sasl_conn_open (CONNECTION * conn);
 static int mutt_sasl_conn_close (CONNECTION * conn);
 /* socket wrappers for a SASL security layer */
 static int mutt_sasl_conn_open (CONNECTION * conn);
 static int mutt_sasl_conn_close (CONNECTION * conn);
-static int mutt_sasl_conn_read (CONNECTION * conn, char *buf, size_t len);
+static int mutt_sasl_conn_read (CONNECTION * conn, char *buf, ssize_t len);
 static int mutt_sasl_conn_write (CONNECTION * conn, const char *buf,
 static int mutt_sasl_conn_write (CONNECTION * conn, const char *buf,
-                                 size_t count);
+                                 ssize_t count);
 
 /* utility function, stolen from sasl2 sample code */
 static int iptostring (const struct sockaddr *addr, socklen_t addrlen,
 
 /* utility function, stolen from sasl2 sample code */
 static int iptostring (const struct sockaddr *addr, socklen_t addrlen,
@@ -500,7 +500,7 @@ static int mutt_sasl_conn_close (CONNECTION * conn)
   return rc;
 }
 
   return rc;
 }
 
-static int mutt_sasl_conn_read (CONNECTION * conn, char *buf, size_t len)
+static int mutt_sasl_conn_read (CONNECTION * conn, char *buf, ssize_t len)
 {
   SASL_DATA *sasldata;
   int rc;
 {
   SASL_DATA *sasldata;
   int rc;
@@ -562,7 +562,7 @@ out:
 }
 
 static int mutt_sasl_conn_write (CONNECTION * conn, const char *buf,
 }
 
 static int mutt_sasl_conn_write (CONNECTION * conn, const char *buf,
-                                 size_t len)
+                                 ssize_t len)
 {
   SASL_DATA *sasldata;
   int rc;
 {
   SASL_DATA *sasldata;
   int rc;
index 7cc6ff8..15a5154 100644 (file)
@@ -36,8 +36,8 @@ typedef struct {
   void *sockdata;
   int (*msasl_open) (CONNECTION * conn);
   int (*msasl_close) (CONNECTION * conn);
   void *sockdata;
   int (*msasl_open) (CONNECTION * conn);
   int (*msasl_close) (CONNECTION * conn);
-  int (*msasl_read) (CONNECTION * conn, char *buf, size_t len);
-  int (*msasl_write) (CONNECTION * conn, const char *buf, size_t count);
+  int (*msasl_read) (CONNECTION * conn, char *buf, ssize_t len);
+  int (*msasl_write) (CONNECTION * conn, const char *buf, ssize_t count);
 } SASL_DATA;
 
 #endif /* _MUTT_SASL_H_ */
 } SASL_DATA;
 
 #endif /* _MUTT_SASL_H_ */
index d07c643..2938066 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -67,12 +67,12 @@ BODY *mutt_new_body (void)
  * Renamed to mutt_adv_mktemp so I only have to change where it's
  * called, and not all possible cases.
  */
  * Renamed to mutt_adv_mktemp so I only have to change where it's
  * called, and not all possible cases.
  */
-void mutt_adv_mktemp (const char* dir, char *s, size_t l)
+void mutt_adv_mktemp (const char* dir, char *s, ssize_t l)
 {
   char buf[_POSIX_PATH_MAX];
   char tmp[_POSIX_PATH_MAX];
   char *period;
 {
   char buf[_POSIX_PATH_MAX];
   char tmp[_POSIX_PATH_MAX];
   char *period;
-  size_t sl;
+  ssize_t sl;
   struct stat sb;
 
   m_strcpy(buf, sizeof(buf), m_strisempty(dir) ? NONULL(Tempdir) : dir);
   struct stat sb;
 
   m_strcpy(buf, sizeof(buf), m_strisempty(dir) ? NONULL(Tempdir) : dir);
@@ -230,7 +230,7 @@ int mutt_matches_ignore (const char *s, string_list_t * t)
 void mutt_expand_link (char *newpath, const char *path, const char *lnk)
 {
   const char *lb = NULL;
 void mutt_expand_link (char *newpath, const char *path, const char *lnk)
 {
   const char *lb = NULL;
-  size_t len;
+  ssize_t len;
 
   /* lnk is full path */
   if (*lnk == '/') {
 
   /* lnk is full path */
   if (*lnk == '/') {
@@ -249,12 +249,12 @@ void mutt_expand_link (char *newpath, const char *path, const char *lnk)
   m_strcpy(newpath + len, _POSIX_PATH_MAX - len, lnk);
 }
 
   m_strcpy(newpath + len, _POSIX_PATH_MAX - len, lnk);
 }
 
-char *mutt_expand_path (char *s, size_t slen)
+char *mutt_expand_path (char *s, ssize_t slen)
 {
   return _mutt_expand_path (s, slen, 0);
 }
 
 {
   return _mutt_expand_path (s, slen, 0);
 }
 
-char *_mutt_expand_path (char *s, size_t slen, int rx)
+char *_mutt_expand_path (char *s, ssize_t slen, int rx)
 {
   char p[_POSIX_PATH_MAX] = "";
   char q[_POSIX_PATH_MAX] = "";
 {
   char p[_POSIX_PATH_MAX] = "";
   char q[_POSIX_PATH_MAX] = "";
@@ -320,6 +320,7 @@ char *_mutt_expand_path (char *s, size_t slen, int rx)
     case '@':
       {
         HEADER *h;
     case '@':
       {
         HEADER *h;
+        /* FIXME: BUG ? */
         address_t *alias;
 
         if ((alias = alias_lookup(s + 1))) {
         address_t *alias;
 
         if ((alias = alias_lookup(s + 1))) {
@@ -556,7 +557,7 @@ void _mutt_mktemp (char *s, const char *src, int line)
 void mutt_pretty_mailbox (char *s)
 {
   char *p = s, *q = s;
 void mutt_pretty_mailbox (char *s)
 {
   char *p = s, *q = s;
-  size_t len;
+  ssize_t len;
   url_scheme_t scheme;
 
   scheme = url_check_scheme (s);
   url_scheme_t scheme;
 
   scheme = url_check_scheme (s);
@@ -603,7 +604,7 @@ void mutt_pretty_mailbox (char *s)
   }
 }
 
   }
 }
 
-void mutt_pretty_size (char *s, size_t len, long n)
+void mutt_pretty_size (char *s, ssize_t len, long n)
 {
   if (n == 0)
     m_strcpy(s, len, "0K");
 {
   if (n == 0)
     m_strcpy(s, len, "0K");
@@ -622,7 +623,7 @@ void mutt_pretty_size (char *s, size_t len, long n)
   }
 }
 
   }
 }
 
-void mutt_expand_file_fmt (char *dest, size_t destlen, const char *fmt,
+void mutt_expand_file_fmt (char *dest, ssize_t destlen, const char *fmt,
                            const char *src)
 {
   char tmp[LONG_STRING];
                            const char *src)
 {
   char tmp[LONG_STRING];
@@ -631,12 +632,12 @@ void mutt_expand_file_fmt (char *dest, size_t destlen, const char *fmt,
   mutt_expand_fmt (dest, destlen, fmt, tmp);
 }
 
   mutt_expand_fmt (dest, destlen, fmt, tmp);
 }
 
-void mutt_expand_fmt (char *dest, size_t destlen, const char *fmt,
+void mutt_expand_fmt (char *dest, ssize_t destlen, const char *fmt,
                       const char *src)
 {
   const char *p;
   char *d;
                       const char *src)
 {
   const char *p;
   char *d;
-  size_t slen;
+  ssize_t slen;
   int found = 0;
 
   slen = m_strlen(src);
   int found = 0;
 
   slen = m_strlen(src);
@@ -679,7 +680,7 @@ void mutt_expand_fmt (char *dest, size_t destlen, const char *fmt,
 
 /* return 0 on success, -1 on abort, 1 on error */
 int mutt_check_overwrite (const char *attname, const char *path,
 
 /* return 0 on success, -1 on abort, 1 on error */
 int mutt_check_overwrite (const char *attname, const char *path,
-                          char *fname, size_t flen, int *append,
+                          char *fname, ssize_t flen, int *append,
                           char **directory)
 {
   int rc = 0;
                           char **directory)
 {
   int rc = 0;
@@ -747,7 +748,7 @@ int mutt_check_overwrite (const char *attname, const char *path,
   return 0;
 }
 
   return 0;
 }
 
-void mutt_save_path (char *d, size_t dsize, address_t * a)
+void mutt_save_path (char *d, ssize_t dsize, address_t * a)
 {
   if (a && a->mailbox) {
     m_strcpy(d, dsize, a->mailbox);
 {
   if (a && a->mailbox) {
     m_strcpy(d, dsize, a->mailbox);
@@ -763,7 +764,7 @@ void mutt_save_path (char *d, size_t dsize, address_t * a)
     *d = 0;
 }
 
     *d = 0;
 }
 
-void mutt_safe_path (char *s, size_t l, address_t * a)
+void mutt_safe_path (char *s, ssize_t l, address_t * a)
 {
   char *p;
 
 {
   char *p;
 
@@ -1204,9 +1205,8 @@ int mutt_match_spam_list (const char *s, SPAM_LIST * l, char *text, int x)
     }
 
     /* Does this pattern match? */
     }
 
     /* Does this pattern match? */
-    if (regexec
-        (l->rx->rx, s, (size_t) l->nmatch, (regmatch_t *) pmatch,
-         (int) 0) == 0) {
+    if (regexec(l->rx->rx, s, l->nmatch, (regmatch_t *)pmatch, (int) 0) == 0)
+    {
       debug_print (5, ("%s matches %s\n%d subst", s, l->rx->pattern, l->rx->rx->re_nsub));
 
       /* Copy template into text, with substitutions. */
       debug_print (5, ("%s matches %s\n%d subst", s, l->rx->pattern, l->rx->rx->re_nsub));
 
       /* Copy template into text, with substitutions. */
diff --git a/mx.c b/mx.c
index 8e645c1..c5576d6 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -167,9 +167,9 @@ static int mx_get_idx (const char* path) {
 /* Args:
  *     excl            if excl != 0, request an exclusive lock
  *     dot             if dot != 0, try to dotlock the file
 /* Args:
  *     excl            if excl != 0, request an exclusive lock
  *     dot             if dot != 0, try to dotlock the file
- *     timeout         should retry locking?
+ *     time_out        should retry locking?
  */
  */
-int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout)
+int mx_lock_file (const char *path, int fd, int excl, int dot, int time_out)
 {
 #if defined (USE_FCNTL) || defined (USE_FLOCK)
   int count;
 {
 #if defined (USE_FCNTL) || defined (USE_FLOCK)
   int count;
@@ -206,8 +206,8 @@ int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout)
 
     /* only unlock file if it is unchanged */
     if (prev_sb.st_size == sb.st_size
 
     /* only unlock file if it is unchanged */
     if (prev_sb.st_size == sb.st_size
-        && ++count >= (timeout ? MAXLOCKATTEMPT : 0)) {
-      if (timeout)
+        && ++count >= (time_out ? MAXLOCKATTEMPT : 0)) {
+      if (time_out)
         mutt_error _("Timeout exceeded while attempting fcntl lock!");
 
       return (-1);
         mutt_error _("Timeout exceeded while attempting fcntl lock!");
 
       return (-1);
@@ -240,8 +240,8 @@ int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout)
 
     /* only unlock file if it is unchanged */
     if (prev_sb.st_size == sb.st_size
 
     /* only unlock file if it is unchanged */
     if (prev_sb.st_size == sb.st_size
-        && ++count >= (timeout ? MAXLOCKATTEMPT : 0)) {
-      if (timeout)
+        && ++count >= (time_out ? MAXLOCKATTEMPT : 0)) {
+      if (time_out)
         mutt_error _("Timeout exceeded while attempting flock lock!");
 
       r = -1;
         mutt_error _("Timeout exceeded while attempting flock lock!");
 
       r = -1;
@@ -257,7 +257,7 @@ int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout)
 
 #ifdef USE_DOTLOCK
   if (r == 0 && dot)
 
 #ifdef USE_DOTLOCK
   if (r == 0 && dot)
-    r = dotlock_file (path, fd, timeout);
+    r = dotlock_file (path, fd, time_out);
 #endif /* USE_DOTLOCK */
 
   if (r == -1) {
 #endif /* USE_DOTLOCK */
 
   if (r == -1) {
index 29b427c..e9709f7 100644 (file)
@@ -58,7 +58,7 @@ static int nntp_parse_newsrc_line (NNTP_SERVER * news, char *line)
   char group[LONG_STRING];
   int x = 1;
   char *p = line, *b, *h;
   char group[LONG_STRING];
   int x = 1;
   char *p = line, *b, *h;
-  size_t len;
+  ssize_t len;
 
   while (*p) {
     if (*p++ == ',')
 
   while (*p) {
     if (*p++ == ',')
@@ -172,7 +172,7 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news)
   struct stat st;
   char buf[HUGE_STRING], *cp;
   char dir[_POSIX_PATH_MAX], file[_POSIX_PATH_MAX];
   struct stat st;
   char buf[HUGE_STRING], *cp;
   char dir[_POSIX_PATH_MAX], file[_POSIX_PATH_MAX];
-  FILE *index;
+  FILE *idx;
   NNTP_DATA *data;
   int l, m, t;
 
   NNTP_DATA *data;
   int l, m, t;
 
@@ -202,16 +202,16 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news)
 
   p_delete(&news->cache);
   snprintf (buf, sizeof (buf), "%s/.index", dir);
 
   p_delete(&news->cache);
   snprintf (buf, sizeof (buf), "%s/.index", dir);
-  if (!(index = safe_fopen (buf, "a+")))
+  if (!(idx = safe_fopen (buf, "a+")))
     return 0;
     return 0;
-  rewind (index);
-  while (fgets (buf, sizeof (buf), index)) {
+  rewind (idx);
+  while (fgets (buf, sizeof (buf), idx)) {
     buf[m_strlen(buf) - 1] = 0;  /* strip ending '\n' */
     if (!m_strncmp(buf, "#: ", 3) &&
         !m_strcasecmp(buf + 3, news->conn->account.host))
       break;
   }
     buf[m_strlen(buf) - 1] = 0;  /* strip ending '\n' */
     if (!m_strncmp(buf, "#: ", 3) &&
         !m_strcasecmp(buf + 3, news->conn->account.host))
       break;
   }
-  while (fgets (buf, sizeof (buf), index)) {
+  while (fgets (buf, sizeof (buf), idx)) {
     cp = buf;
     while (*cp && *cp != ' ')
       cp++;
     cp = buf;
     while (*cp && *cp != ' ')
       cp++;
@@ -251,11 +251,11 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news)
         mutt_newsgroup_stat (data);
     }
   }
         mutt_newsgroup_stat (data);
     }
   }
-  fclose (index);
+  fclose (idx);
   return 0;
 }
 
   return 0;
 }
 
-const char *nntp_format_str (char *dest, size_t destlen, char op,
+const char *nntp_format_str (char *dest, ssize_t destlen, char op,
                              const char *src, const char *fmt,
                              const char *ifstring, const char *elsestring,
                              unsigned long data, format_flag flags)
                              const char *src, const char *fmt,
                              const char *ifstring, const char *elsestring,
                              unsigned long data, format_flag flags)
@@ -275,44 +275,44 @@ const char *nntp_format_str (char *dest, size_t destlen, char op,
 
 /* nntp_parse_url: given an NNPT URL, return host, port,
  * username, password and newsgroup will recognise. */
 
 /* nntp_parse_url: given an NNPT URL, return host, port,
  * username, password and newsgroup will recognise. */
-int nntp_parse_url (const char *server, ACCOUNT * acct,
-                    char *group, size_t group_len)
+int nntp_parse_url (const char *server, ACCOUNT * act,
+                    char *group, ssize_t group_len)
 {
   ciss_url_t url;
   char *c;
   int ret = -1;
 
   /* Defaults */
 {
   ciss_url_t url;
   char *c;
   int ret = -1;
 
   /* Defaults */
-  acct->flags = 0;
-  acct->port = NNTP_PORT;
-  acct->type = M_ACCT_TYPE_NNTP;
+  act->flags = 0;
+  act->port = NNTP_PORT;
+  act->type = M_ACCT_TYPE_NNTP;
 
   c = m_strdup(server);
   url_parse_ciss (&url, c);
 
   if (url.scheme == U_NNTP || url.scheme == U_NNTPS) {
     if (url.scheme == U_NNTPS) {
 
   c = m_strdup(server);
   url_parse_ciss (&url, c);
 
   if (url.scheme == U_NNTP || url.scheme == U_NNTPS) {
     if (url.scheme == U_NNTPS) {
-      acct->flags |= M_ACCT_SSL;
-      acct->port = NNTP_SSL_PORT;
+      act->flags |= M_ACCT_SSL;
+      act->port = NNTP_SSL_PORT;
     }
 
     *group = '\0';
     if (url.path)
       m_strcpy(group, group_len, url.path);
 
     }
 
     *group = '\0';
     if (url.path)
       m_strcpy(group, group_len, url.path);
 
-    ret = mutt_account_fromurl (acct, &url);
+    ret = mutt_account_fromurl (act, &url);
   }
 
   p_delete(&c);
   return ret;
 }
 
   }
 
   p_delete(&c);
   return ret;
 }
 
-void nntp_expand_path (char *line, size_t len, ACCOUNT * acct)
+void nntp_expand_path (char *line, ssize_t len, ACCOUNT * act)
 {
   ciss_url_t url;
 
   url.path = m_strdup(line);
 {
   ciss_url_t url;
 
   url.path = m_strdup(line);
-  mutt_account_tourl (acct, &url);
+  mutt_account_tourl (act, &url);
   url_ciss_tostring (&url, line, len, 0);
   p_delete(&url.path);
 }
   url_ciss_tostring (&url, line, len, 0);
   p_delete(&url.path);
 }
@@ -332,11 +332,11 @@ NNTP_SERVER *mutt_select_newsserver (char *server)
   char file[_POSIX_PATH_MAX];
   char *buf, *p;
   string_list_t *list;
   char file[_POSIX_PATH_MAX];
   char *buf, *p;
   string_list_t *list;
-  ACCOUNT acct;
+  ACCOUNT act;
   NNTP_SERVER *serv;
   CONNECTION *conn;
 
   NNTP_SERVER *serv;
   CONNECTION *conn;
 
-  p_clear(&acct, 1);
+  p_clear(&act, 1);
 
   if (!server || !*server) {
     mutt_error _("No newsserver defined!");
 
   if (!server || !*server) {
     mutt_error _("No newsserver defined!");
@@ -351,14 +351,14 @@ NNTP_SERVER *mutt_select_newsserver (char *server)
   }
   strcpy (p, server);
 
   }
   strcpy (p, server);
 
-  if ((nntp_parse_url (buf, &acct, file, sizeof (file))) < 0 || *file) {
+  if ((nntp_parse_url (buf, &act, file, sizeof (file))) < 0 || *file) {
     p_delete(&buf);
     mutt_error (_("%s is an invalid newsserver specification!"), server);
     return NULL;
   }
   p_delete(&buf);
 
     p_delete(&buf);
     mutt_error (_("%s is an invalid newsserver specification!"), server);
     return NULL;
   }
   p_delete(&buf);
 
-  conn = mutt_conn_find (NULL, &acct);
+  conn = mutt_conn_find (NULL, &act);
   if (!conn)
     return NULL;
 
   if (!conn)
     return NULL;
 
@@ -499,10 +499,10 @@ static int puti (char *line, int num)
 }
 
 static void nntp_create_newsrc_line (NNTP_DATA * data, char **buf,
 }
 
 static void nntp_create_newsrc_line (NNTP_DATA * data, char **buf,
-                                     char **pline, size_t * buflen)
+                                     char **pline, ssize_t * buflen)
 {
   char *line = *pline;
 {
   char *line = *pline;
-  size_t len = *buflen - (*pline - *buf);
+  ssize_t len = *buflen - (*pline - *buf);
   int x, i;
 
   if (len < LONG_STRING * 10) {
   int x, i;
 
   if (len < LONG_STRING * 10) {
@@ -747,7 +747,7 @@ int mutt_newsrc_update (NNTP_SERVER * news)
   NNTP_DATA *data;
   string_list_t *tmp;
   int r = -1;
   NNTP_DATA *data;
   string_list_t *tmp;
   int r = -1;
-  size_t len, llen;
+  ssize_t len, llen;
 
   if (!news)
     return -1;
 
   if (!news)
     return -1;
@@ -1077,7 +1077,7 @@ NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER * news, char *group)
 }
 
 /* this routine gives the first newsgroup with new messages */
 }
 
 /* this routine gives the first newsgroup with new messages */
-void nntp_buffy (char* dst, size_t dstlen) {
+void nntp_buffy (char* dst, ssize_t dstlen) {
   string_list_t *list;
   int count = 0;
 
   string_list_t *list;
   int count = 0;
 
index 2977f0c..7eae011 100644 (file)
@@ -370,7 +370,7 @@ static int mutt_nntp_fetch (NNTP_DATA * nntp_data, const char *query, char *msg,
       m_strcpy(inbuf + lenbuf, sizeof(buf), p);
       pos += chunk;
 
       m_strcpy(inbuf + lenbuf, sizeof(buf), p);
       pos += chunk;
 
-      if (chunk >= sizeof (buf)) {
+      if (chunk >= ssizeof (buf)) {
         lenbuf += m_strlen(p);
       }
       else {
         lenbuf += m_strlen(p);
       }
       else {
@@ -848,18 +848,18 @@ int nntp_open_mailbox (CONTEXT * ctx)
   char server[LONG_STRING];
   int count = 0;
   unsigned int first;
   char server[LONG_STRING];
   int count = 0;
   unsigned int first;
-  ACCOUNT acct;
+  ACCOUNT act;
 
 
-  p_clear(&acct, 1);
+  p_clear(&act, 1);
 
 
-  if (nntp_parse_url (ctx->path, &acct, buf, sizeof (buf)) < 0 || !*buf) {
+  if (nntp_parse_url (ctx->path, &act, buf, sizeof (buf)) < 0 || !*buf) {
     mutt_error (_("%s is an invalid newsgroup specification!"), ctx->path);
     mutt_sleep (2);
     return -1;
   }
 
   server[0] = '\0';
     mutt_error (_("%s is an invalid newsgroup specification!"), ctx->path);
     mutt_sleep (2);
     return -1;
   }
 
   server[0] = '\0';
-  nntp_expand_path (server, sizeof (server), &acct);
+  nntp_expand_path (server, sizeof (server), &act);
   if (!(serv = mutt_select_newsserver (server)) || serv->status != NNTP_OK)
     return -1;
 
   if (!(serv = mutt_select_newsserver (server)) || serv->status != NNTP_OK)
     return -1;
 
index a111b67..8ddac27 100644 (file)
@@ -85,7 +85,7 @@ int nntp_get_cache_all (NNTP_SERVER *);
 int nntp_save_cache_index (NNTP_SERVER *);
 int nntp_check_newgroups (NNTP_SERVER *, int);
 int nntp_save_cache_group (CONTEXT *);
 int nntp_save_cache_index (NNTP_SERVER *);
 int nntp_check_newgroups (NNTP_SERVER *, int);
 int nntp_save_cache_group (CONTEXT *);
-int nntp_parse_url (const char *, ACCOUNT *, char *, size_t);
+int nntp_parse_url (const char *, ACCOUNT *, char *, ssize_t);
 void newsrc_gen_entries (CONTEXT *);
 void nntp_get_status (CONTEXT *, HEADER *, char *, int);
 void mutt_newsgroup_stat (NNTP_DATA *);
 void newsrc_gen_entries (CONTEXT *);
 void nntp_get_status (CONTEXT *, HEADER *, char *, int);
 void mutt_newsgroup_stat (NNTP_DATA *);
@@ -111,10 +111,10 @@ int nntp_fetch_message (MESSAGE *, CONTEXT *, int);
 int nntp_post (const char *);
 int nntp_check_msgid (CONTEXT *, const char *);
 int nntp_check_children (CONTEXT *, const char *);
 int nntp_post (const char *);
 int nntp_check_msgid (CONTEXT *, const char *);
 int nntp_check_children (CONTEXT *, const char *);
-void nntp_buffy (char* dst, size_t dstlen);
-void nntp_expand_path (char *, size_t, ACCOUNT *);
+void nntp_buffy (char* dst, ssize_t dstlen);
+void nntp_expand_path (char *, ssize_t, ACCOUNT *);
 void nntp_logout_all ();
 void nntp_logout_all ();
-const char *nntp_format_str (char *, size_t, char, const char *, const char *,
+const char *nntp_format_str (char *, ssize_t, char, const char *, const char *,
                              const char *, const char *, unsigned long,
                              format_flag);
 void nntp_sync_sidebar (NNTP_DATA*);
                              const char *, const char *, unsigned long,
                              format_flag);
 void nntp_sync_sidebar (NNTP_DATA*);
index c4eb3c4..e07377f 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -1143,7 +1143,7 @@ static void quote_simple (char *tmp, ssize_t len, const char *p)
 }
 
 /* convert a simple search into a real request */
 }
 
 /* convert a simple search into a real request */
-void mutt_check_simple (char *s, size_t len, const char *simple)
+void mutt_check_simple (char *s, ssize_t len, const char *simple)
 {
   char tmp[LONG_STRING];
 
 {
   char tmp[LONG_STRING];
 
index a8c2616..0bc06f5 100644 (file)
--- a/pop/pop.c
+++ b/pop/pop.c
@@ -50,7 +50,7 @@ static int fetch_message (char *line, void *file)
 static pop_query_status pop_read_header (POP_DATA * pop_data, HEADER * h)
 {
   FILE *f;
 static pop_query_status pop_read_header (POP_DATA * pop_data, HEADER * h)
 {
   FILE *f;
-  int index;
+  int idx;
   pop_query_status ret;
   long length;
   char buf[LONG_STRING];
   pop_query_status ret;
   long length;
   char buf[LONG_STRING];
@@ -65,7 +65,7 @@ static pop_query_status pop_read_header (POP_DATA * pop_data, HEADER * h)
   snprintf (buf, sizeof (buf), "string_list_t %d\r\n", h->refno);
   ret = pop_query (pop_data, buf, sizeof (buf));
   if (ret == PQ_OK) {
   snprintf (buf, sizeof (buf), "string_list_t %d\r\n", h->refno);
   ret = pop_query (pop_data, buf, sizeof (buf));
   if (ret == PQ_OK) {
-    sscanf (buf, "+OK %d %ld", &index, &length);
+    sscanf (buf, "+OK %d %ld", &idx, &length);
 
     snprintf (buf, sizeof (buf), "TOP %d 0\r\n", h->refno);
     ret = pop_fetch_data (pop_data, buf, NULL, fetch_message, f);
 
     snprintf (buf, sizeof (buf), "TOP %d 0\r\n", h->refno);
     ret = pop_fetch_data (pop_data, buf, NULL, fetch_message, f);
@@ -126,17 +126,17 @@ static pop_query_status pop_read_header (POP_DATA * pop_data, HEADER * h)
 /* parse UIDL */
 static int fetch_uidl (char *line, void *data)
 {
 /* parse UIDL */
 static int fetch_uidl (char *line, void *data)
 {
-  int i, index;
+  int i, idx;
   CONTEXT *ctx = (CONTEXT *) data;
   POP_DATA *pop_data = (POP_DATA *) ctx->data;
 
   CONTEXT *ctx = (CONTEXT *) data;
   POP_DATA *pop_data = (POP_DATA *) ctx->data;
 
-  sscanf (line, "%d %s", &index, line);
+  sscanf (line, "%d %s", &idx, line);
   for (i = 0; i < ctx->msgcount; i++)
     if (!m_strcmp(line, ctx->hdrs[i]->data))
       break;
 
   if (i == ctx->msgcount) {
   for (i = 0; i < ctx->msgcount; i++)
     if (!m_strcmp(line, ctx->hdrs[i]->data))
       break;
 
   if (i == ctx->msgcount) {
-    debug_print (1, ("new header %d %s\n", index, line));
+    debug_print (1, ("new header %d %s\n", idx, line));
 
     if (i >= ctx->hdrmax)
       mx_alloc_memory (ctx);
 
     if (i >= ctx->hdrmax)
       mx_alloc_memory (ctx);
@@ -145,11 +145,11 @@ static int fetch_uidl (char *line, void *data)
     ctx->hdrs[i] = header_new();
     ctx->hdrs[i]->data = m_strdup(line);
   }
     ctx->hdrs[i] = header_new();
     ctx->hdrs[i]->data = m_strdup(line);
   }
-  else if (ctx->hdrs[i]->index != index - 1)
+  else if (ctx->hdrs[i]->index != idx - 1)
     pop_data->clear_cache = 1;
 
     pop_data->clear_cache = 1;
 
-  ctx->hdrs[i]->refno = index;
-  ctx->hdrs[i]->index = index - 1;
+  ctx->hdrs[i]->refno = idx;
+  ctx->hdrs[i]->index = idx - 1;
 
   return 0;
 }
 
   return 0;
 }
@@ -231,20 +231,20 @@ int pop_open_mailbox (CONTEXT * ctx)
   int ret;
   char buf[LONG_STRING];
   CONNECTION *conn;
   int ret;
   char buf[LONG_STRING];
   CONNECTION *conn;
-  ACCOUNT acct;
+  ACCOUNT act;
   POP_DATA *pop_data;
   ciss_url_t url;
 
   POP_DATA *pop_data;
   ciss_url_t url;
 
-  if (pop_parse_path (ctx->path, &acct)) {
+  if (pop_parse_path (ctx->path, &act)) {
     mutt_error (_("%s is an invalid POP path"), ctx->path);
     mutt_sleep (2);
     return -1;
   }
 
     mutt_error (_("%s is an invalid POP path"), ctx->path);
     mutt_sleep (2);
     return -1;
   }
 
-  mutt_account_tourl (&acct, &url);
+  mutt_account_tourl (&act, &url);
   url.path = NULL;
   url_ciss_tostring (&url, buf, sizeof (buf), 0);
   url.path = NULL;
   url_ciss_tostring (&url, buf, sizeof (buf), 0);
-  conn = mutt_conn_find (NULL, &acct);
+  conn = mutt_conn_find (NULL, &act);
   if (!conn)
     return -1;
 
   if (!conn)
     return -1;
 
@@ -516,7 +516,7 @@ void pop_fetch_mail (void)
   CONNECTION *conn;
   CONTEXT ctx;
   MESSAGE *msg = NULL;
   CONNECTION *conn;
   CONTEXT ctx;
   MESSAGE *msg = NULL;
-  ACCOUNT acct;
+  ACCOUNT act;
   POP_DATA *pop_data;
 
   if (!PopHost) {
   POP_DATA *pop_data;
 
   if (!PopHost) {
@@ -532,14 +532,14 @@ void pop_fetch_mail (void)
   }
   strcpy (p, PopHost);          /* __STRCPY_CHECKED__ */
 
   }
   strcpy (p, PopHost);          /* __STRCPY_CHECKED__ */
 
-  ret = pop_parse_path (url, &acct);
+  ret = pop_parse_path (url, &act);
   p_delete(&url);
   if (ret) {
     mutt_error (_("%s is an invalid POP path"), PopHost);
     return;
   }
 
   p_delete(&url);
   if (ret) {
     mutt_error (_("%s is an invalid POP path"), PopHost);
     return;
   }
 
-  conn = mutt_conn_find (NULL, &acct);
+  conn = mutt_conn_find (NULL, &act);
   if (!conn)
     return;
 
   if (!conn)
     return;
 
index 5fa6271..f1a570a 100644 (file)
--- a/pop/pop.h
+++ b/pop/pop.h
@@ -40,7 +40,7 @@ typedef enum {
 } pop_auth_res_t;
 
 typedef struct {
 } pop_auth_res_t;
 
 typedef struct {
-  unsigned int index;
+  int index;
   char *path;
 } POP_CACHE;
 
   char *path;
 } POP_CACHE;
 
index adb47d7..878c20f 100644 (file)
@@ -192,12 +192,12 @@ static pop_auth_res_t pop_auth_apop (POP_DATA * pop_data, const char *method)
              strlen (pop_data->conn->account.pass));
   MD5Final (digest, &mdContext);
 
              strlen (pop_data->conn->account.pass));
   MD5Final (digest, &mdContext);
 
-  for (i = 0; i < sizeof (digest); i++)
+  for (i = 0; i < ssizeof(digest); i++)
     sprintf (hash + 2 * i, "%02x", digest[i]);
 
   /* Send APOP command to server */
     sprintf (hash + 2 * i, "%02x", digest[i]);
 
   /* Send APOP command to server */
-  snprintf (buf, sizeof (buf), "APOP %s %s\r\n", pop_data->conn->account.user,
-            hash);
+  snprintf(buf, sizeof(buf), "APOP %s %s\r\n", pop_data->conn->account.user,
+           hash);
 
   switch (pop_query (pop_data, buf, sizeof (buf))) {
   case PQ_OK:
 
   switch (pop_query (pop_data, buf, sizeof (buf))) {
   case PQ_OK:
@@ -291,7 +291,7 @@ static pop_auth_t pop_authenticators[] = {
 */
 pop_query_status pop_authenticate (POP_DATA * pop_data)
 {
 */
 pop_query_status pop_authenticate (POP_DATA * pop_data)
 {
-  ACCOUNT *acct = &pop_data->conn->account;
+  ACCOUNT *act = &pop_data->conn->account;
   pop_auth_t *authenticator;
   char *methods;
   char *comma;
   pop_auth_t *authenticator;
   char *methods;
   char *comma;
@@ -299,8 +299,8 @@ pop_query_status pop_authenticate (POP_DATA * pop_data)
   int attempts = 0;
   int ret = POP_A_UNAVAIL;
 
   int attempts = 0;
   int ret = POP_A_UNAVAIL;
 
-  if (mutt_account_getuser (acct) || !acct->user[0] ||
-      mutt_account_getpass (acct) || !acct->pass[0])
+  if (mutt_account_getuser (act) || !act->user[0] ||
+      mutt_account_getpass (act) || !act->pass[0])
     return PFD_FUNCT_ERROR;
 
   if (PopAuthenticators && *PopAuthenticators) {
     return PFD_FUNCT_ERROR;
 
   if (PopAuthenticators && *PopAuthenticators) {
index b1cab50..0052e5d 100644 (file)
 #endif
 
 /* given an POP mailbox name, return host, port, username and password */
 #endif
 
 /* given an POP mailbox name, return host, port, username and password */
-int pop_parse_path (const char *path, ACCOUNT * acct)
+int pop_parse_path (const char *path, ACCOUNT * act)
 {
   ciss_url_t url;
   char *c;
   int ret = -1;
 
   /* Defaults */
 {
   ciss_url_t url;
   char *c;
   int ret = -1;
 
   /* Defaults */
-  acct->flags = 0;
-  acct->port = POP_PORT;
-  acct->type = M_ACCT_TYPE_POP;
+  act->flags = 0;
+  act->port = POP_PORT;
+  act->type = M_ACCT_TYPE_POP;
 
   c = m_strdup(path);
   url_parse_ciss (&url, c);
 
   if (url.scheme == U_POP || url.scheme == U_POPS) {
     if (url.scheme == U_POPS) {
 
   c = m_strdup(path);
   url_parse_ciss (&url, c);
 
   if (url.scheme == U_POP || url.scheme == U_POPS) {
     if (url.scheme == U_POPS) {
-      acct->flags |= M_ACCT_SSL;
-      acct->port = POP_SSL_PORT;
+      act->flags |= M_ACCT_SSL;
+      act->port = POP_SSL_PORT;
     }
 
     }
 
-    if ((!url.path || !*url.path) && mutt_account_fromurl (acct, &url) == 0)
+    if ((!url.path || !*url.path) && mutt_account_fromurl (act, &url) == 0)
       ret = 0;
   }
 
       ret = 0;
   }
 
@@ -461,10 +461,9 @@ pop_query_status pop_fetch_data (POP_DATA * pop_data, const char *query, progres
     m_strcpy(inbuf + lenbuf,sizeof(buf), p);
     pos += chunk;
 
     m_strcpy(inbuf + lenbuf,sizeof(buf), p);
     pos += chunk;
 
-    if (chunk >= sizeof (buf)) {
+    if (chunk >= ssizeof(buf)) {
       lenbuf += strlen (p);
       lenbuf += strlen (p);
-    }
-    else {
+    } else {
       if (bar)
         mutt_progress_bar (bar, pos);
       if (ret == 0 && funct (inbuf, data) < 0)
       if (bar)
         mutt_progress_bar (bar, pos);
       if (ret == 0 && funct (inbuf, data) < 0)
@@ -482,14 +481,13 @@ pop_query_status pop_fetch_data (POP_DATA * pop_data, const char *query, progres
 /* find message with this UIDL and set refno */
 static int check_uidl (char *line, void *data)
 {
 /* find message with this UIDL and set refno */
 static int check_uidl (char *line, void *data)
 {
-  int i;
-  unsigned int index;
-  CONTEXT *ctx = (CONTEXT *) data;
+  int i, idx;
+  CONTEXT *ctx = (CONTEXT *)data;
 
 
-  sscanf (line, "%u %s", &index, line);
+  sscanf (line, "%u %s", &idx, line);
   for (i = 0; i < ctx->msgcount; i++) {
     if (!m_strcmp(ctx->hdrs[i]->data, line)) {
   for (i = 0; i < ctx->msgcount; i++) {
     if (!m_strcmp(ctx->hdrs[i]->data, line)) {
-      ctx->hdrs[i]->refno = index;
+      ctx->hdrs[i]->refno = idx;
       break;
     }
   }
       break;
     }
   }
index 0087e3f..b5193ec 100644 (file)
@@ -229,7 +229,7 @@ static HEADER *select_msg (void)
  *     SENDREPLY       recalled message is a reply
  */
 int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc,
  *     SENDREPLY       recalled message is a reply
  */
 int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc,
-                        size_t fcclen)
+                        ssize_t fcclen)
 {
   HEADER *h;
   int code = SENDPOSTPONED;
 {
   HEADER *h;
   int code = SENDPOSTPONED;
index aee7bbe..2d11aac 100644 (file)
--- a/protos.h
+++ b/protos.h
 #define MoreArgs(p) (*p->dptr && *p->dptr != ';' && *p->dptr != '#')
 
 #define mutt_make_string(A,B,C,D,E) _mutt_make_string(A,B,C,D,E,0)
 #define MoreArgs(p) (*p->dptr && *p->dptr != ';' && *p->dptr != '#')
 
 #define mutt_make_string(A,B,C,D,E) _mutt_make_string(A,B,C,D,E,0)
-void _mutt_make_string (char *, size_t, const char *, CONTEXT *,
+void _mutt_make_string (char *, ssize_t, const char *, CONTEXT *,
                         HEADER *, format_flag);
 
 #define mutt_new_enter_state() p_new(ENTER_STATE, 1)
 
                         HEADER *, format_flag);
 
 #define mutt_new_enter_state() p_new(ENTER_STATE, 1)
 
-typedef const char *format_t (char *, size_t, char, const char *,
+typedef const char *format_t (char *, ssize_t, char, const char *,
                               const char *, const char *, const char *,
                               unsigned long, format_flag);
 
                               const char *, const char *, const char *,
                               unsigned long, format_flag);
 
@@ -44,7 +44,7 @@ void set_quadoption (int, int);
 int query_quadoption (int, const char *);
 int quadoption (int);
 
 int query_quadoption (int, const char *);
 int quadoption (int);
 
-int mutt_option_value (const char* val, char* dst, size_t dstlen);
+int mutt_option_value (const char* val, char* dst, ssize_t dstlen);
 
 address_t *mutt_default_from (void);
 address_t *mutt_remove_duplicates (address_t *);
 
 address_t *mutt_default_from (void);
 address_t *mutt_remove_duplicates (address_t *);
@@ -71,19 +71,19 @@ int mutt_cmp_body (const BODY * b1, const BODY * b2);
 time_t mutt_decrease_mtime (const char *, struct stat *);
 void mutt_set_mtime (const char*, const char*);
 time_t mutt_parse_date (const char *, HEADER *);
 time_t mutt_decrease_mtime (const char *, struct stat *);
 void mutt_set_mtime (const char*, const char*);
 time_t mutt_parse_date (const char *, HEADER *);
-int is_from (const char *, char *, size_t, time_t *);
+int is_from (const char *, char *, ssize_t, time_t *);
 
 char *mutt_charset_hook (const char *);
 char *mutt_iconv_hook (const char *);
 
 char *mutt_charset_hook (const char *);
 char *mutt_iconv_hook (const char *);
-char *mutt_expand_path (char *, size_t);
-char *_mutt_expand_path (char *, size_t, int);
+char *mutt_expand_path (char *, ssize_t);
+char *_mutt_expand_path (char *, ssize_t, int);
 char *mutt_find_hook (int, const char *);
 char *mutt_gen_msgid (void);
 char *mutt_find_hook (int, const char *);
 char *mutt_gen_msgid (void);
-char *mutt_get_body_charset (char *, size_t, BODY *);
+char *mutt_get_body_charset (char *, ssize_t, BODY *);
 const char *mutt_get_name (address_t *);
 char *mutt_get_parameter (const char *, PARAMETER *);
 char *mutt_crypt_hook (address_t *);
 const char *mutt_get_name (address_t *);
 char *mutt_get_parameter (const char *, PARAMETER *);
 char *mutt_crypt_hook (address_t *);
-char *mutt_make_date (char *, size_t);
+char *mutt_make_date (char *, ssize_t);
 
 const char *mutt_make_version (int full);
 
 
 const char *mutt_make_version (int full);
 
@@ -92,40 +92,40 @@ const char *mutt_fqdn (short);
 void mutt_account_hook (const char *url);
 void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv,
                                     string_list_t *** pp, string_list_t *** qq);
 void mutt_account_hook (const char *url);
 void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv,
                                     string_list_t *** pp, string_list_t *** qq);
-void mutt_adv_mktemp (const char*, char*, size_t);
+void mutt_adv_mktemp (const char*, char*, ssize_t);
 int mutt_bounce_message (FILE * fp, HEADER *, address_t *);
 int mutt_bounce_message (FILE * fp, HEADER *, address_t *);
-void mutt_canonical_charset (char *, size_t, const char *);
+void mutt_canonical_charset (char *, ssize_t, const char *);
 void mutt_check_rescore (CONTEXT *);
 void mutt_clear_error (void);
 void mutt_check_rescore (CONTEXT *);
 void mutt_clear_error (void);
-void mutt_default_save (char *, size_t, HEADER *);
+void mutt_default_save (char *, ssize_t, HEADER *);
 void mutt_display_address (ENVELOPE *);
 void mutt_display_sanitize (char *);
 void mutt_edit_content_type (HEADER *, BODY *, FILE *);
 void mutt_edit_file (const char *, const char *);
 void mutt_display_address (ENVELOPE *);
 void mutt_display_sanitize (char *);
 void mutt_edit_content_type (HEADER *, BODY *, FILE *);
 void mutt_edit_file (const char *, const char *);
-void mutt_edit_headers (const char *, const char *, HEADER *, char *, size_t);
+void mutt_edit_headers (const char *, const char *, HEADER *, char *, ssize_t);
 void mutt_curses_error (const char *, ...);
 void mutt_curses_message (const char *, ...);
 void mutt_enter_command (void);
 void mutt_curses_error (const char *, ...);
 void mutt_curses_message (const char *, ...);
 void mutt_enter_command (void);
-void mutt_expand_file_fmt (char *, size_t, const char *, const char *);
-void mutt_expand_fmt (char *, size_t, const char *, const char *);
+void mutt_expand_file_fmt (char *, ssize_t, const char *, const char *);
+void mutt_expand_fmt (char *, ssize_t, const char *, const char *);
 void mutt_expand_link (char *, const char *, const char *);
 void mutt_fix_reply_recipients (ENVELOPE * env);
 void mutt_folder_hook (char *);
 void mutt_format_string (char *, ssize_t, int, int, int, char, const char *,
                          ssize_t, int);
 void mutt_expand_link (char *, const char *, const char *);
 void mutt_fix_reply_recipients (ENVELOPE * env);
 void mutt_folder_hook (char *);
 void mutt_format_string (char *, ssize_t, int, int, int, char, const char *,
                          ssize_t, int);
-void mutt_format_s (char *, size_t, const char *, const char *);
-void mutt_format_s_tree (char *, size_t, const char *, const char *);
+void mutt_format_s (char *, ssize_t, const char *, const char *);
+void mutt_format_s_tree (char *, ssize_t, const char *, const char *);
 void mutt_forward_intro (FILE * fp, HEADER * cur);
 void mutt_forward_trailer (FILE * fp);
 void mutt_free_body (BODY **);
 void mutt_free_color (int fg, int bg);
 void mutt_forward_intro (FILE * fp, HEADER * cur);
 void mutt_forward_trailer (FILE * fp);
 void mutt_free_body (BODY **);
 void mutt_free_color (int fg, int bg);
-void mutt_generate_header (char *, size_t, HEADER *, int);
+void mutt_generate_header (char *, ssize_t, HEADER *, int);
 void mutt_help (int);
 void mutt_draw_tree (CONTEXT *);
 void mutt_make_attribution (CONTEXT * ctx, HEADER * cur, FILE * out);
 void mutt_make_forward_subject (ENVELOPE * env, CONTEXT * ctx, HEADER * cur);
 void mutt_help (int);
 void mutt_draw_tree (CONTEXT *);
 void mutt_make_attribution (CONTEXT * ctx, HEADER * cur, FILE * out);
 void mutt_make_forward_subject (ENVELOPE * env, CONTEXT * ctx, HEADER * cur);
-void mutt_make_help (char *, size_t, char *, int, int);
-char *mutt_compile_help(char *, size_t, int, struct mapping_t *);
+void mutt_make_help (char *, ssize_t, char *, int, int);
+char *mutt_compile_help(char *, ssize_t, int, struct mapping_t *);
 void mutt_make_misc_reply_headers (ENVELOPE * env, CONTEXT * ctx,
                                    HEADER * cur, ENVELOPE * curenv);
 void mutt_make_post_indent (CONTEXT * ctx, HEADER * cur, FILE * out);
 void mutt_make_misc_reply_headers (ENVELOPE * env, CONTEXT * ctx,
                                    HEADER * cur, ENVELOPE * curenv);
 void mutt_make_post_indent (CONTEXT * ctx, HEADER * cur, FILE * out);
@@ -141,18 +141,18 @@ void _mutt_perror (const char*, const char*,int);
 void mutt_prepare_envelope (ENVELOPE *, int);
 void mutt_unprepare_envelope (ENVELOPE *);
 void mutt_pretty_mailbox (char *);
 void mutt_prepare_envelope (ENVELOPE *, int);
 void mutt_unprepare_envelope (ENVELOPE *);
 void mutt_pretty_mailbox (char *);
-void mutt_pretty_size (char *, size_t, long);
+void mutt_pretty_size (char *, ssize_t, long);
 void mutt_pipe_message (HEADER *);
 void mutt_print_message (HEADER *);
 void mutt_query_exit (void);
 void mutt_pipe_message (HEADER *);
 void mutt_print_message (HEADER *);
 void mutt_query_exit (void);
-void mutt_query_menu (char *, size_t);
-void mutt_safe_path (char *s, size_t l, address_t * a);
-void mutt_save_path (char *s, size_t l, address_t * a);
+void mutt_query_menu (char *, ssize_t);
+void mutt_safe_path (char *s, ssize_t l, address_t * a);
+void mutt_save_path (char *s, ssize_t l, address_t * a);
 void mutt_score_message (CONTEXT *, HEADER *, int);
 void mutt_score_message (CONTEXT *, HEADER *, int);
-void mutt_select_fcc (char *, size_t, HEADER *);
+void mutt_select_fcc (char *, ssize_t, HEADER *);
 
 #define mutt_select_file(A,B,C) _mutt_select_file(A,B,C,NULL,NULL)
 
 #define mutt_select_file(A,B,C) _mutt_select_file(A,B,C,NULL,NULL)
-void _mutt_select_file (char *, size_t, int, char ***, int *);
+void _mutt_select_file (char *, ssize_t, int, char ***, int *);
 void mutt_message_hook (CONTEXT *, HEADER *, int);
 void _mutt_set_flag (CONTEXT *, HEADER *, int, int, int);
 
 void mutt_message_hook (CONTEXT *, HEADER *, int);
 void _mutt_set_flag (CONTEXT *, HEADER *, int, int, int);
 
@@ -177,12 +177,12 @@ int mutt_change_flag (HEADER *, int);
 int mutt_check_key (const char *);
 int mutt_check_menu (const char *);
 int mutt_check_month (const char *);
 int mutt_check_key (const char *);
 int mutt_check_menu (const char *);
 int mutt_check_month (const char *);
-int mutt_check_overwrite (const char *, const char *, char *, size_t, int *,
+int mutt_check_overwrite (const char *, const char *, char *, ssize_t, int *,
                           char **);
 int mutt_check_traditional_pgp (HEADER *, int *);
                           char **);
 int mutt_check_traditional_pgp (HEADER *, int *);
-int mutt_command_complete (char *, size_t, int, int);
-int mutt_var_value_complete (char *, size_t, int);
-int mutt_complete (char *, size_t);
+int mutt_command_complete (char *, ssize_t, int, int);
+int mutt_var_value_complete (char *, ssize_t, int);
+int mutt_complete (char *, ssize_t);
 int mutt_copy_body (FILE *, BODY **, BODY *);
 
 int mutt_display_message (HEADER * h);
 int mutt_copy_body (FILE *, BODY **, BODY *);
 
 int mutt_display_message (HEADER * h);
@@ -197,13 +197,13 @@ int mutt_prepare_template (FILE *, CONTEXT *, HEADER *, HEADER *, short);
 int mutt_resend_message (FILE *, CONTEXT *, HEADER *);
 
 #define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL)
 int mutt_resend_message (FILE *, CONTEXT *, HEADER *);
 
 #define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL)
-int _mutt_enter_fname (const char *, char *, size_t, int *, int, int,
+int _mutt_enter_fname (const char *, char *, ssize_t, int *, int, int,
                        char ***, int *);
 #define mutt_get_field(A,B,C,D) _mutt_get_field(A,B,C,D,0,NULL,NULL)
                        char ***, int *);
 #define mutt_get_field(A,B,C,D) _mutt_get_field(A,B,C,D,0,NULL,NULL)
-int _mutt_get_field (const char *, char *, size_t, int, int, char ***, int *);
-int mutt_get_field_unbuffered (char *, char *, size_t, int);
+int _mutt_get_field (const char *, char *, ssize_t, int, int, char ***, int *);
+int mutt_get_field_unbuffered (char *, char *, ssize_t, int);
 int mutt_get_hook_type (const char *);
 int mutt_get_hook_type (const char *);
-int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, size_t);
+int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, ssize_t);
 int mutt_index_menu (void);
 int mutt_invoke_mta (address_t *, address_t *, address_t *, address_t *, const char *,
                      int);
 int mutt_index_menu (void);
 int mutt_invoke_mta (address_t *, address_t *, address_t *, address_t *, const char *,
                      int);
@@ -232,14 +232,14 @@ int mutt_parse_score (BUFFER *, BUFFER *, unsigned long, BUFFER *);
 int mutt_parse_unscore (BUFFER *, BUFFER *, unsigned long, BUFFER *);
 int mutt_parse_unhook (BUFFER *, BUFFER *, unsigned long, BUFFER *);
 int mutt_pattern_func (int, char *);
 int mutt_parse_unscore (BUFFER *, BUFFER *, unsigned long, BUFFER *);
 int mutt_parse_unhook (BUFFER *, BUFFER *, unsigned long, BUFFER *);
 int mutt_pattern_func (int, char *);
-int mutt_query_complete (char *, size_t);
+int mutt_query_complete (char *, ssize_t);
 int mutt_query_variables (string_list_t * queries);
 int _mutt_save_message (HEADER *, CONTEXT *, int, int, int);
 int mutt_save_message (HEADER *, int, int, int, int *);
 int mutt_search_command (int, int);
 int mutt_skipchars (const char *, const char *);
 int mutt_strwidth (const char *);
 int mutt_query_variables (string_list_t * queries);
 int _mutt_save_message (HEADER *, CONTEXT *, int, int, int);
 int mutt_save_message (HEADER *, int, int, int, int *);
 int mutt_search_command (int, int);
 int mutt_skipchars (const char *, const char *);
 int mutt_strwidth (const char *);
-int mutt_compose_menu (HEADER *, char *, size_t, HEADER *);
+int mutt_compose_menu (HEADER *, char *, ssize_t, HEADER *);
 int mutt_thread_set_flag (HEADER *, int, int, int);
 int mutt_user_is_recipient (HEADER *);
 void mutt_update_num_postponed (void);
 int mutt_thread_set_flag (HEADER *, int, int, int);
 int mutt_user_is_recipient (HEADER *);
 void mutt_update_num_postponed (void);
@@ -262,7 +262,7 @@ pid_t mutt_create_filter_fd (const char *, FILE **, FILE **, FILE **, int,
                              int, int);
 
 /* base64.c */
                              int, int);
 
 /* base64.c */
-void mutt_to_base64 (unsigned char *, const unsigned char *, size_t, size_t);
+void mutt_to_base64 (unsigned char *, const unsigned char *, ssize_t, ssize_t);
 int mutt_from_base64 (char *, const char *);
 
 /* utf8.c */
 int mutt_from_base64 (char *, const char *);
 
 /* utf8.c */
@@ -279,112 +279,9 @@ int mutt_wctoutf8 (char *s, unsigned int c);
 int mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags,
                        CONTEXT * ctx, HEADER * h);
 pattern_t *mutt_pattern_comp ( /* const */ char *s, int flags, BUFFER * err);
 int mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags,
                        CONTEXT * ctx, HEADER * h);
 pattern_t *mutt_pattern_comp ( /* const */ char *s, int flags, BUFFER * err);
-void mutt_check_simple (char *s, size_t len, const char *simple);
+void mutt_check_simple (char *s, ssize_t len, const char *simple);
 void mutt_pattern_free (pattern_t ** pat);
 
 void mutt_pattern_free (pattern_t ** pat);
 
-/* ----------------------------------------------------------------------------
- * Prototypes for broken systems
- */
-
-#ifdef HAVE_SRAND48
-#define LRAND lrand48
-#define SRAND srand48
-#define DRAND drand48
-#else
-#define LRAND rand
-#define SRAND srand
-#define DRAND (double)rand
-#endif /* HAVE_SRAND48 */
-
-/* HP-UX, ConvexOS and UNIXware don't have this macro */
-#ifndef S_ISLNK
-#define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK ? 1 : 0)
-#endif
-
-/* According to SCO support, this is how to detect SCO */
-#if defined (_M_UNIX) || defined (M_OS)
-#define SCO
-#endif
-
-#ifndef HAVE_SNPRINTF
-extern int snprintf (char *, size_t, const char *, ...);
-#endif
-
-#ifndef HAVE_VSNPRINTF
-extern int vsnprintf (char *, size_t, const char *, va_list);
-#endif
-
-#ifndef HAVE_STRERROR
-#ifndef STDC_HEADERS
-extern int sys_nerr;
-extern char *sys_errlist[];
-#endif
-
-#define strerror(x) ((x) > 0 && (x) < sys_nerr) ? sys_errlist[(x)] : 0
-#endif /* !HAVE_STRERROR */
-
-#ifndef HAVE_MEMMOVE
-#define memmove(d,s,n) bcopy((s),(d),(n))
-#endif
-
-#ifdef _AIX
-/* AIX doesn't define these in any headers (sigh) */
-int strcasecmp (const char *, const char *);
-int strncasecmp (const char *, const char *, size_t);
-
-int setegid (gid_t);
-#endif /* _AIX */
-
-#ifndef STDC_HEADERS
-extern FILE *fdopen ();
-extern int system ();
-extern int puts ();
-extern int fputs ();
-extern int fputc ();
-extern int fseeko ();
-extern char *strchr ();
-extern int getopt ();
-extern int fputs ();
-extern int fputc ();
-extern int fclose ();
-extern int fprintf ();
-extern int printf ();
-extern int fgetc ();
-extern int tolower ();
-extern int toupper ();
-extern int sscanf ();
-extern size_t fread ();
-extern size_t fwrite ();
-extern int system ();
-extern int rename ();
-extern time_t time ();
-extern struct tm *localtime ();
-extern char *asctime ();
-extern char *strpbrk ();
-extern int fflush ();
-extern long lrand48 ();
-extern void srand48 ();
-extern time_t mktime ();
-extern int vsprintf ();
-extern int ungetc ();
-extern char *mktemp ();
-extern int ftruncate ();
-extern void *memset ();
-extern int pclose ();
-extern int socket ();
-extern int connect ();
-extern size_t strftime ();
-extern int lstat ();
-extern void rewind ();
-extern int readlink ();
-
-/* IRIX barfs on empty var decls because the system include file uses elipsis
-   in the declaration.  So declare all the args to avoid compiler errors.  This
-   should be harmless on other systems.  */
-int ioctl (int, int, ...);
-
-#endif
-
 /* unsorted */
 void ci_bounce_message (HEADER *, int *);
 int ci_send_message (int, HEADER *, char *, CONTEXT *, HEADER *);
 /* unsorted */
 void ci_bounce_message (HEADER *, int *);
 int ci_send_message (int, HEADER *, char *, CONTEXT *, HEADER *);
diff --git a/query.c b/query.c
index 7f343fd..be1ac47 100644 (file)
--- a/query.c
+++ b/query.c
@@ -54,7 +54,7 @@ static struct mapping_t QueryHelp[] = {
 static int FirstColumn;
 static int SecondColumn;
 
 static int FirstColumn;
 static int SecondColumn;
 
-static void query_menu (char *buf, size_t buflen, QUERY * results,
+static void query_menu (char *buf, ssize_t buflen, QUERY * results,
                         int retbuf);
 
 static address_t *result_to_addr (QUERY * r)
                         int retbuf);
 
 static address_t *result_to_addr (QUERY * r)
@@ -77,7 +77,7 @@ static QUERY *run_query (char *s, int quiet)
   QUERY *cur = NULL;
   char cmd[_POSIX_PATH_MAX];
   char *buf = NULL;
   QUERY *cur = NULL;
   char cmd[_POSIX_PATH_MAX];
   char *buf = NULL;
-  size_t buflen;
+  ssize_t buflen;
   int dummy = 0;
   char msg[STRING];
   char *p;
   int dummy = 0;
   char msg[STRING];
   char *p;
@@ -206,7 +206,7 @@ static int query_tag (MUTTMENU * menu, int n, int m)
   return cur->tagged - ot;
 }
 
   return cur->tagged - ot;
 }
 
-int mutt_query_complete (char *buf, size_t buflen)
+int mutt_query_complete (char *buf, ssize_t buflen)
 {
   QUERY *results = NULL;
   address_t *tmpa;
 {
   QUERY *results = NULL;
   address_t *tmpa;
@@ -235,7 +235,7 @@ int mutt_query_complete (char *buf, size_t buflen)
   return (0);
 }
 
   return (0);
 }
 
-void mutt_query_menu (char *buf, size_t buflen)
+void mutt_query_menu (char *buf, ssize_t buflen)
 {
   if (!QueryCmd) {
     mutt_error _("Query command not defined.");
 {
   if (!QueryCmd) {
     mutt_error _("Query command not defined.");
@@ -253,7 +253,7 @@ void mutt_query_menu (char *buf, size_t buflen)
   }
 }
 
   }
 }
 
-static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
+static void query_menu (char *buf, ssize_t buflen, QUERY * results, int retbuf)
 {
   MUTTMENU *menu;
   HEADER *msg = NULL;
 {
   MUTTMENU *menu;
   HEADER *msg = NULL;
@@ -425,7 +425,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
     /* if we need to return the selected entries */
     if (retbuf && (done == 2)) {
       int tagged = 0;
     /* if we need to return the selected entries */
     if (retbuf && (done == 2)) {
       int tagged = 0;
-      size_t curpos = 0;
+      ssize_t curpos = 0;
 
       p_clear(buf, buflen);
 
 
       p_clear(buf, buflen);
 
index 67326fb..d9b6d61 100644 (file)
@@ -188,7 +188,7 @@ ATTACHPTR **mutt_gen_attach_list (BODY * m,
  * %u = unlink 
  */
 const char *mutt_attach_fmt (char *dest,
  * %u = unlink 
  */
 const char *mutt_attach_fmt (char *dest,
-                             size_t destlen,
+                             ssize_t destlen,
                              char op,
                              const char *src,
                              const char *prefix,
                              char op,
                              const char *src,
                              const char *prefix,
@@ -201,7 +201,7 @@ const char *mutt_attach_fmt (char *dest,
   char charset[SHORT_STRING];
   ATTACHPTR *aptr = (ATTACHPTR *) data;
   int optional = (flags & M_FORMAT_OPTIONAL);
   char charset[SHORT_STRING];
   ATTACHPTR *aptr = (ATTACHPTR *) data;
   int optional = (flags & M_FORMAT_OPTIONAL);
-  size_t l;
+  ssize_t l;
 
   switch (op) {
   case 'C':
 
   switch (op) {
   case 'C':
index 919b464..438e2fc 100644 (file)
@@ -22,7 +22,7 @@ ATTACHPTR **mutt_gen_attach_list (BODY *, int, ATTACHPTR **, short *, short *,
                                   int, int);
 
 const char *mutt_attach_fmt (char *dest,
                                   int, int);
 
 const char *mutt_attach_fmt (char *dest,
-                             size_t destlen,
+                             ssize_t destlen,
                              char op,
                              const char *src,
                              const char *prefix,
                              char op,
                              const char *src,
                              const char *prefix,
index 6c6d317..bc954c7 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
@@ -69,7 +69,7 @@ int rfc1524_expand_command (BODY * a, char *filename, char *_type,
   if (option (OPTMAILCAPSANITIZE))
     mutt_sanitize_filename (type, 0);
 
   if (option (OPTMAILCAPSANITIZE))
     mutt_sanitize_filename (type, 0);
 
-  while (command[x] && x < clen && y < sizeof (buf)) {
+  while (command[x] && x < clen && y < ssizeof (buf)) {
     if (command[x] == '\\') {
       x++;
       buf[y++] = command[x++];
     if (command[x] == '\\') {
       x++;
       buf[y++] = command[x++];
@@ -83,7 +83,7 @@ int rfc1524_expand_command (BODY * a, char *filename, char *_type,
         int z = 0;
 
         x++;
         int z = 0;
 
         x++;
-        while (command[x] && command[x] != '}' && z < sizeof (param))
+        while (command[x] && command[x] != '}' && z < ssizeof (param))
           param[z++] = command[x++];
         param[z] = '\0';
 
           param[z++] = command[x++];
         param[z] = '\0';
 
@@ -161,7 +161,7 @@ static int rfc1524_mailcap_parse (BODY * a,
 {
   FILE *fp;
   char *buf = NULL;
 {
   FILE *fp;
   char *buf = NULL;
-  size_t buflen;
+  ssize_t buflen;
   char *ch;
   char *field;
   int found = FALSE;
   char *ch;
   char *field;
   int found = FALSE;
@@ -189,7 +189,7 @@ static int rfc1524_mailcap_parse (BODY * a,
   btlen = ch - type;
 
   if ((fp = fopen (filename, "r")) != NULL) {
   btlen = ch - type;
 
   if ((fp = fopen (filename, "r")) != NULL) {
-    while (!found && (buf = mutt_read_line (buf, &buflen, fp, &line)) != NULL) {
+    while (!found && (buf = mutt_read_line(buf, &buflen, fp, &line)) != NULL) {
       /* ignore comments */
       if (*buf == '#')
         continue;
       /* ignore comments */
       if (*buf == '#')
         continue;
@@ -265,7 +265,7 @@ static int rfc1524_mailcap_parse (BODY * a,
            * if this is the right entry.
            */
           char *test_command = NULL;
            * if this is the right entry.
            */
           char *test_command = NULL;
-          size_t len;
+          ssize_t len;
 
           if (get_field_text (field + 4, &test_command, type, filename, line)
               && test_command) {
 
           if (get_field_text (field + 4, &test_command, type, filename, line)
               && test_command) {
@@ -368,7 +368,7 @@ int rfc1524_mailcap_lookup (BODY * a, char *type, rfc1524_entry * entry,
 
   while (!found && *curr) {
     x = 0;
 
   while (!found && *curr) {
     x = 0;
-    while (*curr && *curr != ':' && x < sizeof (path) - 1) {
+    while (*curr && *curr != ':' && x < ssizeof (path) - 1) {
       path[x++] = *curr;
       curr++;
     }
       path[x++] = *curr;
       curr++;
     }
@@ -403,15 +403,8 @@ int rfc1524_mailcap_lookup (BODY * a, char *type, rfc1524_entry * entry,
  * Returns 1 if newfile specified
  */
 
  * Returns 1 if newfile specified
  */
 
-static void strnfcpy (char *d, char *s, size_t siz, size_t len)
-{
-  if (len > siz)
-    len = siz - 1;
-  m_strcpy(d, len, s);
-}
-
 int rfc1524_expand_filename (char *nametemplate,
 int rfc1524_expand_filename (char *nametemplate,
-                             char *oldfile, char *newfile, size_t nflen)
+                             char *oldfile, char *newfile, ssize_t nflen)
 {
   int i, j, k, ps, r;
   char *s;
 {
   int i, j, k, ps, r;
   char *s;
@@ -494,7 +487,7 @@ int rfc1524_expand_filename (char *nametemplate,
       if (lmatch)
         *left = 0;
       else
       if (lmatch)
         *left = 0;
       else
-        strnfcpy (left, nametemplate, sizeof (left), i);
+        m_strncpy(left, sizeof(left), nametemplate, i);
 
       if (rmatch)
         *right = 0;
 
       if (rmatch)
         *right = 0;
index 31b2dea..a0156d7 100644 (file)
--- a/rfc1524.h
+++ b/rfc1524.h
@@ -28,7 +28,7 @@ typedef struct rfc1524_mailcap_entry {
 rfc1524_entry *rfc1524_new_entry (void);
 void rfc1524_free_entry (rfc1524_entry **);
 int rfc1524_expand_command (BODY *, char *, char *, char *, int);
 rfc1524_entry *rfc1524_new_entry (void);
 void rfc1524_free_entry (rfc1524_entry **);
 int rfc1524_expand_command (BODY *, char *, char *, char *, int);
-int rfc1524_expand_filename (char *, char *, char *, size_t);
+int rfc1524_expand_filename (char *, char *, char *, ssize_t);
 int rfc1524_mailcap_lookup (BODY *, char *, rfc1524_entry *, int);
 int mutt_rename_file (char *, char *);
 int _mutt_rename_file (char *, char *, int);
 int rfc1524_mailcap_lookup (BODY *, char *, rfc1524_entry *, int);
 int mutt_rename_file (char *, char *);
 int _mutt_rename_file (char *, char *, int);
index a5ba72c..5b9b56f 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -443,7 +443,7 @@ void mutt_generate_boundary (PARAMETER ** parm)
 
   rs[BOUNDARYLEN] = 0;
   for (i = 0; i < BOUNDARYLEN; i++)
 
   rs[BOUNDARYLEN] = 0;
   for (i = 0; i < BOUNDARYLEN; i++)
-    *p++ = __m_b64chars[LRAND() % sizeof(__m_b64chars)];
+    *p++ = __m_b64chars[lrand48() % sizeof(__m_b64chars)];
   *p = 0;
 
   mutt_set_parameter ("boundary", rs, parm);
   *p = 0;
 
   mutt_set_parameter ("boundary", rs, parm);
@@ -459,7 +459,7 @@ typedef struct {
 
 
 static void update_content_info (CONTENT * info, CONTENT_STATE * s, char *d,
 
 
 static void update_content_info (CONTENT * info, CONTENT_STATE * s, char *d,
-                                 size_t dlen)
+                                 ssize_t dlen)
 {
   int from = s->from;
   int whitespace = s->whitespace;
 {
   int from = s->from;
   int whitespace = s->whitespace;
@@ -585,7 +585,7 @@ static void update_content_info (CONTENT * info, CONTENT_STATE * s, char *d,
  * long as the input for any pair of charsets we might be interested
  * in.
  */
  * long as the input for any pair of charsets we might be interested
  * in.
  */
-static size_t convert_file_to (FILE * file, const char *fromcode,
+static ssize_t convert_file_to (FILE * file, const char *fromcode,
                                int ncodes, const char **tocodes,
                                int *tocode, CONTENT * info)
 {
                                int ncodes, const char **tocodes,
                                int *tocode, CONTENT * info)
 {
@@ -594,18 +594,18 @@ static size_t convert_file_to (FILE * file, const char *fromcode,
   char bufi[256], bufu[512], bufo[4 * sizeof (bufi)];
   const char *ib, *ub;
   char *ob;
   char bufi[256], bufu[512], bufo[4 * sizeof (bufi)];
   const char *ib, *ub;
   char *ob;
-  size_t ibl, obl, ubl, ubl1, n, ret;
+  ssize_t ibl, obl, ubl, ubl1, n, ret;
   int i;
   CONTENT *infos;
   CONTENT_STATE *states;
   int i;
   CONTENT *infos;
   CONTENT_STATE *states;
-  size_t *score;
+  ssize_t *score;
 
   cd1 = mutt_iconv_open ("UTF-8", fromcode, 0);
   if (cd1 == (iconv_t) (-1))
     return -1;
 
   cd = p_new(iconv_t, ncodes);
 
   cd1 = mutt_iconv_open ("UTF-8", fromcode, 0);
   if (cd1 == (iconv_t) (-1))
     return -1;
 
   cd = p_new(iconv_t, ncodes);
-  score = p_new(size_t, ncodes);
+  score = p_new(ssize_t, ncodes);
   states = p_new(CONTENT_STATE, ncodes);
   infos = p_new(CONTENT, ncodes);
 
   states = p_new(CONTENT_STATE, ncodes);
   infos = p_new(CONTENT, ncodes);
 
@@ -614,7 +614,7 @@ static size_t convert_file_to (FILE * file, const char *fromcode,
       cd[i] = mutt_iconv_open (tocodes[i], "UTF-8", 0);
     else
       /* Special case for conversion to UTF-8 */
       cd[i] = mutt_iconv_open (tocodes[i], "UTF-8", 0);
     else
       /* Special case for conversion to UTF-8 */
-      cd[i] = (iconv_t) (-1), score[i] = (size_t) (-1);
+      cd[i] = (iconv_t) (-1), score[i] = -1;
 
   rewind (file);
   ibl = 0;
 
   rewind (file);
   ibl = 0;
@@ -628,33 +628,33 @@ static size_t convert_file_to (FILE * file, const char *fromcode,
     ib = bufi;
     ob = bufu, obl = sizeof (bufu);
     n = my_iconv(cd1, ibl ? &ib : 0, &ibl, &ob, &obl);
     ib = bufi;
     ob = bufu, obl = sizeof (bufu);
     n = my_iconv(cd1, ibl ? &ib : 0, &ibl, &ob, &obl);
-    assert (n == (size_t) (-1) || !n || ICONV_NONTRANS);
-    if (n == (size_t) (-1) &&
+    assert (n == -1 || !n || ICONV_NONTRANS);
+    if (n == -1 &&
         ((errno != EINVAL && errno != E2BIG) || ib == bufi)) {
       assert (errno == EILSEQ ||
         ((errno != EINVAL && errno != E2BIG) || ib == bufi)) {
       assert (errno == EILSEQ ||
-              (errno == EINVAL && ib == bufi && ibl < sizeof (bufi)));
-      ret = (size_t) (-1);
+              (errno == EINVAL && ib == bufi && ibl < ssizeof (bufi)));
+      ret = -1;
       break;
     }
     ubl1 = ob - bufu;
 
     /* Convert from UTF-8 */
     for (i = 0; i < ncodes; i++)
       break;
     }
     ubl1 = ob - bufu;
 
     /* Convert from UTF-8 */
     for (i = 0; i < ncodes; i++)
-      if (cd[i] != (iconv_t) (-1) && score[i] != (size_t) (-1)) {
+      if (cd[i] != (iconv_t) (-1) && score[i] != -1) {
         ub = bufu, ubl = ubl1;
         ob = bufo, obl = sizeof (bufo);
         n = my_iconv(cd[i], (ibl || ubl) ? &ub : 0, &ubl, &ob, &obl);
         ub = bufu, ubl = ubl1;
         ob = bufo, obl = sizeof (bufo);
         n = my_iconv(cd[i], (ibl || ubl) ? &ub : 0, &ubl, &ob, &obl);
-        if (n == (size_t) (-1)) {
+        if (n == -1) {
           assert (errno == E2BIG ||
                   (BUGGY_ICONV && (errno == EILSEQ || errno == ENOENT)));
           assert (errno == E2BIG ||
                   (BUGGY_ICONV && (errno == EILSEQ || errno == ENOENT)));
-          score[i] = (size_t) (-1);
+          score[i] = -1;
         }
         else {
           score[i] += n;
           update_content_info (&infos[i], &states[i], bufo, ob - bufo);
         }
       }
         }
         else {
           score[i] += n;
           update_content_info (&infos[i], &states[i], bufo, ob - bufo);
         }
       }
-      else if (cd[i] == (iconv_t) (-1) && score[i] == (size_t) (-1))
+      else if (cd[i] == (iconv_t) (-1) && score[i] == -1)
         /* Special case for conversion to UTF-8 */
         update_content_info (&infos[i], &states[i], bufu, ubl1);
 
         /* Special case for conversion to UTF-8 */
         update_content_info (&infos[i], &states[i], bufu, ubl1);
 
@@ -669,24 +669,24 @@ static size_t convert_file_to (FILE * file, const char *fromcode,
 
   if (!ret) {
     /* Find best score */
 
   if (!ret) {
     /* Find best score */
-    ret = (size_t) (-1);
+    ret = -1;
     for (i = 0; i < ncodes; i++) {
     for (i = 0; i < ncodes; i++) {
-      if (cd[i] == (iconv_t) (-1) && score[i] == (size_t) (-1)) {
+      if (cd[i] == (iconv_t) (-1) && score[i] == -1) {
         /* Special case for conversion to UTF-8 */
         *tocode = i;
         ret = 0;
         break;
       }
         /* Special case for conversion to UTF-8 */
         *tocode = i;
         ret = 0;
         break;
       }
-      else if (cd[i] == (iconv_t) (-1) || score[i] == (size_t) (-1))
+      else if (cd[i] == (iconv_t) (-1) || score[i] == -1)
         continue;
         continue;
-      else if (ret == (size_t) (-1) || score[i] < ret) {
+      else if (ret == -1 || score[i] < ret) {
         *tocode = i;
         ret = score[i];
         if (!ret)
           break;
       }
     }
         *tocode = i;
         ret = score[i];
         if (!ret)
           break;
       }
     }
-    if (ret != (size_t) (-1)) {
+    if (ret != -1) {
       memcpy (info, &infos[*tocode], sizeof (CONTENT));
       update_content_info (info, &states[*tocode], 0, 0);       /* EOF */
     }
       memcpy (info, &infos[*tocode], sizeof (CONTENT));
       update_content_info (info, &states[*tocode], 0, 0);       /* EOF */
     }
@@ -719,7 +719,7 @@ static size_t convert_file_to (FILE * file, const char *fromcode,
  * However, if fromcode is zero then fromcodes is assumed to be the
  * name of a single charset even if it contains a colon.
  */
  * However, if fromcode is zero then fromcodes is assumed to be the
  * name of a single charset even if it contains a colon.
  */
-static size_t convert_file_from_to (FILE * file,
+static ssize_t convert_file_from_to (FILE * file,
                                     const char *fromcodes,
                                     const char *tocodes, char **fromcode,
                                     char **tocode, CONTENT * info)
                                     const char *fromcodes,
                                     const char *tocodes, char **fromcode,
                                     char **tocode, CONTENT * info)
@@ -727,7 +727,7 @@ static size_t convert_file_from_to (FILE * file,
   char *fcode;
   char **tcode;
   const char *c, *c1;
   char *fcode;
   char **tcode;
   const char *c, *c1;
-  size_t ret;
+  ssize_t ret;
   int ncodes, i, cn;
 
   /* Count the tocodes */
   int ncodes, i, cn;
 
   /* Count the tocodes */
@@ -746,7 +746,7 @@ static size_t convert_file_from_to (FILE * file,
     tcode[i] = m_substrdup(c, c1);
   }
 
     tcode[i] = m_substrdup(c, c1);
   }
 
-  ret = (size_t) (-1);
+  ret = -1;
   if (fromcode) {
     /* Try each fromcode in turn */
     for (c = fromcodes; c; c = c1 ? c1 + 1 : 0) {
   if (fromcode) {
     /* Try each fromcode in turn */
     for (c = fromcodes; c; c = c1 ? c1 + 1 : 0) {
@@ -756,7 +756,7 @@ static size_t convert_file_from_to (FILE * file,
 
       ret = convert_file_to (file, fcode, ncodes, (const char **) tcode,
                              &cn, info);
 
       ret = convert_file_to (file, fcode, ncodes, (const char **) tcode,
                              &cn, info);
-      if (ret != (size_t) (-1)) {
+      if (ret != -1) {
         *fromcode = fcode;
         *tocode = tcode[cn];
         tcode[cn] = 0;
         *fromcode = fcode;
         *tocode = tcode[cn];
         tcode[cn] = 0;
@@ -769,7 +769,7 @@ static size_t convert_file_from_to (FILE * file,
     /* There is only one fromcode */
     ret = convert_file_to (file, fromcodes, ncodes, (const char **) tcode,
                            &cn, info);
     /* There is only one fromcode */
     ret = convert_file_to (file, fromcodes, ncodes, (const char **) tcode,
                            &cn, info);
-    if (ret != (size_t) (-1)) {
+    if (ret != -1) {
       *tocode = tcode[cn];
       tcode[cn] = 0;
     }
       *tocode = tcode[cn];
       tcode[cn] = 0;
     }
@@ -797,7 +797,7 @@ CONTENT *mutt_get_content_info (const char *fname, BODY * b)
   char *tocode = NULL;
   char buffer[100];
   char chsbuf[STRING];
   char *tocode = NULL;
   char buffer[100];
   char chsbuf[STRING];
-  size_t r;
+  ssize_t r;
 
   struct stat sb;
 
 
   struct stat sb;
 
@@ -828,7 +828,7 @@ CONTENT *mutt_get_content_info (const char *fname, BODY * b)
                                 FileCharset : Charset) : Charset;
     if (Charset && (chs || SendCharset) &&
         convert_file_from_to (fp, fchs, chs ? chs : SendCharset,
                                 FileCharset : Charset) : Charset;
     if (Charset && (chs || SendCharset) &&
         convert_file_from_to (fp, fchs, chs ? chs : SendCharset,
-                              &fromcode, &tocode, info) != (size_t) (-1)) {
+                              &fromcode, &tocode, info) != -1) {
       if (!chs) {
         mutt_canonical_charset (chsbuf, sizeof (chsbuf), tocode);
         mutt_set_parameter ("charset", chsbuf, &b->parameter);
       if (!chs) {
         mutt_canonical_charset (chsbuf, sizeof (chsbuf), tocode);
         mutt_set_parameter ("charset", chsbuf, &b->parameter);
@@ -1130,7 +1130,7 @@ void mutt_stamp_attachment (BODY * a)
 
 /* Get a body's character set */
 
 
 /* Get a body's character set */
 
-char *mutt_get_body_charset (char *d, size_t dlen, BODY * b)
+char *mutt_get_body_charset (char *d, ssize_t dlen, BODY * b)
 {
   char *p = NULL;
 
 {
   char *p = NULL;
 
@@ -1344,7 +1344,7 @@ BODY *mutt_remove_multipart (BODY * b)
   return b;
 }
 
   return b;
 }
 
-char *mutt_make_date (char *s, size_t len)
+char *mutt_make_date (char *s, ssize_t len)
 {
   time_t t = time (NULL);
   struct tm *l = localtime (&t);
 {
   time_t t = time (NULL);
   struct tm *l = localtime (&t);
@@ -1915,7 +1915,7 @@ send_msg(const char *path, const char **args, const char *msg, char **tempfile)
 }
 
 static const char **
 }
 
 static const char **
-add_args(const char **args, size_t *argslen, size_t *argsmax, address_t * addr)
+add_args(const char **args, ssize_t *argslen, ssize_t *argsmax, address_t * addr)
 {
   for (; addr; addr = addr->next) {
     /* weed out group mailboxes, since those are for display only */
 {
   for (; addr; addr = addr->next) {
     /* weed out group mailboxes, since those are for display only */
@@ -1929,7 +1929,7 @@ add_args(const char **args, size_t *argslen, size_t *argsmax, address_t * addr)
 }
 
 static const char **
 }
 
 static const char **
-add_option(const char **args, size_t *argslen, size_t *argsmax, const char *s)
+add_option(const char **args, ssize_t *argslen, ssize_t *argsmax, const char *s)
 {
     if (*argslen == *argsmax) {
         p_realloc(&args, *argsmax += 5);
 {
     if (*argslen == *argsmax) {
         p_realloc(&args, *argsmax += 5);
@@ -1945,7 +1945,7 @@ static int mutt_invoke_sendmail (address_t * from,        /* the sender */
 {                               /* message contains 8bit chars */
   char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL;
   const char **args = NULL;
 {                               /* message contains 8bit chars */
   char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL;
   const char **args = NULL;
-  size_t argslen = 0, argsmax = 0;
+  ssize_t argslen = 0, argsmax = 0;
   int i;
 
 #ifdef USE_NNTP
   int i;
 
 #ifdef USE_NNTP
@@ -2075,7 +2075,7 @@ int mutt_invoke_mta (address_t * from,    /* the sender */
    string. */
 char *mutt_append_string (char *a, const char *b)
 {
    string. */
 char *mutt_append_string (char *a, const char *b)
 {
-  size_t la = m_strlen(a);
+  ssize_t la = m_strlen(a);
 
   p_realloc(&a, la + m_strlen(b) + 1);
   strcpy (a + la, b);           /* __STRCPY_CHECKED__ */
 
   p_realloc(&a, la + m_strlen(b) + 1);
   strcpy (a + la, b);           /* __STRCPY_CHECKED__ */
@@ -2103,14 +2103,14 @@ int mutt_needs_quote (const char *s)
 char *mutt_quote_string (const char *s)
 {
   char *r, *pr;
 char *mutt_quote_string (const char *s)
 {
   char *r, *pr;
-  size_t rlen;
+  ssize_t rlen;
 
   rlen = m_strlen(s) + 3;
   pr = r = p_new(char, rlen);
   *pr++ = '"';
   while (*s) {
     if (INVALID_CHAR (*s)) {
 
   rlen = m_strlen(s) + 3;
   pr = r = p_new(char, rlen);
   *pr++ = '"';
   while (*s) {
     if (INVALID_CHAR (*s)) {
-      size_t o = pr - r;
+      ssize_t o = pr - r;
 
       p_realloc(&r, ++rlen);
       pr = r + o;
 
       p_realloc(&r, ++rlen);
       pr = r + o;