X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-mime%2Frfc2047.c;h=208d932c81ff972ee4100a644097696f019ebe8b;hp=3bd353cb2e0a412c6190d2b574a5308822fb8e0a;hb=a0aa4a45870f1607e8b41760866071692675c84d;hpb=d5fc962299f48696697e29f323e78c8bba6ca2d1 diff --git a/lib-mime/rfc2047.c b/lib-mime/rfc2047.c index 3bd353c..208d932 100644 --- a/lib-mime/rfc2047.c +++ b/lib-mime/rfc2047.c @@ -27,22 +27,13 @@ * please see the file GPL in the top level source directory. */ -#include -#include -#include +#include #include #include "charset.h" #include "thread.h" -#include -#include -#include -#include -#include -#include - /* If you are debugging this file, comment out the following line. */ /*#define NDEBUG*/ @@ -73,7 +64,7 @@ convert_string(const char *from, const char *f, ssize_t flen, cd = mutt_iconv_open(to, from, 0); - if (cd == (iconv_t)(-1)) + if (cd == MUTT_ICONV_ERROR) return -1; obl = 4 * flen + 1; @@ -157,7 +148,7 @@ char *mutt_choose_charset(const char *fromcode, const char *charsets, p_delete(&res); } - mutt_canonical_charset(buf, sizeof(buf), tocode); + charset_canonicalize(buf, sizeof(buf), tocode); m_strreplace(&tocode, buf); } @@ -271,7 +262,7 @@ static size_t try_block(const char *d, ssize_t dlen, ssize_t ibl = dlen; iconv_t cd = mutt_iconv_open(tocode, fromcode, 0); - assert (cd != (iconv_t)(-1)); + assert (cd != MUTT_ICONV_ERROR); ob = buf1; @@ -304,7 +295,7 @@ static size_t try_block(const char *d, ssize_t dlen, len_q = len + (ob - buf1) + 2 * count; /* Apparently RFC 1468 says to use B encoding for iso-2022-jp. */ - if (!ascii_strcasecmp(tocode, "ISO-2022-JP")) + if (mime_which_token(tocode, -1) == MIME_ISO_2022_JP) len_q = ENCWORD_LEN_MAX + 1; if (len_b < len_q && len_b <= ENCWORD_LEN_MAX) { @@ -338,7 +329,7 @@ encode_block(char *s, char *d, ssize_t dlen, if (fromcode) { cd = mutt_iconv_open(tocode, fromcode, 0); - assert (cd != (iconv_t) (-1)); + assert (cd != MUTT_ICONV_ERROR); ib = d, ibl = dlen, ob = buf1, obl = sizeof(buf1) - m_strlen(tocode); n1 = my_iconv(cd, &ib, &ibl, &ob, &obl); n2 = my_iconv(cd, 0, 0, &ob, &obl); @@ -361,7 +352,7 @@ static size_t choose_block(char *d, size_t dlen, int col, encoder_t **encoder, ssize_t *wlen) { size_t n, nn; - int utf8 = fromcode && !ascii_strcasecmp(fromcode, "UTF-8"); + int utf8 = mime_which_token(fromcode, -1) == MIME_UTF_8; n = dlen; for (;;) { @@ -452,7 +443,7 @@ static int rfc2047_encode(const char *d, ssize_t dlen, int col, } /* Hack to avoid labelling 8-bit data as us-ascii. */ - if (!icode && mutt_is_us_ascii(tocode)) + if (!icode && charset_is_us_ascii(tocode)) tocode = "unknown-8bit"; /* Adjust t0 for maximum length of line. */ @@ -564,7 +555,7 @@ static int rfc2047_encode(const char *d, ssize_t dlen, int col, } -void _rfc2047_encode_string(char **pd, int encode_specials, int col) +static void _rfc2047_encode_string(char **pd, int encode_specials, int col) { char *e; ssize_t elen; @@ -807,7 +798,7 @@ void rfc2047_decode(char **pd) n -= m, s += m; } - if (ascii_strcasecmp(AssumedCharset, "us-ascii")) { + if (mime_which_token(AssumedCharset, -1) == MIME_US_ASCII) { char *t; t = p_dupstr(s, n);