]> git.mikk.net Git - liburl/commitdiff
Fixed type mismatches, missing includes, etc.
authorchris mikkelson <chris@mikk.net>
Sun, 28 Feb 2010 00:45:03 +0000 (18:45 -0600)
committerchris mikkelson <chris@mikk.net>
Sun, 28 Feb 2010 00:45:03 +0000 (18:45 -0600)
base64.c
msgproc.c
msgproc.h
multipart.c
quoted-printable.c
re_stream.c
re_stream.h

index 96a85bb52307ece570231eaf9ed9797dd7b9cb2b..117dc39070024b3700b716501e6e85220bd600ff 100644 (file)
--- a/base64.c
+++ b/base64.c
@@ -5,6 +5,7 @@
 
 /* Adapted from phk@freebsd.dk's public domain implementation. */
 
+#include <stdlib.h>
 #include <string.h>
 #include "msgproc.h"
 
@@ -111,12 +112,12 @@ static void
 base64_start(msgproc *m)
 {
        struct b64_state *b64s = malloc(sizeof(b64s));
-       base64_start(b64s);
+       b64_start(b64s);
        msgproc_setpriv(m, (void *)b64s);
 }
 
 static void
-base64_process(msgproc *m, char *buf, int len)
+base64_process(msgproc *m, char *buf, size_t len)
 {
        char tmp[2048];
        int tmplen, ret;
@@ -135,7 +136,7 @@ base64_process(msgproc *m, char *buf, int len)
 }
 
 static void
-base64_finish(struct msgproc_stage *m)
+base64_finish(msgproc *m)
 {
        struct b64_state *b64s = msgproc_getpriv(m);
        if (b64s) {
index 6f7da1a3b0a0c07341e88df2451e887e37f282e6..d311f5e61f57d19385c8d5d803ee9164eb5fd314 100644 (file)
--- a/msgproc.c
+++ b/msgproc.c
@@ -3,6 +3,7 @@
  * All Rights Reserved, for now.
  */
 
+#include <stdlib.h>
 #include "msgproc.h"
 
 msgproc *
@@ -62,9 +63,9 @@ msgproc_module_init(msgproc_module *m)
 }
 
 void
-msgproc_module_set(msgproc_module *m, void *data, size_t dsiz)
+msgproc_module_set(msgproc_module *m, int key, void *data, size_t dsiz)
 {
-       if (m) m->mpm_set(data, dsiz);
+       if (m) m->mpm_set(key, data, dsiz);
 }
 
 void
index 9a76f72ca2e66ea3079e7a9f28e32d1e2fa2186b..da5ebf39708e5e93723637f14809c1dee8d86323 100644 (file)
--- a/msgproc.h
+++ b/msgproc.h
@@ -3,10 +3,22 @@
  * All Rights Reserved, for now.
  */
 
-type struct _msgproc_s msgproc;
+#include <sys/types.h>
+
+typedef struct _msgproc_s msgproc;
+
+typedef enum {
+       MSGPROC_MESSAGE,
+       MSGPROC_PART,
+       MSGPROC_MULTIPART,
+       MSGPROC_BASE64,
+       MSGPROC_QUOTED_PRINTABLE,
+       MSGPROC_TEXT,
+       MSGPROC_HTML
+} msgproc_module_type;
 
 typedef struct {
-       int mpm_type;
+       msgproc_module_type mpm_type;
        void (*mpm_init)(void);
        void (*mpm_set)(int, void *, size_t);
        void (*mp_start)(msgproc *);
@@ -18,7 +30,7 @@ typedef struct {
 
 struct _msgproc_s {
        void *mp_priv;
-       msgproc_module mp_mod;
+       msgproc_module *mp_mod;
        msgproc *mp_prev, *mp_next;
 };
 
@@ -30,13 +42,13 @@ void *msgproc_getpriv(msgproc *);
 msgproc *msgproc_next(msgproc *);
 msgproc *msgproc_prev(msgproc *);
 
-void msgproc_module_init(mgproc_module *);
+void msgproc_module_init(msgproc_module *);
 void msgproc_module_set(msgproc_module *, int, void *, size_t);
 void msgproc_start(msgproc *);
 void msgproc_set(msgproc*, int, void *, size_t);
 void msgproc_process(msgproc *, char *, size_t);
 void msgproc_finish(msgproc *);
-void msgproc_module_shutdown(mgproc_module *);
+void msgproc_module_shutdown(msgproc_module *);
 
 extern msgproc_module msgproc_text,
                        msgproc_html,
index ac5a984c6cff34337bb1e4bb51794bcaa6daa2a3..074e9c8782b19cd7baeda66930550f048a56cf78 100644 (file)
@@ -3,6 +3,7 @@
  * All Rights Reserved, for now.
  */
 
+#include <stdlib.h>
 #include <string.h>
 #include "msgproc.h"
 
@@ -157,9 +158,9 @@ multipart_finish(msgproc *m)
 msgproc_module msgproc_multipart = {
        MSGPROC_MULTIPART,              /* type */
        NULL,                           /* module init */
-       setboundary,                    /* set module parameter */
+       NULL,                           /* set module parameter */
        multipart_start,                /* start module instance */
-       NULL,                           /* set module instance parameter */
+       setboundary,                    /* set module instance parameter */
        multipart_process,              /* process data */
        multipart_finish,               /* shut down, free module instance */
        NULL                            /* shut down, free module */
index e80cfab5f30aae7a6d1d1c552cd16c603153acf5..2696140d57ad739c039043bc7fa31ecc98aea502 100644 (file)
@@ -10,6 +10,7 @@ struct qp_state *
 qp_start(struct qp_state *qps)
 {
        bzero(qps, sizeof(*qps));
+       return qps;
 }
 
 void
index 9a7f4a1364f29ee1a43757f52950d27978cc6cab..dd99d35a1809cd9bc126d73cfe63f067198ea84c 100644 (file)
@@ -5,6 +5,7 @@
 /* Stream-based regular expression matching implementation */
 
 #include <pcre.h>
+#include <strings.h>
 #include "re_stream.h"
 
 /* TODO: make these runtime tunables, add upper bound for allocation. */
index 24e00a8eafbbe342eeaf1e04d8d53684373c9c12..2bd413b445101cc2f511812c23a2b8805b6be278 100644 (file)
@@ -12,6 +12,7 @@ struct stream_re {
 };
 
 struct stream_re *re_stream_start(struct stream_re *, pcre *, int);
-struct stream_re *re_stream_stop(struct stream_re *);
+void re_stream_stop(struct stream_re *);
 int re_stream_result(struct stream_re *);
 char *re_stream_getresult(struct stream_re *);
+int re_stream_exec(struct stream_re *, char *, int);