X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=handler.c;h=59c70de211a1fce93d6f1be6f0d613e70f681e9e;hp=7f24f9d32eb775f53b85835536e4f052efacbd46;hb=6ebff74ad242d4c56fb7762965b19cee14fd2daa;hpb=1ee89902de184a640c171ae3285bff6882a791bd diff --git a/handler.c b/handler.c index 7f24f9d..59c70de 100644 --- a/handler.c +++ b/handler.c @@ -14,6 +14,8 @@ #include +#include + #include "mutt.h" #include "recvattach.h" #include "handler.h" @@ -137,7 +139,7 @@ static void qp_decode_line (char *dest, char *src, ssize_t * l, int last) * */ -void mutt_decode_quoted (STATE * s, long len, int istext, iconv_t cd) +static void mutt_decode_quoted (STATE * s, long len, int istext, iconv_t cd) { char line[STRING]; char decline[2 * STRING]; @@ -268,14 +270,14 @@ void mutt_decode_base64 (STATE * s, long len, int istext, iconv_t cd) state_reset_prefix (s); } -unsigned char decode_byte (char ch) +static unsigned char decode_byte (char ch) { if (ch == 96) return 0; return ch - 32; } -void mutt_decode_uuencoded (STATE * s, long len, int istext, iconv_t cd) +static void mutt_decode_uuencoded (STATE * s, long len, int istext, iconv_t cd) { char tmps[SHORT_STRING]; char linelen, c, l, out; @@ -629,7 +631,7 @@ static void enriched_set_flags (const char *tag, struct enriched_state *stte) } } -int text_enriched_handler (BODY * a, STATE * s) +static int text_enriched_handler (BODY * a, STATE * s) { enum { TEXT, LANGLE, TAG, BOGUS_TAG, NEWLINE, ST_EOF, DONE @@ -1081,7 +1083,7 @@ static int autoview_handler (BODY * a, STATE * s) 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 { @@ -1138,12 +1140,12 @@ static int autoview_handler (BODY * a, STATE * s) } 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); @@ -1386,10 +1388,9 @@ int mutt_body_handler (BODY * b, STATE * s) if (!plaintext) { /* decode to a tempfile, saving the original destination */ fp = s->fpout; - mutt_mktemp (tempfile); - if ((s->fpout = safe_fopen (tempfile, "w")) == NULL) { + s->fpout = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL); + if (!s->fpout) { mutt_error _("Unable to open temporary file!"); - goto bail; } /* decoding the attachment changes the size and offset, so save a copy @@ -1405,16 +1406,16 @@ int mutt_body_handler (BODY * b, STATE * s) s->prefix = NULL; decode = 1; - } - else + } else { b->type = TYPETEXT; + } mutt_decode_attachment (b, s); 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; @@ -1438,7 +1439,7 @@ int mutt_body_handler (BODY * b, STATE * s) b->offset = tmpoffset; /* restore the original source stream */ - fclose (s->fpin); + m_fclose(&s->fpin); s->fpin = fp; } }