/* For clearsigned messages we won't be able to get a character set
but we know that this may only be text thus we assume Latin-1
here. */
- if (!mutt_get_body_charset(body_charset, sizeof(body_charset), m))
+ if (!mutt_body_get_charset(m, body_charset, sizeof(body_charset)))
mutt_str_strfcpy(body_charset, "iso-8859-1", sizeof(body_charset));
fseeko(s->fpin, m->offset, SEEK_SET);
char *gpgcharset = NULL;
char body_charset[STRING];
- mutt_get_body_charset(body_charset, sizeof(body_charset), m);
+ mutt_body_get_charset(m, body_charset, sizeof(body_charset));
rc = 0; /* silence false compiler warning if (s->flags & MUTT_DISPLAY) */
* we have to convert from $charset to utf-8.
*/
- mutt_get_body_charset(body_charset, sizeof(body_charset), a);
+ mutt_body_get_charset(a, body_charset, sizeof(body_charset));
if (a->noconv)
from_charset = body_charset;
else
char *mutt_expand_path_regex(char *s, size_t slen, bool regex);
char *mutt_find_hook(int type, const char *pat);
char *mutt_gecos_name(char *dest, size_t destlen, struct passwd *pw);
-char *mutt_get_body_charset(char *d, size_t dlen, struct Body *b);
+char *mutt_body_get_charset(struct Body *b, char *buf, size_t buflen);
void mutt_crypt_hook(struct ListHead *list, struct Address *addr);
void mutt_timeout_hook(void);
void mutt_startup_shutdown_hook(int type);
if (!optional)
{
if (mutt_is_text_part(aptr->content) &&
- mutt_get_body_charset(charset, sizeof(charset), aptr->content))
+ mutt_body_get_charset(aptr->content, charset, sizeof(charset)))
{
mutt_format_s(buf, buflen, prec, charset);
}
mutt_format_s(buf, buflen, prec, "");
}
else if (!mutt_is_text_part(aptr->content) ||
- !mutt_get_body_charset(charset, sizeof(charset), aptr->content))
+ !mutt_body_get_charset(aptr->content, charset, sizeof(charset)))
{
optional = 0;
}
{
char send_charset[SHORT_STRING];
fc = mutt_ch_fgetconv_open(
- fpin, a->charset, mutt_get_body_charset(send_charset, sizeof(send_charset), a), 0);
+ fpin, a->charset, mutt_body_get_charset(a, send_charset, sizeof(send_charset)), 0);
}
else
fc = mutt_ch_fgetconv_open(fpin, 0, 0, 0);
if (b->type == TYPETEXT)
{
char send_charset[SHORT_STRING];
- char *chsname = mutt_get_body_charset(send_charset, sizeof(send_charset), b);
+ char *chsname = mutt_body_get_charset(b, send_charset, sizeof(send_charset));
if ((info->lobin && (mutt_str_strncasecmp(chsname, "iso-2022", 8) != 0)) ||
info->linemax > 990 || (info->from && EncodeFrom))
{
}
/**
- * mutt_get_body_charset - Get a body's character set
- * @param d Buffer for the result
- * @param dlen Length of the buffer
- * @param b Body to examine
+ * mutt_body_get_charset - Get a body's character set
+ * @param b Body to examine
+ * @param buf Buffer for the result
+ * @param buflen Length of the buffer
* @retval ptr Buffer containing character set
* @retval NULL On error, or if not a text type
*/
-char *mutt_get_body_charset(char *d, size_t dlen, struct Body *b)
+char *mutt_body_get_charset(struct Body *b, char *buf, size_t buflen)
{
char *p = NULL;
- if (b && b->type != TYPETEXT)
+ if (b && (b->type != TYPETEXT))
return NULL;
if (b)
p = mutt_param_get(&b->parameter, "charset");
if (p)
- mutt_ch_canonical_charset(d, dlen, p);
+ mutt_ch_canonical_charset(buf, buflen, p);
else
- mutt_str_strfcpy(d, "us-ascii", dlen);
+ mutt_str_strfcpy(buf, "us-ascii", buflen);
- return d;
+ return buf;
}
/**
char chsbuf[STRING];
/* override noconv when it's us-ascii */
- if (mutt_ch_is_us_ascii(mutt_get_body_charset(chsbuf, sizeof(chsbuf), a)))
+ if (mutt_ch_is_us_ascii(mutt_body_get_charset(a, chsbuf, sizeof(chsbuf))))
a->noconv = false;
if (!a->force_charset && !a->noconv)