X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=rfc2047.c;h=a81a84963b3b9cc5e4ddf86af4f67534c78d348d;hb=5e53f9e5f65aa5b3af6f5af9d868403536534afb;hp=2d57d6a92960e98d6af4d0a61225c63e6c5980c9;hpb=e4ebc9b0ae5de07d53d8b0ecf594244e1bc44d0a;p=apps%2Fmadmutt.git diff --git a/rfc2047.c b/rfc2047.c index 2d57d6a..a81a849 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -46,10 +46,10 @@ extern char RFC822Specials[]; -typedef size_t (*encoder_t) (char *, ICONV_CONST char *, size_t, +typedef size_t (*encoder_t) (char *, const char *, size_t, const char *); -static size_t convert_string (ICONV_CONST char *f, size_t flen, +static size_t convert_string (const char *f, size_t flen, const char *from, const char *to, char **t, size_t * tlen) { @@ -63,8 +63,8 @@ static size_t convert_string (ICONV_CONST char *f, size_t flen, return (size_t) (-1); obl = 4 * flen + 1; ob = buf = mem_malloc (obl); - n = iconv (cd, &f, &flen, &ob, &obl); - if (n == (size_t) (-1) || iconv (cd, 0, 0, &ob, &obl) == (size_t) (-1)) { + n = my_iconv(cd, &f, &flen, &ob, &obl); + if (n == (size_t) (-1) || my_iconv(cd, 0, 0, &ob, &obl) == (size_t) (-1)) { e = errno; mem_free (&buf); iconv_close (cd); @@ -143,7 +143,7 @@ char *mutt_choose_charset (const char *fromcode, const char *charsets, return tocode; } -static size_t b_encoder (char *s, ICONV_CONST char *d, size_t dlen, +static size_t b_encoder (char *s, const char *d, size_t dlen, const char *tocode) { char *s0 = s; @@ -180,7 +180,7 @@ static size_t b_encoder (char *s, ICONV_CONST char *d, size_t dlen, return s - s0; } -static size_t q_encoder (char *s, ICONV_CONST char *d, size_t dlen, +static size_t q_encoder (char *s, const char *d, size_t dlen, const char *tocode) { char hex[] = "0123456789ABCDEF"; @@ -215,13 +215,13 @@ static size_t q_encoder (char *s, ICONV_CONST char *d, size_t dlen, * tocode, unless fromcode is 0, in which case the data is assumed to * be already in tocode, which should be 8-bit and stateless. */ -static size_t try_block (ICONV_CONST char *d, size_t dlen, +static size_t try_block (const char *d, size_t dlen, const char *fromcode, const char *tocode, encoder_t * encoder, size_t * wlen) { char buf1[ENCWORD_LEN_MAX - ENCWORD_LEN_MIN + 1]; iconv_t cd; - ICONV_CONST char *ib; + const char *ib; char *ob, *p; size_t ibl, obl; int count, len, len_b, len_q; @@ -230,8 +230,8 @@ static size_t try_block (ICONV_CONST char *d, size_t dlen, cd = mutt_iconv_open (tocode, fromcode, 0); assert (cd != (iconv_t) (-1)); ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - str_len (tocode); - if (iconv (cd, &ib, &ibl, &ob, &obl) == (size_t) (-1) || - iconv (cd, 0, 0, &ob, &obl) == (size_t) (-1)) { + if (my_iconv(cd, &ib, &ibl, &ob, &obl) == (size_t) (-1) || + my_iconv(cd, 0, 0, &ob, &obl) == (size_t) (-1)) { assert (errno == E2BIG); iconv_close (cd); assert (ib > d); @@ -288,7 +288,7 @@ static size_t encode_block (char *s, char *d, size_t dlen, { char buf1[ENCWORD_LEN_MAX - ENCWORD_LEN_MIN + 1]; iconv_t cd; - ICONV_CONST char *ib; + const char *ib; char *ob; size_t ibl, obl, n1, n2; @@ -296,8 +296,8 @@ static size_t encode_block (char *s, char *d, size_t dlen, cd = mutt_iconv_open (tocode, fromcode, 0); assert (cd != (iconv_t) (-1)); ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - str_len (tocode); - n1 = iconv (cd, &ib, &ibl, &ob, &obl); - n2 = iconv (cd, 0, 0, &ob, &obl); + n1 = my_iconv(cd, &ib, &ibl, &ob, &obl); + n2 = my_iconv(cd, 0, 0, &ob, &obl); assert (n1 != (size_t) (-1) && n2 != (size_t) (-1)); iconv_close (cd); return (*encoder) (s, buf1, ob - buf1, tocode); @@ -344,7 +344,7 @@ static size_t choose_block (char *d, size_t dlen, int col, * The input data is assumed to be a single line starting at column col; * if col is non-zero, the preceding character was a space. */ -static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col, +static int rfc2047_encode (const char *d, size_t dlen, int col, const char *fromcode, const char *charsets, char **e, size_t * elen, char *specials) {