static void transfer_noncontent_headers (CT, CT);
static int set_ct_type (CT, int type, int subtype, int encoding);
static int decode_text_parts (CT, int, int *);
static void transfer_noncontent_headers (CT, CT);
static int set_ct_type (CT, int type, int subtype, int encoding);
static int decode_text_parts (CT, int, int *);
static int strip_crs (CT, int *);
static int convert_charsets (CT, char *, int *);
static int write_content (CT, char *, char *, int, int);
static int strip_crs (CT, int *);
static int convert_charsets (CT, char *, int *);
static int write_content (CT, char *, char *, int, int);
- if ((ct_encoding = content_encoding (ct)) == CE_BINARY &&
- encoding != CE_BINARY) {
+ const char *reason = NULL;
+
+ if ((ct_encoding = content_encoding (ct, &reason)) == CE_BINARY
+ && encoding != CE_BINARY) {
/* The decoding isn't acceptable so discard it.
Leave status as OK to allow other transformations. */
if (verbosw) {
report (ct->c_partno, ct->c_file,
/* The decoding isn't acceptable so discard it.
Leave status as OK to allow other transformations. */
if (verbosw) {
report (ct->c_partno, ct->c_file,
/* See if the decoded content is 7bit, 8bit, or binary. It's binary
if it has any NUL characters, a CR not followed by a LF, or lines
/* See if the decoded content is 7bit, 8bit, or binary. It's binary
if it has any NUL characters, a CR not followed by a LF, or lines
+ if (*cp == '\0') {
+ *reason = "null character";
+ } else if (line_len > 998) {
+ *reason = "line length > 998";
+ } else if (*cp != '\n' && last_char_was_cr) {
+ *reason = "CR not followed by LF";
+ } else {
+ /* Should not reach this. */
+ *reason = "";
+ }