From: chris mikkelson Date: Sun, 28 Feb 2010 00:45:03 +0000 (-0600) Subject: Fixed type mismatches, missing includes, etc. X-Git-Url: https://git.mikk.net/?a=commitdiff_plain;h=680cad17754899671afcae3e956cfb2ec70c7465;p=liburl Fixed type mismatches, missing includes, etc. --- diff --git a/base64.c b/base64.c index 96a85bb..117dc39 100644 --- a/base64.c +++ b/base64.c @@ -5,6 +5,7 @@ /* Adapted from phk@freebsd.dk's public domain implementation. */ +#include #include #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) { diff --git a/msgproc.c b/msgproc.c index 6f7da1a..d311f5e 100644 --- a/msgproc.c +++ b/msgproc.c @@ -3,6 +3,7 @@ * All Rights Reserved, for now. */ +#include #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 diff --git a/msgproc.h b/msgproc.h index 9a76f72..da5ebf3 100644 --- a/msgproc.h +++ b/msgproc.h @@ -3,10 +3,22 @@ * All Rights Reserved, for now. */ -type struct _msgproc_s msgproc; +#include + +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, diff --git a/multipart.c b/multipart.c index ac5a984..074e9c8 100644 --- a/multipart.c +++ b/multipart.c @@ -3,6 +3,7 @@ * All Rights Reserved, for now. */ +#include #include #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 */ diff --git a/quoted-printable.c b/quoted-printable.c index e80cfab..2696140 100644 --- a/quoted-printable.c +++ b/quoted-printable.c @@ -10,6 +10,7 @@ struct qp_state * qp_start(struct qp_state *qps) { bzero(qps, sizeof(*qps)); + return qps; } void diff --git a/re_stream.c b/re_stream.c index 9a7f4a1..dd99d35 100644 --- a/re_stream.c +++ b/re_stream.c @@ -5,6 +5,7 @@ /* Stream-based regular expression matching implementation */ #include +#include #include "re_stream.h" /* TODO: make these runtime tunables, add upper bound for allocation. */ diff --git a/re_stream.h b/re_stream.h index 24e00a8..2bd413b 100644 --- a/re_stream.h +++ b/re_stream.h @@ -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);