From: Richard Russon Date: Wed, 10 Jan 2018 00:53:11 +0000 (+0000) Subject: rename charset functions X-Git-Tag: neomutt-20180223~43^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1fe17f960bed1676d405cca816e01d816682b492;p=neomutt rename charset functions To avoid a clash with the configset functions to come. --- diff --git a/alias.c b/alias.c index 61fb75a6c..60b7e3587 100644 --- a/alias.c +++ b/alias.c @@ -225,7 +225,7 @@ static void recode_buf(char *buf, size_t buflen) s = mutt_str_strdup(buf); if (!s) return; - if (mutt_cs_convert_string(&s, Charset, ConfigCharset, 0) == 0) + if (mutt_ch_convert_string(&s, Charset, ConfigCharset, 0) == 0) mutt_str_strfcpy(buf, s, buflen); FREE(&s); } diff --git a/browser.c b/browser.c index 8b6a3275f..30c66c8f2 100644 --- a/browser.c +++ b/browser.c @@ -571,7 +571,7 @@ static const char *group_index_format_str(char *buf, size_t buflen, size_t col, { char *desc = mutt_str_strdup(folder->ff->nd->desc); if (NewsgroupsCharset && *NewsgroupsCharset) - mutt_cs_convert_string(&desc, NewsgroupsCharset, Charset, MUTT_ICONV_HOOK_FROM); + mutt_ch_convert_string(&desc, NewsgroupsCharset, Charset, MUTT_ICONV_HOOK_FROM); mutt_filter_unprintable(&desc); snprintf(fmt, sizeof(fmt), "%%%ss", prec); diff --git a/copy.c b/copy.c index e85a27307..f07d37ac8 100644 --- a/copy.c +++ b/copy.c @@ -393,7 +393,7 @@ int mutt_copy_header(FILE *in, struct Header *h, FILE *out, int flags, const cha fputs("MIME-Version: 1.0\n", out); fputs("Content-Transfer-Encoding: 8bit\n", out); fputs("Content-Type: text/plain; charset=", out); - mutt_cs_canonical_charset(chsbuf, sizeof(chsbuf), + mutt_ch_canonical_charset(chsbuf, sizeof(chsbuf), Charset ? Charset : "us-ascii"); mutt_addr_cat(buffer, sizeof(buffer), chsbuf, MimeSpecials); fputs(buffer, out); diff --git a/handler.c b/handler.c index c390cc30d..fa0655995 100644 --- a/handler.c +++ b/handler.c @@ -116,7 +116,7 @@ static void convert_to_state(iconv_t cd, char *bufi, size_t *l, struct State *s) while (true) { ob = bufo, obl = sizeof(bufo); - mutt_cs_iconv(cd, &ib, &ibl, &ob, &obl, 0, "?"); + mutt_ch_iconv(cd, &ib, &ibl, &ob, &obl, 0, "?"); if (ob == bufo) break; state_prefix_put(bufo, ob - bufo, s); @@ -1585,12 +1585,12 @@ void mutt_decode_attachment(struct Body *b, struct State *s) { char *charset = mutt_param_get("charset", b->parameter); if (!charset && AssumedCharset && *AssumedCharset) - charset = mutt_cs_get_default_charset(); + charset = mutt_ch_get_default_charset(); if (charset && Charset) - cd = mutt_cs_iconv_open(Charset, charset, MUTT_ICONV_HOOK_FROM); + cd = mutt_ch_iconv_open(Charset, charset, MUTT_ICONV_HOOK_FROM); } else if (istext && b->charset) - cd = mutt_cs_iconv_open(Charset, b->charset, MUTT_ICONV_HOOK_FROM); + cd = mutt_ch_iconv_open(Charset, b->charset, MUTT_ICONV_HOOK_FROM); fseeko(s->fpin, b->offset, SEEK_SET); switch (b->encoding) diff --git a/hcache/hcache.c b/hcache/hcache.c index 02c348d24..4f9595414 100644 --- a/hcache/hcache.c +++ b/hcache/hcache.c @@ -180,7 +180,7 @@ static unsigned char *dump_char_size(char *c, unsigned char *d, int *off, if (convert && !mutt_str_is_ascii(c, size)) { p = mutt_str_substr_dup(c, c + size); - if (mutt_cs_convert_string(&p, Charset, "utf-8", 0) == 0) + if (mutt_ch_convert_string(&p, Charset, "utf-8", 0) == 0) { c = p; size = mutt_str_strlen(c) + 1; @@ -219,7 +219,7 @@ static void restore_char(char **c, const unsigned char *d, int *off, bool conver if (convert && !mutt_str_is_ascii(*c, size)) { char *tmp = mutt_str_strdup(*c); - if (mutt_cs_convert_string(&tmp, "utf-8", Charset, 0) == 0) + if (mutt_ch_convert_string(&tmp, "utf-8", Charset, 0) == 0) { mutt_str_replace(c, tmp); } diff --git a/hcache/hcache.h b/hcache/hcache.h index 3a577c686..e2de88bd5 100644 --- a/hcache/hcache.h +++ b/hcache/hcache.h @@ -41,7 +41,7 @@ * * SpamList * * NoSpamList * - Neomutt functions - * * mutt_cs_convert_string() + * * mutt_ch_convert_string() * * mutt_encode_path() * * mutt_new_body() * * mutt_env_new() diff --git a/history.c b/history.c index 43bc198cb..5d3634e36 100644 --- a/history.c +++ b/history.c @@ -140,7 +140,7 @@ void mutt_read_histfile(void) p = mutt_str_strdup(linebuf + read); if (p) { - mutt_cs_convert_string(&p, "utf-8", Charset, 0); + mutt_ch_convert_string(&p, "utf-8", Charset, 0); mutt_history_add(hclass, p, false); FREE(&p); } @@ -310,7 +310,7 @@ static void save_history(enum HistoryClass hclass, const char *s) } tmp = mutt_str_strdup(s); - mutt_cs_convert_string(&tmp, Charset, "utf-8", 0); + mutt_ch_convert_string(&tmp, Charset, "utf-8", 0); /* Format of a history item (1 line): ":|". We add a '|' in order to avoid lines ending with '\'. */ diff --git a/hook.c b/hook.c index e0d14bd73..764da1dc2 100644 --- a/hook.c +++ b/hook.c @@ -218,7 +218,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data, { /* These are managed separately by the charset code */ enum LookupType type = (data & MUTT_CHARSETHOOK) ? MUTT_LOOKUP_CHARSET : MUTT_LOOKUP_ICONV; - if (!mutt_cs_lookup_add(type, pattern.data, command.data, err)) + if (!mutt_ch_lookup_add(type, pattern.data, command.data, err)) goto error; FREE(&pattern.data); FREE(&command.data); @@ -314,7 +314,7 @@ int mutt_parse_unhook(struct Buffer *buf, struct Buffer *s, unsigned long data, return -1; } delete_hooks(0); - mutt_cs_lookup_remove(); + mutt_ch_lookup_remove(); } else { @@ -327,7 +327,7 @@ int mutt_parse_unhook(struct Buffer *buf, struct Buffer *s, unsigned long data, } if (type & (MUTT_CHARSETHOOK | MUTT_ICONVHOOK)) { - mutt_cs_lookup_remove(); + mutt_ch_lookup_remove(); return 0; } if (current_hook_type == type) diff --git a/imap/utf7.c b/imap/utf7.c index 76dfdc8d1..b3269a265 100644 --- a/imap/utf7.c +++ b/imap/utf7.c @@ -321,7 +321,7 @@ void imap_utf_encode(struct ImapData *idata, char **s) if (Charset) { char *t = mutt_str_strdup(*s); - if (t && !mutt_cs_convert_string(&t, Charset, "utf-8", 0)) + if (t && !mutt_ch_convert_string(&t, Charset, "utf-8", 0)) { FREE(s); if (idata->unicode) @@ -349,7 +349,7 @@ void imap_utf_decode(struct ImapData *idata, char **s) else t = utf7_to_utf8(*s, strlen(*s), 0, 0); - if (t && !mutt_cs_convert_string(&t, "utf-8", Charset, 0)) + if (t && !mutt_ch_convert_string(&t, "utf-8", Charset, 0)) { FREE(s); *s = t; diff --git a/init.c b/init.c index 795a482ef..59892ecc4 100644 --- a/init.c +++ b/init.c @@ -2132,7 +2132,7 @@ static int check_charset(struct Option *opt, const char *val) { if (!*p) continue; - if (!mutt_cs_check_charset(p, strict)) + if (!mutt_ch_check_charset(p, strict)) { rc = -1; break; @@ -3036,7 +3036,7 @@ static int source_rc(const char *rcfile_path, struct Buffer *err) currentline = mutt_str_strdup(linebuf); if (!currentline) continue; - mutt_cs_convert_string(¤tline, ConfigCharset, Charset, 0); + mutt_ch_convert_string(¤tline, ConfigCharset, Charset, 0); } else currentline = linebuf; @@ -4067,7 +4067,7 @@ void mutt_init(int skip_sys_rc, struct ListHead *commands) if (p) From = mutt_addr_parse_list(NULL, p); - mutt_cs_set_langinfo_charset(); + mutt_ch_set_langinfo_charset(); mutt_set_charset(Charset); Matches = mutt_mem_calloc(MatchesListsize, sizeof(char *)); diff --git a/mbyte.c b/mbyte.c index 2d8fb8445..cc0a39540 100644 --- a/mbyte.c +++ b/mbyte.c @@ -42,9 +42,9 @@ void mutt_set_charset(char *charset) { char buffer[STRING]; - mutt_cs_canonical_charset(buffer, sizeof(buffer), charset); + mutt_ch_canonical_charset(buffer, sizeof(buffer), charset); - if (mutt_cs_is_utf8(buffer)) + if (mutt_ch_is_utf8(buffer)) { Charset_is_utf8 = true; ReplacementChar = 0xfffd; diff --git a/mutt/charset.c b/mutt/charset.c index a4a27ce3a..c7d108a39 100644 --- a/mutt/charset.c +++ b/mutt/charset.c @@ -31,22 +31,22 @@ * * | Function | Description * | :----------------------------- | :--------------------------------------------------------- - * | mutt_cs_canonical_charset() | Canonicalise the charset of a string - * | mutt_cs_charset_lookup() | Look for a replacement character set - * | mutt_cs_check_charset() | Does iconv understand a character set? - * | mutt_cs_chscmp() | Are the names of two character sets equivalent? - * | mutt_cs_convert_string() | Convert a string between encodings - * | mutt_cs_fgetconv() | Convert a file's character set - * | mutt_cs_fgetconvs() | Convert a file's charset into a string buffer - * | mutt_cs_fgetconv_close() | Close an fgetconv handle - * | mutt_cs_fgetconv_open() | Prepare a file for charset conversion - * | mutt_cs_get_default_charset() | Get the default character set - * | mutt_cs_iconv() | Change the encoding of a string - * | mutt_cs_iconv_lookup() | Look for a replacement character set - * | mutt_cs_iconv_open() | Set up iconv for conversions - * | mutt_cs_lookup_add() | Add a new character set lookup - * | mutt_cs_lookup_remove() | Remove all the character set lookups - * | mutt_cs_set_langinfo_charset() | Set the user's choice of character set + * | mutt_ch_canonical_charset() | Canonicalise the charset of a string + * | mutt_ch_charset_lookup() | Look for a replacement character set + * | mutt_ch_check_charset() | Does iconv understand a character set? + * | mutt_ch_chscmp() | Are the names of two character sets equivalent? + * | mutt_ch_convert_string() | Convert a string between encodings + * | mutt_ch_fgetconv() | Convert a file's character set + * | mutt_ch_fgetconvs() | Convert a file's charset into a string buffer + * | mutt_ch_fgetconv_close() | Close an fgetconv handle + * | mutt_ch_fgetconv_open() | Prepare a file for charset conversion + * | mutt_ch_get_default_charset() | Get the default character set + * | mutt_ch_iconv() | Change the encoding of a string + * | mutt_ch_iconv_lookup() | Look for a replacement character set + * | mutt_ch_iconv_open() | Set up iconv for conversions + * | mutt_ch_lookup_add() | Add a new character set lookup + * | mutt_ch_lookup_remove() | Remove all the character set lookups + * | mutt_ch_set_langinfo_charset() | Set the user's choice of character set */ #include "config.h" @@ -268,7 +268,7 @@ static const char *lookup_charset(enum LookupType type, const char *cs) } /** - * mutt_cs_canonical_charset - Canonicalise the charset of a string + * mutt_ch_canonical_charset - Canonicalise the charset of a string * @param buf Buffer for canonical character set name * @param buflen Length of buffer * @param name Name to be canonicalised @@ -276,7 +276,7 @@ static const char *lookup_charset(enum LookupType type, const char *cs) * This first ties off any charset extension such as "//TRANSLIT", * canonicalizes the charset and re-adds the extension */ -void mutt_cs_canonical_charset(char *buf, size_t buflen, const char *name) +void mutt_ch_canonical_charset(char *buf, size_t buflen, const char *name) { char *p = NULL, *ext = NULL; char in[LONG_STRING], scratch[LONG_STRING]; @@ -330,24 +330,24 @@ out: } /** - * mutt_cs_chscmp - Are the names of two character sets equivalent? + * mutt_ch_chscmp - Are the names of two character sets equivalent? * @param cs1 First character set * @param cs2 Second character set * @retval num true if the names are equivalent * - * Charsets may have extensions that mutt_cs_canonical_charset() leaves intact; + * Charsets may have extensions that mutt_ch_canonical_charset() leaves intact; * we expect 'cs2' to originate from neomutt code, not user input (i.e. 'cs2' * does _not_ have any extension) we simply check if the shorter string is a * prefix for the longer. */ -int mutt_cs_chscmp(const char *cs1, const char *cs2) +int mutt_ch_chscmp(const char *cs1, const char *cs2) { if (!cs1 || !cs2) return 0; char buffer[STRING]; - mutt_cs_canonical_charset(buffer, sizeof(buffer), cs1); + mutt_ch_canonical_charset(buffer, sizeof(buffer), cs1); int len1 = mutt_str_strlen(buffer); int len2 = mutt_str_strlen(cs2); @@ -357,12 +357,12 @@ int mutt_cs_chscmp(const char *cs1, const char *cs2) } /** - * mutt_cs_get_default_charset - Get the default character set + * mutt_ch_get_default_charset - Get the default character set * @retval ptr Name of the default character set * * @warning This returns a pointer to a static buffer. Do not free it. */ -char *mutt_cs_get_default_charset(void) +char *mutt_ch_get_default_charset(void) { static char fcharset[SHORT_STRING]; const char *c = AssumedCharset; @@ -378,17 +378,17 @@ char *mutt_cs_get_default_charset(void) } /** - * mutt_cs_set_langinfo_charset - Set the user's choice of character set + * mutt_ch_set_langinfo_charset - Set the user's choice of character set * * Lookup the character map used by the user's locale and store it in Charset. */ -void mutt_cs_set_langinfo_charset(void) +void mutt_ch_set_langinfo_charset(void) { char buf[LONG_STRING]; char buf2[LONG_STRING]; mutt_str_strfcpy(buf, nl_langinfo(CODESET), sizeof(buf)); - mutt_cs_canonical_charset(buf2, sizeof(buf2), buf); + mutt_ch_canonical_charset(buf2, sizeof(buf2), buf); /* finally, set $charset */ Charset = mutt_str_strdup(buf2); @@ -397,7 +397,7 @@ void mutt_cs_set_langinfo_charset(void) } /** - * mutt_cs_lookup_add - Add a new character set lookup + * mutt_ch_lookup_add - Add a new character set lookup * @param type Type of character set, e.g. MUTT_LOOKUP_CHARSET * @param pat Pattern to match * @param replace Replacement string @@ -407,7 +407,7 @@ void mutt_cs_set_langinfo_charset(void) * * Add a regex for a character set and a replacement name. */ -bool mutt_cs_lookup_add(enum LookupType type, const char *pat, +bool mutt_ch_lookup_add(enum LookupType type, const char *pat, const char *replace, struct Buffer *err) { if (!pat || !replace) @@ -435,11 +435,11 @@ bool mutt_cs_lookup_add(enum LookupType type, const char *pat, } /** - * mutt_cs_lookup_remove - Remove all the character set lookups + * mutt_ch_lookup_remove - Remove all the character set lookups * * Empty the list of replacement character set names. */ -void mutt_cs_lookup_remove(void) +void mutt_ch_lookup_remove(void) { struct Lookup *l = NULL; struct Lookup *tmp = NULL; @@ -457,7 +457,7 @@ void mutt_cs_lookup_remove(void) } /** - * mutt_cs_charset_lookup - Look for a replacement character set + * mutt_ch_charset_lookup - Look for a replacement character set * @param chs Character set to lookup * @retval ptr Replacement character set (if a 'charset-hook' matches) * @retval NULL No matching hook @@ -465,13 +465,13 @@ void mutt_cs_lookup_remove(void) * Look through all the 'charset-hook's. * If one matches return the replacement character set. */ -const char *mutt_cs_charset_lookup(const char *chs) +const char *mutt_ch_charset_lookup(const char *chs) { return lookup_charset(MUTT_LOOKUP_CHARSET, chs); } /** - * mutt_cs_iconv_open - Set up iconv for conversions + * mutt_ch_iconv_open - Set up iconv for conversions * @param tocode Current character set * @param fromcode Target character set * @param flags Flags, e.g. #MUTT_ICONV_HOOK_FROM @@ -488,7 +488,7 @@ const char *mutt_cs_charset_lookup(const char *chs) * applied to tocode. Highlight note: The top-well-named MUTT_ICONV_HOOK_FROM * acts on charset-hooks, not at all on iconv-hooks. */ -iconv_t mutt_cs_iconv_open(const char *tocode, const char *fromcode, int flags) +iconv_t mutt_ch_iconv_open(const char *tocode, const char *fromcode, int flags) { char tocode1[SHORT_STRING]; char fromcode1[SHORT_STRING]; @@ -498,23 +498,23 @@ iconv_t mutt_cs_iconv_open(const char *tocode, const char *fromcode, int flags) iconv_t cd; /* transform to MIME preferred charset names */ - mutt_cs_canonical_charset(tocode1, sizeof(tocode1), tocode); - mutt_cs_canonical_charset(fromcode1, sizeof(fromcode1), fromcode); + mutt_ch_canonical_charset(tocode1, sizeof(tocode1), tocode); + mutt_ch_canonical_charset(fromcode1, sizeof(fromcode1), fromcode); /* maybe apply charset-hooks and recanonicalise fromcode, * but only when caller asked us to sanitize a potentially wrong * charset name incoming from the wild exterior. */ if (flags & MUTT_ICONV_HOOK_FROM) { - tmp = mutt_cs_charset_lookup(fromcode1); + tmp = mutt_ch_charset_lookup(fromcode1); if (tmp) - mutt_cs_canonical_charset(fromcode1, sizeof(fromcode1), tmp); + mutt_ch_canonical_charset(fromcode1, sizeof(fromcode1), tmp); } /* always apply iconv-hooks to suit system's iconv tastes */ - tocode2 = mutt_cs_iconv_lookup(tocode1); + tocode2 = mutt_ch_iconv_lookup(tocode1); tocode2 = (tocode2) ? tocode2 : tocode1; - fromcode2 = mutt_cs_iconv_lookup(fromcode1); + fromcode2 = mutt_ch_iconv_lookup(fromcode1); fromcode2 = (fromcode2) ? fromcode2 : fromcode1; /* call system iconv with names it appreciates */ @@ -526,7 +526,7 @@ iconv_t mutt_cs_iconv_open(const char *tocode, const char *fromcode, int flags) } /** - * mutt_cs_iconv - Change the encoding of a string + * mutt_ch_iconv - Change the encoding of a string * @param[in] cd Iconv conversion descriptor * @param[in,out] inbuf Buffer to convert * @param[in,out] inbytesleft Length of buffer to convert @@ -540,7 +540,7 @@ iconv_t mutt_cs_iconv_open(const char *tocode, const char *fromcode, int flags) * If you're supplying inrepls, the source charset should be stateless; * if you're supplying an outrepl, the target charset should be. */ -size_t mutt_cs_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, +size_t mutt_ch_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft, const char **inrepls, const char *outrepl) { size_t rc = 0, ret1; @@ -611,7 +611,7 @@ size_t mutt_cs_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char * } /** - * mutt_cs_iconv_lookup - Look for a replacement character set + * mutt_ch_iconv_lookup - Look for a replacement character set * @param chs Character set to lookup * @retval ptr Replacement character set (if a 'iconv-hook' matches) * @retval NULL No matching hook @@ -619,13 +619,13 @@ size_t mutt_cs_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char * * Look through all the 'iconv-hook's. * If one matches return the replacement character set. */ -const char *mutt_cs_iconv_lookup(const char *chs) +const char *mutt_ch_iconv_lookup(const char *chs) { return lookup_charset(MUTT_LOOKUP_ICONV, chs); } /** - * mutt_cs_convert_string - Convert a string between encodings + * mutt_ch_convert_string - Convert a string between encodings * @param[in,out] ps String to convert * @param[in] from Current character set * @param[in] to Target character set @@ -633,10 +633,10 @@ const char *mutt_cs_iconv_lookup(const char *chs) * @retval 0 Success * @retval -1 Error * - * Parameter flags is given as-is to mutt_cs_iconv_open(). + * Parameter flags is given as-is to mutt_ch_iconv_open(). * See there for its meaning and usage policy. */ -int mutt_cs_convert_string(char **ps, const char *from, const char *to, int flags) +int mutt_ch_convert_string(char **ps, const char *from, const char *to, int flags) { iconv_t cd; const char *repls[] = { "\357\277\275", "?", 0 }; @@ -645,7 +645,7 @@ int mutt_cs_convert_string(char **ps, const char *from, const char *to, int flag if (!s || !*s) return 0; - if (to && from && (cd = mutt_cs_iconv_open(to, from, flags)) != (iconv_t) -1) + if (to && from && (cd = mutt_ch_iconv_open(to, from, flags)) != (iconv_t) -1) { size_t len; const char *ib = NULL; @@ -654,9 +654,9 @@ int mutt_cs_convert_string(char **ps, const char *from, const char *to, int flag const char **inrepls = NULL; char *outrepl = NULL; - if (mutt_cs_is_utf8(to)) + if (mutt_ch_is_utf8(to)) outrepl = "\357\277\275"; - else if (mutt_cs_is_utf8(from)) + else if (mutt_ch_is_utf8(from)) inrepls = repls; else outrepl = "?"; @@ -667,7 +667,7 @@ int mutt_cs_convert_string(char **ps, const char *from, const char *to, int flag obl = MB_LEN_MAX * ibl; ob = buf = mutt_mem_malloc(obl + 1); - mutt_cs_iconv(cd, &ib, &ibl, &ob, &obl, inrepls, outrepl); + mutt_ch_iconv(cd, &ib, &ibl, &ob, &obl, inrepls, outrepl); iconv_close(cd); *ob = '\0'; @@ -683,7 +683,7 @@ int mutt_cs_convert_string(char **ps, const char *from, const char *to, int flag } /** - * mutt_cs_check_charset - Does iconv understand a character set? + * mutt_ch_check_charset - Does iconv understand a character set? * @param cs Character set to check * @param strict Check strictly by using iconv * @retval bool true if character set is valid @@ -693,11 +693,11 @@ int mutt_cs_convert_string(char **ps, const char *from, const char *to, int flag * If `strict` is true, or the charset is not in #PreferredMIMENames, then * iconv() with be run. */ -bool mutt_cs_check_charset(const char *cs, bool strict) +bool mutt_ch_check_charset(const char *cs, bool strict) { iconv_t cd; - if (mutt_cs_is_utf8(cs)) + if (mutt_ch_is_utf8(cs)) return true; if (!strict) @@ -712,7 +712,7 @@ bool mutt_cs_check_charset(const char *cs, bool strict) } } - cd = mutt_cs_iconv_open(cs, cs, 0); + cd = mutt_ch_iconv_open(cs, cs, 0); if (cd != (iconv_t)(-1)) { iconv_close(cd); @@ -723,23 +723,23 @@ bool mutt_cs_check_charset(const char *cs, bool strict) } /** - * mutt_cs_fgetconv_open - Prepare a file for charset conversion + * mutt_ch_fgetconv_open - Prepare a file for charset conversion * @param file FILE ptr to prepare * @param from Current character set * @param to Destination character set * @param flags Flags, e.g. MUTT_ICONV_HOOK_FROM * @retval ptr fgetconv handle * - * Parameter flags is given as-is to mutt_cs_iconv_open(). + * Parameter flags is given as-is to mutt_ch_iconv_open(). */ -struct FgetConv *mutt_cs_fgetconv_open(FILE *file, const char *from, const char *to, int flags) +struct FgetConv *mutt_ch_fgetconv_open(FILE *file, const char *from, const char *to, int flags) { struct FgetConv *fc = NULL; iconv_t cd = (iconv_t) -1; static const char *repls[] = { "\357\277\275", "?", 0 }; if (from && to) - cd = mutt_cs_iconv_open(to, from, flags); + cd = mutt_ch_iconv_open(to, from, flags); if (cd != (iconv_t) -1) { @@ -747,7 +747,7 @@ struct FgetConv *mutt_cs_fgetconv_open(FILE *file, const char *from, const char fc->p = fc->ob = fc->bufo; fc->ib = fc->bufi; fc->ibl = 0; - fc->inrepls = mutt_cs_is_utf8(to) ? repls : repls + 1; + fc->inrepls = mutt_ch_is_utf8(to) ? repls : repls + 1; } else fc = mutt_mem_malloc(sizeof(struct FgetConvNot)); @@ -757,10 +757,10 @@ struct FgetConv *mutt_cs_fgetconv_open(FILE *file, const char *from, const char } /** - * mutt_cs_fgetconv_close - Close an fgetconv handle + * mutt_ch_fgetconv_close - Close an fgetconv handle * @param fc fgetconv handle */ -void mutt_cs_fgetconv_close(struct FgetConv **fc) +void mutt_ch_fgetconv_close(struct FgetConv **fc) { if ((*fc)->cd != (iconv_t) -1) iconv_close((*fc)->cd); @@ -768,7 +768,7 @@ void mutt_cs_fgetconv_close(struct FgetConv **fc) } /** - * mutt_cs_fgetconv - Convert a file's character set + * mutt_ch_fgetconv - Convert a file's character set * @param fc FgetConv handle * @retval num Next character in the converted file * @retval EOF Error @@ -777,7 +777,7 @@ void mutt_cs_fgetconv_close(struct FgetConv **fc) * Each call to this function will return one converted character. * The buffer is refilled automatically when empty. */ -int mutt_cs_fgetconv(struct FgetConv *fc) +int mutt_ch_fgetconv(struct FgetConv *fc) { if (!fc) return EOF; @@ -817,7 +817,7 @@ int mutt_cs_fgetconv(struct FgetConv *fc) if (fc->ibl) { size_t obl = sizeof(fc->bufo); - mutt_cs_iconv(fc->cd, (const char **) &fc->ib, &fc->ibl, &fc->ob, &obl, fc->inrepls, 0); + mutt_ch_iconv(fc->cd, (const char **) &fc->ib, &fc->ibl, &fc->ob, &obl, fc->inrepls, 0); if (fc->p < fc->ob) return (unsigned char) *(fc->p)++; } @@ -828,7 +828,7 @@ int mutt_cs_fgetconv(struct FgetConv *fc) } /** - * mutt_cs_fgetconvs - Convert a file's charset into a string buffer + * mutt_ch_fgetconvs - Convert a file's charset into a string buffer * @param buf Buffer for result * @param buflen Length of buffer * @param fc FgetConv handle @@ -837,14 +837,14 @@ int mutt_cs_fgetconv(struct FgetConv *fc) * * Read a file into a buffer, converting the character set as it goes. */ -char *mutt_cs_fgetconvs(char *buf, size_t buflen, struct FgetConv *fc) +char *mutt_ch_fgetconvs(char *buf, size_t buflen, struct FgetConv *fc) { int c; size_t r; for (r = 0; (r + 1) < buflen;) { - c = mutt_cs_fgetconv(fc); + c = mutt_ch_fgetconv(fc); if (c == EOF) break; buf[r++] = (char) c; diff --git a/mutt/charset.h b/mutt/charset.h index 835be1d04..9d92170d1 100644 --- a/mutt/charset.h +++ b/mutt/charset.h @@ -79,27 +79,27 @@ enum LookupType extern const struct MimeNames PreferredMIMENames[]; -void mutt_cs_canonical_charset(char *buf, size_t buflen, const char *name); -int mutt_cs_chscmp(const char *cs1, const char *cs2); -char * mutt_cs_get_default_charset(void); -void mutt_cs_set_langinfo_charset(void); - -bool mutt_cs_lookup_add(enum LookupType type, const char *pat, const char *replace, struct Buffer *err); -void mutt_cs_lookup_remove(void); -const char * mutt_cs_charset_lookup(const char *chs); - -iconv_t mutt_cs_iconv_open(const char *tocode, const char *fromcode, int flags); -size_t mutt_cs_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft, const char **inrepls, const char *outrepl); -const char * mutt_cs_iconv_lookup(const char *chs); -int mutt_cs_convert_string(char **ps, const char *from, const char *to, int flags); -bool mutt_cs_check_charset(const char *cs, bool strict); - -struct FgetConv *mutt_cs_fgetconv_open(FILE *file, const char *from, const char *to, int flags); -void mutt_cs_fgetconv_close(struct FgetConv **fc); -int mutt_cs_fgetconv(struct FgetConv *fc); -char * mutt_cs_fgetconvs(char *buf, size_t buflen, struct FgetConv *fc); - -#define mutt_cs_is_utf8(a) mutt_cs_chscmp(a, "utf-8") -#define mutt_cs_is_us_ascii(a) mutt_cs_chscmp(a, "us-ascii") +void mutt_ch_canonical_charset(char *buf, size_t buflen, const char *name); +int mutt_ch_chscmp(const char *cs1, const char *cs2); +char * mutt_ch_get_default_charset(void); +void mutt_ch_set_langinfo_charset(void); + +bool mutt_ch_lookup_add(enum LookupType type, const char *pat, const char *replace, struct Buffer *err); +void mutt_ch_lookup_remove(void); +const char * mutt_ch_charset_lookup(const char *chs); + +iconv_t mutt_ch_iconv_open(const char *tocode, const char *fromcode, int flags); +size_t mutt_ch_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft, const char **inrepls, const char *outrepl); +const char * mutt_ch_iconv_lookup(const char *chs); +int mutt_ch_convert_string(char **ps, const char *from, const char *to, int flags); +bool mutt_ch_check_charset(const char *cs, bool strict); + +struct FgetConv *mutt_ch_fgetconv_open(FILE *file, const char *from, const char *to, int flags); +void mutt_ch_fgetconv_close(struct FgetConv **fc); +int mutt_ch_fgetconv(struct FgetConv *fc); +char * mutt_ch_fgetconvs(char *buf, size_t buflen, struct FgetConv *fc); + +#define mutt_ch_is_utf8(a) mutt_ch_chscmp(a, "utf-8") +#define mutt_ch_is_us_ascii(a) mutt_ch_chscmp(a, "us-ascii") #endif diff --git a/mutt/idna.c b/mutt/idna.c index 43bf21de6..5af815871 100644 --- a/mutt/idna.c +++ b/mutt/idna.c @@ -151,10 +151,10 @@ char *mutt_idna_intl_to_local(const char *user, const char *domain, int flags) #endif /* HAVE_LIBIDN */ /* we don't want charset-hook effects, so we set flags to 0 */ - if (mutt_cs_convert_string(&local_user, "utf-8", Charset, 0) == -1) + if (mutt_ch_convert_string(&local_user, "utf-8", Charset, 0) == -1) goto cleanup; - if (mutt_cs_convert_string(&local_domain, "utf-8", Charset, 0) == -1) + if (mutt_ch_convert_string(&local_domain, "utf-8", Charset, 0) == -1) goto cleanup; /* make sure that we can convert back and come out with the same @@ -163,7 +163,7 @@ char *mutt_idna_intl_to_local(const char *user, const char *domain, int flags) { reversed_user = mutt_str_strdup(local_user); - if (mutt_cs_convert_string(&reversed_user, Charset, "utf-8", 0) == -1) + if (mutt_ch_convert_string(&reversed_user, Charset, "utf-8", 0) == -1) { mutt_debug( 1, "Not reversible. Charset conv to utf-8 failed for user = '%s'.\n", reversed_user); @@ -178,7 +178,7 @@ char *mutt_idna_intl_to_local(const char *user, const char *domain, int flags) reversed_domain = mutt_str_strdup(local_domain); - if (mutt_cs_convert_string(&reversed_domain, Charset, "utf-8", 0) == -1) + if (mutt_ch_convert_string(&reversed_domain, Charset, "utf-8", 0) == -1) { mutt_debug( 1, @@ -248,10 +248,10 @@ char *mutt_idna_local_to_intl(const char *user, const char *domain) intl_domain = mutt_str_strdup(domain); /* we don't want charset-hook effects, so we set flags to 0 */ - if (mutt_cs_convert_string(&intl_user, Charset, "utf-8", 0) == -1) + if (mutt_ch_convert_string(&intl_user, Charset, "utf-8", 0) == -1) goto cleanup; - if (mutt_cs_convert_string(&intl_domain, Charset, "utf-8", 0) == -1) + if (mutt_ch_convert_string(&intl_domain, Charset, "utf-8", 0) == -1) goto cleanup; #ifdef HAVE_LIBIDN diff --git a/muttlib.c b/muttlib.c index 1418ad4d3..38a00f6c0 100644 --- a/muttlib.c +++ b/muttlib.c @@ -1402,7 +1402,7 @@ const char *mutt_make_version(void) void mutt_encode_path(char *dest, size_t dlen, const char *src) { char *p = mutt_str_strdup(src); - int rc = mutt_cs_convert_string(&p, Charset, "utf-8", 0); + int rc = mutt_ch_convert_string(&p, Charset, "utf-8", 0); /* `src' may be NULL, such as when called from the pop3 driver. */ mutt_str_strfcpy(dest, (rc == 0) ? NONULL(p) : NONULL(src), dlen); FREE(&p); diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 3ea832cb6..0f56494d3 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -176,7 +176,7 @@ static void print_utf8(FILE *fp, const char *buf, size_t len) /* fromcode "utf-8" is sure, so we don't want * charset-hook corrections: flags must be 0. */ - mutt_cs_convert_string(&tstr, "utf-8", Charset, 0); + mutt_ch_convert_string(&tstr, "utf-8", Charset, 0); fputs(tstr, fp); FREE(&tstr); } @@ -2449,9 +2449,9 @@ static void copy_clearsigned(gpgme_data_t data, struct State *s, char *charset) * be a wrong label, so we want the ability to do corrections via * charset-hooks. Therefore we set flags to MUTT_ICONV_HOOK_FROM. */ - fc = mutt_cs_fgetconv_open(fp, charset, Charset, MUTT_ICONV_HOOK_FROM); + fc = mutt_ch_fgetconv_open(fp, charset, Charset, MUTT_ICONV_HOOK_FROM); - for (complete = true, armor_header = true; mutt_cs_fgetconvs(buf, sizeof(buf), fc) != NULL; + for (complete = true, armor_header = true; mutt_ch_fgetconvs(buf, sizeof(buf), fc) != NULL; complete = (strchr(buf, '\n') != NULL)) { if (!complete) @@ -2480,7 +2480,7 @@ static void copy_clearsigned(gpgme_data_t data, struct State *s, char *charset) state_puts(buf, s); } - mutt_cs_fgetconv_close(&fc); + mutt_ch_fgetconv_close(&fc); mutt_file_fclose(&fp); } @@ -2674,14 +2674,14 @@ int pgp_gpgme_application_handler(struct Body *m, struct State *s) struct FgetConv *fc = NULL; int c; rewind(pgpout); - fc = mutt_cs_fgetconv_open(pgpout, "utf-8", Charset, 0); - while ((c = mutt_cs_fgetconv(fc)) != EOF) + fc = mutt_ch_fgetconv_open(pgpout, "utf-8", Charset, 0); + while ((c = mutt_ch_fgetconv(fc)) != EOF) { state_putc(c, s); if (c == '\n' && s->prefix) state_puts(s->prefix, s); } - mutt_cs_fgetconv_close(&fc); + mutt_ch_fgetconv_close(&fc); } if (s->flags & MUTT_DISPLAY) diff --git a/ncrypt/gnupgparse.c b/ncrypt/gnupgparse.c index 58ded9477..2fdf9130e 100644 --- a/ncrypt/gnupgparse.c +++ b/ncrypt/gnupgparse.c @@ -89,7 +89,7 @@ static void fix_uid(char *uid) } *d = '\0'; - if (chs && (cd = mutt_cs_iconv_open(chs, "utf-8", 0)) != (iconv_t) -1) + if (chs && (cd = mutt_ch_iconv_open(chs, "utf-8", 0)) != (iconv_t) -1) { int n = s - uid + 1; /* chars available in original buffer */ char *buf = NULL; diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 549e3cdce..c64919375 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -282,9 +282,9 @@ static void pgp_copy_clearsigned(FILE *fpin, struct State *s, char *charset) * be a wrong label, so we want the ability to do corrections via * charset-hooks. Therefore we set flags to MUTT_ICONV_HOOK_FROM. */ - fc = mutt_cs_fgetconv_open(fpin, charset, Charset, MUTT_ICONV_HOOK_FROM); + fc = mutt_ch_fgetconv_open(fpin, charset, Charset, MUTT_ICONV_HOOK_FROM); - for (complete = true, armor_header = true; mutt_cs_fgetconvs(buf, sizeof(buf), fc) != NULL; + for (complete = true, armor_header = true; mutt_ch_fgetconvs(buf, sizeof(buf), fc) != NULL; complete = (strchr(buf, '\n') != NULL)) { if (!complete) @@ -314,7 +314,7 @@ static void pgp_copy_clearsigned(FILE *fpin, struct State *s, char *charset) state_puts(buf, s); } - mutt_cs_fgetconv_close(&fc); + mutt_ch_fgetconv_close(&fc); } /** @@ -418,7 +418,7 @@ int pgp_application_pgp_handler(struct Body *m, struct State *s) l = mutt_str_strlen(gpgcharset); if ((l > 0) && (gpgcharset[l - 1] == '\n')) gpgcharset[l - 1] = 0; - if (!mutt_cs_check_charset(gpgcharset, 0)) + if (!mutt_ch_check_charset(gpgcharset, 0)) mutt_str_replace(&gpgcharset, "UTF-8"); } } @@ -545,10 +545,10 @@ int pgp_application_pgp_handler(struct Body *m, struct State *s) rewind(pgpout); state_set_prefix(s); - fc = mutt_cs_fgetconv_open(pgpout, expected_charset, Charset, MUTT_ICONV_HOOK_FROM); - while ((ch = mutt_cs_fgetconv(fc)) != EOF) + fc = mutt_ch_fgetconv_open(pgpout, expected_charset, Charset, MUTT_ICONV_HOOK_FROM); + while ((ch = mutt_ch_fgetconv(fc)) != EOF) state_prefix_putc(ch, s); - mutt_cs_fgetconv_close(&fc); + mutt_ch_fgetconv_close(&fc); } /* @@ -1539,7 +1539,7 @@ struct Body *pgp_traditional_encryptsign(struct Body *a, int flags, char *keylis else from_charset = Charset; - if (!mutt_cs_is_us_ascii(body_charset)) + if (!mutt_ch_is_us_ascii(body_charset)) { int c; struct FgetConv *fc = NULL; @@ -1550,11 +1550,11 @@ struct Body *pgp_traditional_encryptsign(struct Body *a, int flags, char *keylis send_charset = "utf-8"; /* fromcode is assumed to be correct: we set flags to 0 */ - fc = mutt_cs_fgetconv_open(fp, from_charset, "utf-8", 0); - while ((c = mutt_cs_fgetconv(fc)) != EOF) + fc = mutt_ch_fgetconv_open(fp, from_charset, "utf-8", 0); + while ((c = mutt_ch_fgetconv(fc)) != EOF) fputc(c, pgpin); - mutt_cs_fgetconv_close(&fc); + mutt_ch_fgetconv_close(&fc); } else { diff --git a/parse.c b/parse.c index 91a1631f9..4b79963c7 100644 --- a/parse.c +++ b/parse.c @@ -388,7 +388,7 @@ void mutt_parse_content_type(char *s, struct Body *ct) if (!pc) mutt_param_set("charset", (AssumedCharset && *AssumedCharset) ? - (const char *) mutt_cs_get_default_charset() : + (const char *) mutt_ch_get_default_charset() : "us-ascii", &ct->parameter); } diff --git a/rfc2047.c b/rfc2047.c index 40b350b8a..591f07aa5 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -60,7 +60,7 @@ static size_t convert_string(const char *f, size_t flen, const char *from, size_t obl, n; int e; - cd = mutt_cs_iconv_open(to, from, 0); + cd = mutt_ch_iconv_open(to, from, 0); if (cd == (iconv_t)(-1)) return (size_t)(-1); obl = 4 * flen + 1; @@ -116,7 +116,7 @@ int convert_nonmime_string(char **ps) return 0; } } - mutt_cs_convert_string(ps, (const char *) mutt_cs_get_default_charset(), + mutt_ch_convert_string(ps, (const char *) mutt_ch_get_default_charset(), Charset, MUTT_ICONV_HOOK_FROM); return -1; } @@ -180,7 +180,7 @@ char *mutt_choose_charset(const char *fromcode, const char *charsets, char *u, if (dlen) *dlen = elen; - mutt_cs_canonical_charset(canonical_buf, sizeof(canonical_buf), tocode); + mutt_ch_canonical_charset(canonical_buf, sizeof(canonical_buf), tocode); mutt_str_replace(&tocode, canonical_buf); } return tocode; @@ -276,7 +276,7 @@ static size_t try_block(const char *d, size_t dlen, const char *fromcode, if (fromcode) { - cd = mutt_cs_iconv_open(tocode, fromcode, 0); + cd = mutt_ch_iconv_open(tocode, fromcode, 0); assert(cd != (iconv_t)(-1)); ib = d; ibl = dlen; @@ -356,7 +356,7 @@ static size_t encode_block(char *s, char *d, size_t dlen, const char *fromcode, if (fromcode) { - cd = mutt_cs_iconv_open(tocode, fromcode, 0); + cd = mutt_ch_iconv_open(tocode, fromcode, 0); assert(cd != (iconv_t)(-1)); ib = d; ibl = dlen; @@ -493,7 +493,7 @@ static int rfc2047_encode(const char *d, size_t dlen, int col, const char *fromc } /* Hack to avoid labelling 8-bit data as us-ascii. */ - if (!icode && mutt_cs_is_us_ascii(tocode)) + if (!icode && mutt_ch_is_us_ascii(tocode)) tocode = "unknown-8bit"; /* Adjust t0 for maximum length of line. */ @@ -737,7 +737,7 @@ static int rfc2047_decode_word(char *d, const char *s, size_t len) } if (charset) - mutt_cs_convert_string(&d0, charset, Charset, MUTT_ICONV_HOOK_FROM); + mutt_ch_convert_string(&d0, charset, Charset, MUTT_ICONV_HOOK_FROM); mutt_filter_unprintable(&d0); mutt_str_strfcpy(d, d0, len); rc = 0; diff --git a/rfc2231.c b/rfc2231.c index 9cbd23f4e..c1ef506c7 100644 --- a/rfc2231.c +++ b/rfc2231.c @@ -202,7 +202,7 @@ static void rfc2231_join_continuations(struct Parameter **head, struct Rfc2231Pa } while (par && (strcmp(par->attribute, attribute) == 0)); if (encoded) - mutt_cs_convert_string(&value, charset, Charset, MUTT_ICONV_HOOK_FROM); + mutt_ch_convert_string(&value, charset, Charset, MUTT_ICONV_HOOK_FROM); *head = mutt_param_new(); (*head)->attribute = mutt_str_strdup(attribute); (*head)->value = value; @@ -260,7 +260,7 @@ void rfc2231_decode_parameters(struct Parameter **headp) s = rfc2231_get_charset(p->value, charset, sizeof(charset)); rfc2231_decode_one(p->value, s); - mutt_cs_convert_string(&p->value, charset, Charset, MUTT_ICONV_HOOK_FROM); + mutt_ch_convert_string(&p->value, charset, Charset, MUTT_ICONV_HOOK_FROM); mutt_filter_unprintable(&p->value); *last = p; @@ -335,7 +335,7 @@ int rfc2231_encode_string(char **pd) dlen = strlen(d); } - if (!mutt_cs_is_us_ascii(charset)) + if (!mutt_ch_is_us_ascii(charset)) encode = 1; for (s = d, slen = dlen; slen; s++, slen--) diff --git a/sendlib.c b/sendlib.c index 46aa5890e..fcdef6939 100644 --- a/sendlib.c +++ b/sendlib.c @@ -85,7 +85,7 @@ static void encode_quoted(struct FgetConv *fc, FILE *fout, int istext) int c, linelen = 0; char line[77], savechar; - while ((c = mutt_cs_fgetconv(fc)) != EOF) + while ((c = mutt_ch_fgetconv(fc)) != EOF) { /* Wrap the line if needed. */ if (linelen == 76 && ((istext && c != '\n') || !istext)) @@ -274,7 +274,7 @@ static void encode_base64(struct FgetConv *fc, FILE *fout, int istext) b64_init(&ctx); - while ((ch = mutt_cs_fgetconv(fc)) != EOF) + while ((ch = mutt_ch_fgetconv(fc)) != EOF) { if (SigInt == 1) { @@ -294,7 +294,7 @@ static void encode_8bit(struct FgetConv *fc, FILE *fout) { int ch; - while ((ch = mutt_cs_fgetconv(fc)) != EOF) + while ((ch = mutt_ch_fgetconv(fc)) != EOF) { if (SigInt == 1) { @@ -470,10 +470,10 @@ int mutt_write_mime_body(struct Body *a, FILE *f) } if (a->type == TYPETEXT && (!a->noconv)) - fc = mutt_cs_fgetconv_open( + fc = mutt_ch_fgetconv_open( fpin, a->charset, mutt_get_body_charset(send_charset, sizeof(send_charset), a), 0); else - fc = mutt_cs_fgetconv_open(fpin, 0, 0, 0); + fc = mutt_ch_fgetconv_open(fpin, 0, 0, 0); mutt_sig_allow_interrupt(1); if (a->encoding == ENCQUOTEDPRINTABLE) @@ -486,7 +486,7 @@ int mutt_write_mime_body(struct Body *a, FILE *f) mutt_file_copy_stream(fpin, f); mutt_sig_allow_interrupt(0); - mutt_cs_fgetconv_close(&fc); + mutt_ch_fgetconv_close(&fc); mutt_file_fclose(&fpin); if (SigInt == 1) @@ -684,7 +684,7 @@ static size_t convert_file_to(FILE *file, const char *fromcode, int ncodes, struct ContentState *states = NULL; size_t *score = NULL; - cd1 = mutt_cs_iconv_open("utf-8", fromcode, 0); + cd1 = mutt_ch_iconv_open("utf-8", fromcode, 0); if (cd1 == (iconv_t)(-1)) return -1; @@ -696,7 +696,7 @@ static size_t convert_file_to(FILE *file, const char *fromcode, int ncodes, for (int i = 0; i < ncodes; i++) { if (mutt_str_strcasecmp(tocodes[i], "utf-8") != 0) - cd[i] = mutt_cs_iconv_open(tocodes[i], "utf-8", 0); + cd[i] = mutt_ch_iconv_open(tocodes[i], "utf-8", 0); else { /* Special case for conversion to UTF-8 */ @@ -945,7 +945,7 @@ struct Content *mutt_get_content_info(const char *fname, struct Body *b) { if (!chs) { - mutt_cs_canonical_charset(chsbuf, sizeof(chsbuf), tocode); + mutt_ch_canonical_charset(chsbuf, sizeof(chsbuf), tocode); mutt_param_set("charset", chsbuf, &b->parameter); } FREE(&b->charset); @@ -966,7 +966,7 @@ struct Content *mutt_get_content_info(const char *fname, struct Body *b) if (b != NULL && b->type == TYPETEXT && (!b->noconv && !b->force_charset)) mutt_param_set("charset", (!info->hibin ? "us-ascii" : - Charset && !mutt_cs_is_us_ascii(Charset) ? Charset : "unknown-8bit"), + Charset && !mutt_ch_is_us_ascii(Charset) ? Charset : "unknown-8bit"), &b->parameter); return info; @@ -1315,7 +1315,7 @@ char *mutt_get_body_charset(char *d, size_t dlen, struct Body *b) p = mutt_param_get("charset", b->parameter); if (p) - mutt_cs_canonical_charset(d, dlen, NONULL(p)); + mutt_ch_canonical_charset(d, dlen, NONULL(p)); else mutt_str_strfcpy(d, "us-ascii", dlen); @@ -1333,7 +1333,7 @@ void mutt_update_encoding(struct Body *a) char chsbuf[STRING]; /* override noconv when it's us-ascii */ - if (mutt_cs_is_us_ascii(mutt_get_body_charset(chsbuf, sizeof(chsbuf), a))) + if (mutt_ch_is_us_ascii(mutt_get_body_charset(chsbuf, sizeof(chsbuf), a))) a->noconv = false; if (!a->force_charset && !a->noconv)