and less size_t's
authorPierre Habouzit <madcoder@debian.org>
Mon, 13 Nov 2006 10:32:00 +0000 (11:32 +0100)
committerPierre Habouzit <madcoder@debian.org>
Mon, 13 Nov 2006 10:32:00 +0000 (11:32 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
14 files changed:
commands.c
compress.c
hcache.c
hcache.h
lib-sys/mutt_tunnel.c
lib-ui/menu.h
mh.c
remailer.c
remailer.h
send.c
sidebar.c
state.c
state.h
status.c

index 01ea639..492dd2c 100644 (file)
@@ -842,7 +842,7 @@ void mutt_edit_content_type (HEADER * h, BODY * b, FILE * fp)
   snprintf (buf, sizeof (buf), "%s/%s", TYPE (b), b->subtype);
   m_strcpy(obuf, sizeof(obuf), buf);
   if (b->parameter) {
-    size_t l;
+    ssize_t l;
 
     for (p = b->parameter; p; p = p->next) {
       l = m_strlen(buf);
index aa453bb..bd78ff7 100644 (file)
@@ -152,7 +152,7 @@ static void store_size (CONTEXT * ctx)
   ci->size = get_size (ctx->realpath);
 }
 
-static const char *compresshook_format_str (char *dest, size_t destlen,
+static const char *compresshook_format_str (char *dest, ssize_t destlen,
                                             char op, const char *src,
                                             const char *fmt,
                                             const char *ifstring,
index 4b9e757..9c78a82 100644 (file)
--- a/hcache.c
+++ b/hcache.c
@@ -74,7 +74,7 @@ typedef union {
   unsigned long uid_validity;
 } validate;
 
-static void *lazy_malloc (size_t siz)
+static void *lazy_malloc (ssize_t siz)
 {
   if (0 < siz && siz < 4096) {
     siz = 4096;
@@ -424,7 +424,7 @@ static void restore_envelope (ENVELOPE * e, const unsigned char *d, int *off)
 }
 
 static
-unsigned int crc32 (unsigned int crc, unsigned char const *p, size_t len)
+unsigned int crc32 (unsigned int crc, unsigned char const *p, ssize_t len)
 {
   int i;
 
@@ -635,7 +635,7 @@ mutt_hcache_close(void *db)
 
 void *
 mutt_hcache_fetch(void *db, const char *filename,
-                 size_t(*keylen) (const char *fn))
+                 ssize_t(*keylen) (const char *fn))
 {
   struct header_cache *h = db;
   char path[_POSIX_PATH_MAX];
@@ -664,7 +664,7 @@ mutt_hcache_fetch(void *db, const char *filename,
 int
 mutt_hcache_store(void *db, const char *filename, HEADER * header,
                  unsigned long uid_validity,
-                 size_t(*keylen) (const char *fn))
+                 ssize_t(*keylen) (const char *fn))
 {
   struct header_cache *h = db;
   char path[_POSIX_PATH_MAX];
@@ -691,7 +691,7 @@ mutt_hcache_store(void *db, const char *filename, HEADER * header,
 
 int
 mutt_hcache_delete(void *db, const char *filename,
-                  size_t(*keylen) (const char *fn))
+                  ssize_t(*keylen) (const char *fn))
 {
   struct header_cache *h = db;
   char path[_POSIX_PATH_MAX];
@@ -759,7 +759,7 @@ void mutt_hcache_close (void *db)
 }
 
 void *mutt_hcache_fetch (void *db, const char *filename,
-                         size_t (*keylen) (const char *fn))
+                         ssize_t (*keylen) (const char *fn))
 {
   struct header_cache *h = db;
   datum key;
@@ -788,7 +788,7 @@ void *mutt_hcache_fetch (void *db, const char *filename,
 
 int
 mutt_hcache_store (void *db, const char *filename, HEADER * header,
-                   unsigned long uid_validity, size_t (*keylen) (const char *fn))
+                   unsigned long uid_validity, ssize_t (*keylen) (const char *fn))
 {
   struct header_cache *h = db;
   datum key;
@@ -817,7 +817,7 @@ mutt_hcache_store (void *db, const char *filename, HEADER * header,
 
 int
 mutt_hcache_delete (void *db, const char *filename,
-                    size_t (*keylen) (const char *fn))
+                    ssize_t (*keylen) (const char *fn))
 {
   datum key;
   struct header_cache *h = db;
@@ -837,7 +837,7 @@ mutt_hcache_delete (void *db, const char *filename,
 }
 #elif defined(HAVE_DB4)
 
-static void mutt_hcache_dbt_init (DBT * dbt, void *data, size_t len)
+static void mutt_hcache_dbt_init (DBT * dbt, void *data, ssize_t len)
 {
   dbt->data = data;
   dbt->size = dbt->ulen = len;
@@ -939,7 +939,7 @@ void mutt_hcache_close (void *db)
 }
 
 void *mutt_hcache_fetch (void *db, const char *filename,
-                         size_t (*keylen) (const char *fn))
+                         ssize_t (*keylen) (const char *fn))
 {
   DBT key;
   DBT data;
@@ -967,7 +967,7 @@ void *mutt_hcache_fetch (void *db, const char *filename,
 
 int
 mutt_hcache_store (void *db, const char *filename, HEADER * header,
-                   unsigned long uid_validity, size_t (*keylen) (const char *fn))
+                   unsigned long uid_validity, ssize_t (*keylen) (const char *fn))
 {
   DBT key;
   DBT data;
@@ -997,7 +997,7 @@ mutt_hcache_store (void *db, const char *filename, HEADER * header,
 
 int
 mutt_hcache_delete (void *db, const char *filename,
-                    size_t (*keylen) (const char *fn))
+                    ssize_t (*keylen) (const char *fn))
 {
   DBT key;
   struct header_cache *h = db;
index b23b692..a764817 100644 (file)
--- a/hcache.h
+++ b/hcache.h
@@ -16,12 +16,12 @@ void *mutt_hcache_open(const char *path, const char *folder);
 void mutt_hcache_close(void *db);
 HEADER *mutt_hcache_restore(const unsigned char *d, HEADER **oh);
 void *mutt_hcache_fetch(void *db, const char *filename,
-                        size_t (*keylen)(const char *fn));
+                        ssize_t (*keylen)(const char *fn));
 int mutt_hcache_store(void *db, const char *filename, HEADER *h,
                       unsigned long uid_validity,
-                      size_t (*keylen)(const char *fn));
+                      ssize_t (*keylen)(const char *fn));
 int mutt_hcache_delete(void *db, const char *filename,
-                       size_t (*keylen)(const char *fn));
+                       ssize_t (*keylen)(const char *fn));
 #endif /* USE_HCACHE */
 
 #endif /* !_MUTT_HCACHE_H */
index d94f4a0..f180f38 100644 (file)
@@ -40,9 +40,9 @@ typedef struct {
 /* forward declarations */
 static int tunnel_socket_open (CONNECTION *);
 static int tunnel_socket_close (CONNECTION *);
-static int tunnel_socket_read (CONNECTION * conn, char *buf, size_t len);
+static int tunnel_socket_read (CONNECTION * conn, char *buf, ssize_t len);
 static int tunnel_socket_write (CONNECTION * conn, const char *buf,
-                                size_t len);
+                                ssize_t len);
 
 /* -- public functions -- */
 int mutt_tunnel_socket_setup (CONNECTION * conn)
@@ -136,7 +136,7 @@ static int tunnel_socket_close (CONNECTION * conn)
   return 0;
 }
 
-static int tunnel_socket_read (CONNECTION * conn, char *buf, size_t len)
+static int tunnel_socket_read (CONNECTION * conn, char *buf, ssize_t len)
 {
   TUNNEL_DATA *tunnel = (TUNNEL_DATA *) conn->sockdata;
   int rc;
@@ -152,7 +152,7 @@ static int tunnel_socket_read (CONNECTION * conn, char *buf, size_t len)
 }
 
 static int tunnel_socket_write (CONNECTION * conn, const char *buf,
-                                size_t len)
+                                ssize_t len)
 {
   TUNNEL_DATA *tunnel = (TUNNEL_DATA *) conn->sockdata;
   int rc;
index 5378541..d90ec4f 100644 (file)
@@ -92,7 +92,7 @@ void menu_current_top (MUTTMENU *);
 void menu_current_middle (MUTTMENU *);
 void menu_current_bottom (MUTTMENU *);
 void menu_check_recenter (MUTTMENU *);
-void menu_status_line (char *, size_t, MUTTMENU *, const char *);
+void menu_status_line (char *, ssize_t, MUTTMENU *, const char *);
 
 MUTTMENU *mutt_new_menu (void);
 void mutt_menuDestroy (MUTTMENU **);
diff --git a/mh.c b/mh.c
index baff9e4..5ca542f 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -141,7 +141,7 @@ static void mh_read_sequences (struct mh_sequences *mhs, const char *path)
   int line = 1;
   char *buff = NULL;
   char *t;
-  size_t sz = 0;
+  ssize_t sz = 0;
 
   short f;
   int first, last;
@@ -272,7 +272,7 @@ void mh_update_sequences (CONTEXT * ctx)
   char *tmpfname;
   char *buff = NULL;
   char *p;
-  size_t s;
+  ssize_t s;
   int l = 0;
   int i;
 
@@ -383,7 +383,7 @@ static void mh_sequences_add_one (CONTEXT * ctx, int n, short unseen,
 
   char *buff = NULL;
   int line;
-  size_t sz;
+  ssize_t sz;
 
   if (mh_mkstemp (ctx, &nfp, &tmpfname) == -1)
     return;
@@ -754,7 +754,7 @@ static int maildir_move_to_context (CONTEXT * ctx, struct maildir **md)
 }
 
 #ifdef USE_HCACHE
-static size_t maildir_hcache_keylen (const char *fn)
+static ssize_t maildir_hcache_keylen (const char *fn)
 {
     return m_strchrnul(fn, ':') - fn;
 }
@@ -894,7 +894,7 @@ int ch_compar (const void *a, const void *b)
   return (int) (*((const char *) a) - *((const char *) b));
 }
 
-static void maildir_flags (char *dest, size_t destlen, HEADER * hdr)
+static void maildir_flags (char *dest, ssize_t destlen, HEADER * hdr)
 {
   *dest = '\0';
 
@@ -1383,7 +1383,7 @@ err:
   return -1;
 }
 
-static char *maildir_canon_filename (char *dest, const char *src, size_t l)
+static char *maildir_canon_filename (char *dest, const char *src, ssize_t l)
 {
   char *t, *u;
 
index b40ddbb..b22f0b6 100644 (file)
@@ -48,14 +48,14 @@ struct coord {
   short r, c;
 };
 
-static REMAILER **mix_type2_list (size_t * l);
+static REMAILER **mix_type2_list (ssize_t * l);
 static REMAILER *mix_new_remailer (void);
 static const char *mix_format_caps (REMAILER * r);
 static int mix_chain_add (MIXCHAIN * chain, const char *s,
                           REMAILER ** type2_list);
 static int mix_get_caps (const char *capstr);
-static void mix_add_entry (REMAILER ***, REMAILER *, size_t *, size_t *);
-static void mix_entry (char *b, size_t blen, MUTTMENU * menu, int num);
+static void mix_add_entry (REMAILER ***, REMAILER *, ssize_t *, ssize_t *);
+static void mix_entry (char *b, ssize_t blen, MUTTMENU * menu, int num);
 static void mix_free_remailer (REMAILER ** r);
 static void mix_free_type2_list (REMAILER *** ttlp);
 static void mix_redraw_ce (REMAILER ** type2_list, struct coord *coords,
@@ -103,7 +103,7 @@ static int mix_get_caps (const char *capstr)
 }
 
 static void mix_add_entry (REMAILER *** type2_list, REMAILER * entry,
-                           size_t * slots, size_t * used)
+                           ssize_t * slots, ssize_t * used)
 {
   if (*used == *slots) {
     *slots += 5;
@@ -131,7 +131,7 @@ static void mix_free_remailer (REMAILER ** r)
 
 /* parse the type2.list as given by mixmaster -T */
 
-static REMAILER **mix_type2_list (size_t * l)
+static REMAILER **mix_type2_list (ssize_t * l)
 {
   FILE *fp;
   pid_t mm_pid;
@@ -142,7 +142,7 @@ static REMAILER **mix_type2_list (size_t * l)
   char *t;
 
   REMAILER **type2_list = NULL, *p;
-  size_t slots = 0, used = 0;
+  ssize_t slots = 0, used = 0;
 
   if (!l)
     return NULL;
@@ -367,7 +367,7 @@ static const char *mix_format_caps (REMAILER * r)
  */
 
 static const char *mix_entry_fmt (char *dest,
-                                  size_t destlen,
+                                  ssize_t destlen,
                                   char op,
                                   const char *src,
                                   const char *prefix,
@@ -422,10 +422,10 @@ static const char *mix_entry_fmt (char *dest,
 
 
 
-static void mix_entry (char *b, size_t blen, MUTTMENU * menu, int num)
+static void mix_entry (char *b, ssize_t blen, MUTTMENU * menu, int num)
 {
   REMAILER **type2_list = (REMAILER **) menu->data;
-  int w=(COLS-SW)>blen?blen:(COLS-SW);
+  int w = (COLS-SW) > blen ? blen : (COLS-SW);
 
   mutt_FormatString (b, w, NONULL (MixEntryFormat), mix_entry_fmt,
                      (unsigned long) type2_list[num], M_FORMAT_ARROWCURSOR);
@@ -478,7 +478,7 @@ void mix_make_chain (string_list_t ** chainp, int *redraw)
   short c_redraw = 1;
 
   REMAILER **type2_list = NULL;
-  size_t ttll = 0;
+  ssize_t ttll = 0;
 
   struct coord *coords = NULL;
 
index 7a17db6..fae6b06 100644 (file)
@@ -37,7 +37,7 @@ typedef struct type2 REMAILER;
 
 
 struct mixchain {
-  size_t cl;
+  ssize_t cl;
   int ch[MAXMIXES];
 };
 
diff --git a/send.c b/send.c
index 395ecb0..6821f01 100644 (file)
--- a/send.c
+++ b/send.c
@@ -183,7 +183,7 @@ static address_t *find_mailing_lists (address_t * t, address_t * c)
 static int edit_address (address_t ** a, const char *field)
 {
   char buf[HUGE_STRING];
-  char *err = NULL;
+  const char *err = NULL;
   int idna_ok = 0;
 
   do {
@@ -1099,8 +1099,8 @@ int ci_send_message (int flags, /* send mode */
   char *pgpkeylist = NULL;
 
   /* save current value of "pgp_sign_as" */
-  char *signas = NULL, *err = NULL;
-  const char *tag = NULL;
+  char *signas = NULL;
+  const char *tag = NULL, *err = NULL;
   char *ctype;
 
   int rv = -1;
index faf9bcf..caa8538 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -96,7 +96,7 @@ static char *shortened_hierarchy (char *box, int maxlen)
   return m_strdup(box);
 }
 
-static const char* sidebar_number_format (char* dest, size_t destlen, char op,
+static const char* sidebar_number_format (char* dest, ssize_t destlen, char op,
                                           const char* src, const char* fmt,
                                           const char* ifstr, const char* elstr,
                                           unsigned long data, format_flag flags) {
@@ -187,7 +187,7 @@ int sidebar_need_count (void) {
  *      0       item was not printed ('cause of $sidebar_newmail_only)
  *      1       item was printed
  */
-int make_sidebar_entry (char* box, int idx, size_t len)
+int make_sidebar_entry (char* box, int idx, ssize_t len)
 {
   int shortened = 0, lencnt = 0;
   char no[SHORT_STRING], entry[SHORT_STRING];
@@ -273,7 +273,7 @@ void sidebar_set_buffystats (CONTEXT* Context) {
 }
 
 void sidebar_draw_frames (void) {
-  size_t i,delim_len;
+  ssize_t i,delim_len;
 
   if (!option(OPTMBOXPANE) || SidebarWidth==0) 
     return;
@@ -325,7 +325,7 @@ int sidebar_draw (int menu) {
       last_line = LINES - 2 + (option (OPTSTATUSONTOP) && !option (OPTHELP) ? 1 : 0),
       i = 0,line;
   BUFFY *tmp;
-  size_t delim_len = m_strlen(SidebarDelim);
+  ssize_t delim_len = m_strlen(SidebarDelim);
   char blank[SHORT_STRING];
 
   known_lines=last_line-first_line;
diff --git a/state.c b/state.c
index c4e2997..4d4c19a 100644 (file)
--- a/state.c
+++ b/state.c
@@ -19,7 +19,7 @@
 #include "state.h"
 #include "rfc3676.h"
 
-static void state_prefix_put (const char *d, size_t dlen, STATE * s)
+static void state_prefix_put (const char *d, ssize_t dlen, STATE * s)
 {
   if (s->prefix)
     while (dlen--)
@@ -28,12 +28,12 @@ static void state_prefix_put (const char *d, size_t dlen, STATE * s)
     fwrite (d, dlen, 1, s->fpout);
 }
 
-void mutt_convert_to_state (iconv_t cd, char *bufi, size_t * l, STATE * s)
+void mutt_convert_to_state (iconv_t cd, char *bufi, ssize_t * l, STATE * s)
 {
   char bufo[BUFO_SIZE];
   const char *ib;
   char *ob;
-  size_t ibl, obl;
+  ssize_t ibl, obl;
 
   if (!bufi) {
     if (cd != (iconv_t) (-1)) {
diff --git a/state.h b/state.h
index 45f97e2..61b9c95 100644 (file)
--- a/state.h
+++ b/state.h
@@ -41,6 +41,6 @@ void state_attach_puts (const char *, STATE *);
 void state_prefix_putc (char, STATE *);
 int state_printf (STATE *, const char *, ...);
 
-void mutt_convert_to_state (iconv_t, char*, size_t*, STATE*);
+void mutt_convert_to_state (iconv_t, char*, ssize_t*, STATE*);
 
 #endif /* !_MUTT_STATE_H */
index 80eac1d..1f756a5 100644 (file)
--- a/status.c
+++ b/status.c
@@ -31,7 +31,7 @@
 
 #define SW              (option(OPTMBOXPANE)?SidebarWidth:0)
 
-static char *get_sort_str (char *buf, size_t buflen, int method)
+static char *get_sort_str (char *buf, ssize_t buflen, int method)
 {
   snprintf (buf, buflen, "%s%s%s",
             (method & SORT_REVERSE) ? "reverse-" : "",
@@ -58,7 +58,7 @@ static char *get_sort_str (char *buf, size_t buflen, int method)
  * %t = # of tagged messages [option]
  * %v = Madmutt version 
  * %V = currently active limit pattern [option] */
-static const char *status_format_str (char *buf, size_t buflen, char op,
+static const char *status_format_str (char *buf, ssize_t buflen, char op,
                                       const char *src, const char *prefix,
                                       const char *ifstring,
                                       const char *elsestring,
@@ -300,7 +300,7 @@ static const char *status_format_str (char *buf, size_t buflen, char op,
   return (src);
 }
 
-void menu_status_line (char* buf, size_t len, MUTTMENU* menu, const char* p) {
+void menu_status_line (char* buf, ssize_t len, MUTTMENU* menu, const char* p) {
   /*
    * if we have enough space for buffer, format lines to $COLS-$SidebarWidth
    * only to not wrap past end of screen