state_reset_prefix (s);
}
-static unsigned char decode_byte (char ch)
+static unsigned char decode_byte(int ch)
{
- if (ch == 96)
- return 0;
- return ch - 32;
+ return ch == 96 ? 0 : ch - 32;
}
static void mutt_decode_uuencoded (STATE * s, long len, int istext, iconv_t cd)
{
- char tmps[SHORT_STRING];
+ char tmps[STRING];
char linelen, c, l, out;
char *pt;
char bufi[BUFI_SIZE];
if (!m_strncmp(tmps, "end", 3))
break;
pt = tmps;
- linelen = decode_byte (*pt);
+ linelen = decode_byte(*pt);
pt++;
for (c = 0; c < linelen;) {
for (l = 2; l <= 6; l += 2) {
- out = decode_byte (*pt) << l;
+ out = decode_byte(*pt) << l;
pt++;
- out |= (decode_byte (*pt) >> (6 - l));
+ out |= (decode_byte(*pt) >> (6 - l));
bufi[k++] = out;
c++;
if (c == linelen)
const char *tag_name;
int index;
} EnrichedTags[] = {
- {
- "param", RICH_PARAM}, {
- "bold", RICH_BOLD}, {
- "italic", RICH_ITALIC}, {
- "underline", RICH_UNDERLINE}, {
- "nofill", RICH_NOFILL}, {
- "excerpt", RICH_EXCERPT}, {
- "indent", RICH_INDENT}, {
- "indentright", RICH_INDENT_RIGHT}, {
- "center", RICH_CENTER}, {
- "flushleft", RICH_FLUSHLEFT}, {
- "flushright", RICH_FLUSHRIGHT}, {
- "flushboth", RICH_FLUSHLEFT}, {
- "color", RICH_COLOR}, {
- "x-color", RICH_COLOR}, {
- NULL, -1}
+ {"param", RICH_PARAM},
+ {"bold", RICH_BOLD},
+ {"italic", RICH_ITALIC},
+ {"underline", RICH_UNDERLINE},
+ {"nofill", RICH_NOFILL},
+ {"excerpt", RICH_EXCERPT},
+ {"indent", RICH_INDENT},
+ {"indentright", RICH_INDENT_RIGHT},
+ {"center", RICH_CENTER},
+ {"flushleft", RICH_FLUSHLEFT},
+ {"flushright", RICH_FLUSHRIGHT},
+ {"flushboth", RICH_FLUSHLEFT},
+ {"color", RICH_COLOR},
+ {"x-color", RICH_COLOR},
+ {NULL, -1}
};
struct enriched_state {
stte->line_max = stte->line_used;
p_realloc(&stte->line, stte->line_max + 1);
}
- strcat (stte->line, stte->buffer); /* __STRCAT_CHECKED__ */
+ m_strcat(stte->line, stte->line_max + 1, stte->buffer);
stte->line_len += stte->word_len;
stte->word_len = 0;
stte->buff_used = 0;
else {
stte->buffer[stte->buff_used++] = c;
}
- }
- else {
+ } else {
stte->buffer[stte->buff_used++] = c;
}
stte->word_len++;
mutt_copy_bytes (s->fpin, fpin, a->length);
if (!piped) {
- safe_fclose (&fpin);
+ m_fclose(&fpin);
thepid = mutt_create_filter (command, NULL, &fpout, &fperr);
- }
- else {
+ } else {
unlink (tempfile);
fflush (fpin);
rewind (fpin);
state_puts (buffer, s);
}
}
- }
- else {
+ } else {
mutt_copy_stream (fpout, s->fpout);
/* Check for stderr messages */
if (fgets (buffer, sizeof (buffer), fperr)) {
}
bail:
- safe_fclose (&fpout);
- safe_fclose (&fperr);
+ m_fclose(&fpout);
+ m_fclose(&fperr);
mutt_wait_filter (thepid);
if (piped)
- safe_fclose (&fpin);
+ m_fclose(&fpin);
else
mutt_unlink (tempfile);
(option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) |
CH_DECODE, NULL);
}
- }
- else {
+ } else {
if (s->flags & M_DISPLAY) {
state_mark_attach (s);
state_printf (s,
if (s->flags & M_CHARCONV) {
const char *charset = parameter_getval(b->parameter, "charset");
- if (!option (OPTSTRICTMIME) && !charset)
+ if (!charset)
charset = charset_getfirst(AssumedCharset);
if (charset && Charset)
cd = mutt_iconv_open (Charset, charset, M_ICONV_HOOK_FROM);
- }
- else {
+ } else {
if (b->file_charset)
cd = mutt_iconv_open (Charset, b->file_charset, M_ICONV_HOOK_FROM);
}
plaintext = 1;
}
else if (b->type == TYPEMESSAGE) {
- if (mutt_is_message_type (b->type, b->subtype))
+ if (mutt_is_message_type (b))
handler = message_handler;
else if (!ascii_strcasecmp ("delivery-status", b->subtype))
plaintext = 1;
fseeko (s->fpin, b->offset, 0);
/* see if we need to decode this part before processing it */
- if (b->encoding == ENCBASE64 || b->encoding == ENCQUOTEDPRINTABLE || b->encoding == ENCUUENCODED || plaintext || mutt_is_text_part (b)) { /* text subtypes may
- * require character
- * set conversion even
- * with 8bit encoding.
- */
+ if (b->encoding == ENCBASE64 || b->encoding == ENCQUOTEDPRINTABLE
+ || b->encoding == ENCUUENCODED || plaintext || mutt_is_text_part (b)) {
+ /* text subtypes may require character set conversion even with 8bit
+ encoding. */
int origType = b->type;
char *savePrefix = NULL;
if (decode) {
b->length = ftello (s->fpout);
b->offset = 0;
- fclose (s->fpout);
+ m_fclose(&s->fpout);
/* restore final destination and substitute the tempfile for input */
s->fpout = fp;
b->offset = tmpoffset;
/* restore the original source stream */
- fclose (s->fpin);
+ m_fclose(&s->fpin);
s->fpin = fp;
}
}