a whole lot of size_t -> ssize_t.
[apps/madmutt.git] / lib-crypt / smime.c
index 1683a87..5e9fae0 100644 (file)
@@ -134,15 +134,11 @@ int smime_valid_passphrase (void)
 
 /* 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;
@@ -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)
 {
@@ -309,7 +305,7 @@ static pid_t smime_invoke (FILE ** smimein, FILE ** smimeout,
    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];
@@ -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];
-  FILE *index;
+  FILE *idx;
   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));
 
-  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;
-  while (!feof (index)) {
-    if (fgets (buf, sizeof (buf), index))
+  while (!feof (idx)) {
+    if (fgets (buf, sizeof (buf), idx))
       cert_num++;
   }
-  fclose (index);
+  fclose (idx);
 
   for (;;) {
     *qry = 0;
@@ -392,20 +389,20 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public)
               _("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);
-    while (!feof (index)) {
+    while (!feof (idx)) {
       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)
-        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 */
@@ -425,7 +422,7 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public)
 
       cur++;
     }
-    fclose (index);
+    fclose (idx);
 
     /* 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;
-  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;
@@ -1056,7 +1053,7 @@ static char *smime_extract_signer_certificate (char *infile)
 
 /* 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;
@@ -1505,7 +1502,7 @@ int smime_verify_one (BODY * sigbdy, STATE * s, const char *tempfile)
   int badsig = -1;
 
   long tmpoffset = 0;
-  size_t tmplength = 0;
+  ssize_t tmplength = 0;
   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;
-      size_t linelen;
+      ssize_t linelen;
 
       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;
-    size_t linelen;
+    ssize_t linelen;
 
     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;
-  size_t tmplength = b->length;
+  ssize_t tmplength = b->length;
   int origType = b->type;
   FILE *tmpfp = NULL;
   int rv = 0;