oops, makedoc is used in the build process.
[apps/madmutt.git] / crypt.c
diff --git a/crypt.c b/crypt.c
index 2f20bc1..e5019ec 100644 (file)
--- a/crypt.c
+++ b/crypt.c
 # include "config.h"
 #endif
 
+#include <lib-lib/mem.h>
+
 #include "mutt.h"
+#include "ascii.h"
+#include "handler.h"
 #include "mutt_curses.h"
 #include "mime.h"
 #include "copy.h"
 #include "mutt_crypt.h"
 #include "pgp.h"
 
-#include "lib/mem.h"
 #include "lib/intl.h"
 #include "lib/str.h"
 
@@ -49,7 +52,7 @@
 
 
 /* print the current time to avoid spoofing of the signature output */
-void crypt_current_time (STATE * s, char *app_name)
+void crypt_current_time (STATE * s, const char *app_name)
 {
   time_t t;
   char p[STRING], tmp[STRING];
@@ -485,7 +488,7 @@ int crypt_write_signed (BODY * a, STATE * s, const char *tempfile)
     return -1;
   }
 
-  fseek (s->fpin, a->hdr_offset, 0);
+  fseeko (s->fpin, a->hdr_offset, 0);
   bytes = a->length + a->offset - a->hdr_offset;
   hadcr = 0;
   while (bytes > 0) {
@@ -695,7 +698,7 @@ int crypt_get_keys (HEADER * msg, char **keylist)
 
 
 
-static void crypt_fetch_signatures (BODY *** signatures, BODY * a, int *n)
+static void crypt_fetch_signatures (BODY ***signatures, BODY * a, int *n)
 {
   if (!WithCrypto)
     return;
@@ -705,7 +708,7 @@ static void crypt_fetch_signatures (BODY *** signatures, BODY * a, int *n)
       crypt_fetch_signatures (signatures, a->parts, n);
     else {
       if ((*n % 5) == 0)
-        safe_realloc (signatures, (*n + 6) * sizeof (BODY **));
+        p_realloc(signatures, *n + 6);
 
       (*signatures)[(*n)++] = a;
     }
@@ -717,7 +720,7 @@ static void crypt_fetch_signatures (BODY *** signatures, BODY * a, int *n)
  * This routine verifies a  "multipart/signed"  body.
  */
 
-void mutt_signed_handler (BODY * a, STATE * s)
+int mutt_signed_handler (BODY * a, STATE * s)
 {
   char tempfile[_POSIX_PATH_MAX];
   char *protocol;
@@ -729,9 +732,10 @@ void mutt_signed_handler (BODY * a, STATE * s)
   int sigcnt = 0;
   int i;
   short goodsig = 1;
+  int rc = 0;
 
   if (!WithCrypto)
-    return;
+    return (-1);
 
   protocol = mutt_get_parameter ("protocol", a->parameter);
   a = a->parts;
@@ -759,8 +763,7 @@ void mutt_signed_handler (BODY * a, STATE * s)
     state_attach_puts (_("[-- Error: "
                          "Inconsistent multipart/signed structure! --]\n\n"),
                        s);
-    mutt_body_handler (a, s);
-    return;
+    return mutt_body_handler (a, s);
   }
 
 
@@ -777,8 +780,7 @@ void mutt_signed_handler (BODY * a, STATE * s)
     state_printf (s, _("[-- Error: "
                        "Unknown multipart/signed protocol %s! --]\n\n"),
                   protocol);
-    mutt_body_handler (a, s);
-    return;
+    return mutt_body_handler (a, s);
   }
 
   if (s->flags & M_DISPLAY) {
@@ -825,15 +827,17 @@ void mutt_signed_handler (BODY * a, STATE * s)
       state_attach_puts (_("[-- The following data is signed --]\n\n"), s);
 
 
-      FREE (&signatures);
+      p_delete(&signatures);
     }
     else
       state_attach_puts (_("[-- Warning: Can't find any signatures. --]\n\n"),
                          s);
   }
 
-  mutt_body_handler (a, s);
+  rc = mutt_body_handler (a, s);
 
   if (s->flags & M_DISPLAY && sigcnt)
     state_attach_puts (_("\n[-- End of signed data --]\n"), s);
+
+  return (rc);
 }