]> diplodocus.org Git - nmh/commitdiff
Move base64.c's prototypes from prototypes.h to new base64.h.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sat, 2 Sep 2017 17:49:11 +0000 (18:49 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sat, 2 Sep 2017 17:56:52 +0000 (18:56 +0100)
13 files changed:
Makefile.am
h/prototypes.h
mts/smtp/smtp.c
sbr/base64.c
sbr/base64.h [new file with mode: 0644]
sbr/encode_rfc2047.c
sbr/icalendar.l
sbr/message_id.c
sbr/netsec.c
uip/mhoutsbr.c
uip/mhparse.c
uip/popsbr.c
uip/viamail.c

index 1ad9679..68a7d90 100644 (file)
@@ -358,6 +358,7 @@ noinst_HEADERS = \
     h/tws.h \
     h/utils.h \
     mts/smtp/smtp.h \
+    sbr/base64.h \
     sbr/ctype-checked.h \
     sbr/lock_file.h \
     sbr/m_maildir.h \
index 1f40f40..f28f283 100644 (file)
@@ -325,39 +325,6 @@ int what_now (char *, int, int, char *, char *,
        int, struct msgs *, char *, int, char *, int);
 int WhatNow(int, char **) NORETURN;
 
-/* Includes trailing NUL */
-
-#define BASE64SIZE(x) ((((x + 2) / 3) * 4) + 1)
-
-/*
- * Copy data from one file to another, converting to base64-encoding.
- *
- * Arguments include:
- *
- * in          - Input filehandle (unencoded data)
- * out         - Output filename (base64-encoded data)
- * crlf                - If set, output encoded CRLF for every LF on input.
- *
- * Returns OK on success, NOTOK otherwise.
- */
-int writeBase64aux(FILE *in, FILE *out, int crlf);
-
-int writeBase64 (const unsigned char *, size_t, unsigned char *);
-int writeBase64raw (const unsigned char *, size_t, unsigned char *);
-
-/*
- * encoded      - the string to be decoded
- * decoded      - the decoded bytes
- * len          - number of decoded bytes
- * skip-crs     - non-zero for text content, and for which CR's should be
- *                skipped
- * digest       - for an MD5 digest, it can be null
- */
-int decodeBase64 (const char *encoded, unsigned char **decoded, size_t *len,
-                  int skip_crs, unsigned char *digest);
-
-void hexify (const unsigned char *, size_t, char **);
-
 /*
  * credentials management
  */
index e3ac50d..2f32877 100644 (file)
@@ -13,6 +13,7 @@
 #include <h/netsec.h>
 
 #include <sys/socket.h>
+#include "../../sbr/base64.h"
 
 /*
  * This module implements an interface to SendMail very similar
index 995f955..f24e9fe 100644 (file)
 static const char nib2b64[0x40+1] =
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
+/*
+ * Copy data from one file to another, converting to base64-encoding.
+ *
+ * Arguments include:
+ *
+ * in          - Input filehandle (unencoded data)
+ * out         - Output filename (base64-encoded data)
+ * crlf                - If set, output encoded CRLF for every LF on input.
+ *
+ * Returns OK on success, NOTOK otherwise.
+ */
 int
 writeBase64aux (FILE *in, FILE *out, int crlf)
 {
@@ -227,7 +238,13 @@ static const unsigned char b642nib[0x80] = {
 
 /*
  * Decode a base64 string.  The result, decoded, must be freed by the caller.
- * See description of arguments with declaration in h/prototypes.h.
+ *
+ * encoded      - the string to be decoded
+ * decoded      - the decoded bytes
+ * len          - number of decoded bytes
+ * skip-crs     - non-zero for text content, and for which CR's should be
+ *                skipped
+ * digest       - for an MD5 digest, it can be null
  */
 int
 decodeBase64 (const char *encoded, unsigned char **decoded, size_t *len,
diff --git a/sbr/base64.h b/sbr/base64.h
new file mode 100644 (file)
index 0000000..c5981d0
--- /dev/null
@@ -0,0 +1,15 @@
+/* base64.h -- routines for converting to base64
+ *
+ * This code is Copyright (c) 2017, by the authors of nmh.  See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information.
+ */
+
+int writeBase64aux(FILE *, FILE *, int);
+int writeBase64(const unsigned char *, size_t, unsigned char *);
+int writeBase64raw(const unsigned char *, size_t, unsigned char *);
+int decodeBase64(const char *, unsigned char **, size_t *, int, unsigned char *);
+void hexify(const unsigned char *, size_t, char **);
+
+/* Includes trailing NUL. */
+#define BASE64SIZE(x) ((((x + 2) / 3) * 4) + 1)
index 75b5808..c86cea7 100644 (file)
@@ -9,6 +9,7 @@
 #include <h/mhparse.h>
 #include <h/addrsbr.h>
 #include <h/utils.h>
+#include "base64.h"
 #include "unquote.h"
 
 /*
index 8b0721b..365d072 100644 (file)
@@ -11,6 +11,7 @@
 #include "h/mh.h"
 #include "h/icalendar.h"
 #include "sbr/icalparse.h"
+#include "base64.h"
 
 static char *unfold (char *, size_t *);
 static void destroy_icallex(void);
index a66d876..8decfa8 100644 (file)
@@ -10,6 +10,7 @@
 #include "m_rand.h"
 #include "message_id.h"
 #include <sys/time.h>  /* for gettimeofday() */
+#include "base64.h"
 
 
 static enum {
index a533042..edb8d8c 100644 (file)
@@ -12,6 +12,7 @@
 #include <h/oauth.h>
 #include <stdarg.h>
 #include <sys/select.h>
+#include "base64.h"
 
 #ifdef CYRUS_SASL
 #include <sasl/sasl.h>
index 65d9640..a9735d0 100644 (file)
@@ -15,6 +15,7 @@
 #include <h/mime.h>
 #include <h/mhparse.h>
 #include "mhoutsbr.h"
+#include "../sbr/base64.h"
 
 
 /*
index 904c123..4d8e91e 100644 (file)
@@ -20,6 +20,7 @@
 #ifdef HAVE_ICONV
 # include <iconv.h>
 #endif /* HAVE_ICONV */
+#include "../sbr/base64.h"
 
 
 extern int debugsw;
index d4a6521..de9cafb 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <h/popsbr.h>
 #include <h/signals.h>
+#include "../sbr/base64.h"
 
 #define        TRM     "."
 
index 3c92f5f..2104686 100644 (file)
@@ -14,6 +14,7 @@
 #include <h/mhparse.h>
 #include <h/utils.h>
 #include "../sbr/m_mktemp.h"
+#include "../sbr/base64.h"
 
 #define VIAMAIL_SWITCHES \
     X("to mailpath", 0, TOSW) \