static int parse_header_attrs (const char *, const char *, char **, PM *,
PM *, char **);
static size_t param_len(PM, int, size_t, int *, int *, size_t *);
-static size_t encode_param(PM, char *, size_t, size_t, size_t, int);
static size_t normal_param(PM, char *, size_t, size_t, size_t);
static int get_dispo (char *, CT, int);
m_getfld_state_t gstate = 0;
/* allocate the content structure */
- if (!(ct = (CT) mh_xcalloc (1, sizeof(*ct))))
- adios (NULL, "out of memory");
-
+ ct = mh_xcalloc(1, sizeof *ct);
ct->c_fp = in;
ct->c_file = add (file, NULL);
ct->c_begin = ftell (ct->c_fp) + 1;
ct->c_subtype = ct_str_subtype (CT_TEXT, ci->ci_subtype);
/* allocate text character set structure */
- if ((t = (struct text *) mh_xcalloc (1, sizeof(*t))) == NULL)
- adios (NULL, "out of memory");
+ t = mh_xcalloc(1, sizeof *t);
ct->c_ctparams = (void *) t;
/* scan for charset parameter */
}
/* allocate primary structure for multipart info */
- if ((m = (struct multipart *) mh_xcalloc (1, sizeof(*m))) == NULL)
- adios (NULL, "out of memory");
+ m = mh_xcalloc(1, sizeof *m);
ct->c_ctparams = (void *) m;
/* check if boundary parameter contains only whitespace characters */
if (strcmp (bufp + 2, m->mp_start))
continue;
next_part:
- if ((part = (struct part *) mh_xcalloc (1, sizeof(*part))) == NULL)
- adios (NULL, "out of memory");
+ part = mh_xcalloc(1, sizeof *part);
*next = part;
next = &part->mp_next;
PM pm;
struct partial *p;
- if ((p = (struct partial *) mh_xcalloc (1, sizeof(*p))) == NULL)
- adios (NULL, "out of memory");
+ p = mh_xcalloc(1, sizeof *p);
ct->c_ctparams = (void *) p;
/* scan for parameters "id", "number", and "total" */
CT p;
FILE *fp;
- if ((e = (struct exbody *) mh_xcalloc (1, sizeof(*e))) == NULL)
- adios (NULL, "out of memory");
+ e = mh_xcalloc(1, sizeof *e);
ct->c_ctparams = (void *) e;
if (!ct->c_fp
/* sbeck -- handle suffixes */
CI ci;
CE ce = &ct->c_cefile;
- const char *decoded;
+ unsigned char *decoded;
size_t decoded_len;
unsigned char digest[16];
if (decodeBase64 (buffer, &decoded, &decoded_len, ct->c_type == CT_TEXT,
ct->c_digested ? digest : NULL) == OK) {
size_t i;
- const char *decoded_p = decoded;
+ unsigned char *decoded_p = decoded;
for (i = 0; i < decoded_len; ++i) {
putc (*decoded_p++, ce->ce_fp);
}
+ free ((char *) decoded);
if (ferror (ce->ce_fp)) {
content_error (ce->ce_file, ct, "error writing to");
goto clean_up;
static int
readDigest (CT ct, char *cp)
{
- const char *digest;
+ unsigned char *digest;
size_t len;
if (decodeBase64 (cp, &digest, &len, 0, NULL) == OK) {
const size_t maxlen = sizeof ct->c_digest / sizeof ct->c_digest[0];
- if (strlen (digest) <= maxlen) {
+ if (strlen ((char *) digest) <= maxlen) {
memcpy (ct->c_digest, digest, maxlen);
if (debugsw) {
} else {
if (debugsw) {
fprintf (stderr, "invalid MD5 digest (got %d octets)\n",
- (int) strlen (digest));
+ (int) strlen ((char *) digest));
}
return NOTOK;
* Output an encoded parameter string.
*/
-static size_t
+size_t
encode_param(PM pm, char *output, size_t len, size_t valuelen,
size_t valueoff, int index)
{