65 int *tocode,
struct Content *info)
67 char bufi[256] = { 0 };
68 char bufu[512] = { 0 };
69 char bufo[4 *
sizeof(bufi)] = { 0 };
76 int ncodes = tocodes->
count;
104 size_t n = fread(bufi + ibl, 1,
sizeof(bufi) - ibl, fp);
108 const char *ib = bufi;
110 size_t obl =
sizeof(bufu);
111 n = iconv(cd1, (ICONV_CONST
char **) ((ibl != 0) ? &ib : 0), &ibl, &ob, &obl);
112 if ((n ==
ICONV_ILLEGAL_SEQ) && (((errno != EINVAL) && (errno != E2BIG)) || (ib == bufi)))
117 const size_t ubl1 = ob - bufu;
120 for (
int i = 0; i < ncodes; i++)
124 const char *ub = bufu;
128 n = iconv(cd[i], (ICONV_CONST
char **) ((ibl || ubl) ? &ub : 0), &ubl, &ob, &obl);
149 memmove(bufi, ib, ibl);
151 else if (!ubl1 && (ib < bufi +
sizeof(bufi)))
162 for (
int i = 0; i < ncodes; i++)
185 memcpy(info, &infos[*tocode],
sizeof(
struct Content));
216 const struct Slist *tocodes,
char **fromcode,
217 char **tocode,
struct Content *info)
242 *fromcode = np->
data;
250 for (cn = 0; cn < tocodes->
count; cn++)
void mutt_update_content_info(struct Content *info, struct ContentState *s, char *buf, size_t buflen)
Cache some info about an email.
size_t mutt_convert_file_to(FILE *fp, const char *fromcode, struct Slist const *const tocodes, int *tocode, struct Content *info)
Change the encoding of a file.
size_t mutt_convert_file_from_to(FILE *fp, const struct Slist *fromcodes, const struct Slist *tocodes, char **fromcode, char **tocode, struct Content *info)
Convert a file between encodings.
Structs that make up an email.
#define MUTT_MEM_CALLOC(n, type)
iconv_t mutt_ch_iconv_open(const char *tocode, const char *fromcode, uint8_t flags)
Set up iconv for conversions.
#define ICONV_T_INVALID
Error value for iconv functions.
#define MUTT_ICONV_NO_FLAGS
No flags are set.
#define ICONV_ILLEGAL_SEQ
Error value for iconv() - Illegal sequence.
static bool iconv_t_valid(const iconv_t cd)
Is the conversion descriptor valid?
Convenience wrapper for the library headers.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
char * mutt_str_dup(const char *str)
Copy a string, safely.
#define STAILQ_FOREACH(var, head, field)
Info about the body of an email.
Info about an attachment.
struct ListHead head
List containing values.
size_t count
Number of values in list.