#include <h/mhparse.h>
#include <h/addrsbr.h>
#include <h/utils.h>
+#include "base64.h"
#include "unquote.h"
/*
field_encode_quoted(const char *name, char **value, const char *charset,
int ascii, int encoded, int phraserules)
{
- int prefixlen = name ? strlen(name) + 2: 0, outlen = 0, column, newline = 1;
+ int prefixlen = name ? strlen(name) + 2: 0, outlen = 0, column;
int charsetlen = strlen(charset), utf8;
char *output = NULL, *p, *q = NULL;
utf8 = strcasecmp(charset, "UTF-8") == 0;
+ bool newline = true;
while (*p != '\0') {
/*
* Start a new line, if it's time
tokenlen = snprintf(q, outlen - (q - output), "=?%s?Q?", charset);
q += tokenlen;
column = prefixlen + tokenlen;
- newline = 0;
+ newline = false;
}
/*
continue;
if (column >= ENCODELINELIMIT - 2) {
- newline = 1;
+ newline = true;
} else if (utf8) {
/*
* Okay, this is a bit weird, but to explain a bit more ...
* allow for the encoded output.
*/
if (column + (utf8len(p) * 3) > ENCODELINELIMIT - 2) {
- newline = 1;
+ newline = true;
}
}
}
output = NULL;
out:
- mh_xfree(tmpbuf);
- mh_xfree(output);
+ free(tmpbuf);
+ free(output);
return errflag > 0;
}