1
0
forked from pool/mutt
mutt/widechar.sidebar.dif

76 lines
2.1 KiB
Plaintext
Raw Normal View History

---
handler.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/handler.c b/handler.c
index 8c3b699..6f8d77c 100644
--- a/handler.c
+++ b/handler.c
@@ -780,7 +780,7 @@ static void enriched_set_flags (const wchar_t *tag, struct enriched_state *stte)
static int text_enriched_handler (BODY *a, STATE *s)
{
enum {
- TEXT, LANGLE, TAG, BOGUS_TAG, NEWLINE, ST_EOF, DONE
+ TEXT, TEXT_GOTWC, LANGLE, TAG, BOGUS_TAG, NEWLINE, ST_EOF, DONE
} state = TEXT;
long bytes = a->length;
@@ -809,7 +809,7 @@ static int text_enriched_handler (BODY *a, STATE *s)
{
if (state != ST_EOF)
{
- if (!bytes || (wc = fgetwc (s->fpin)) == WEOF)
+ if (state != TEXT_GOTWC && (!bytes || (fscanf (s->fpin, "%lc", &wc)) == EOF))
state = ST_EOF;
else
bytes--;
@@ -817,6 +817,8 @@ static int text_enriched_handler (BODY *a, STATE *s)
switch (state)
{
+ case TEXT_GOTWC:
+ state = TEXT;
case TEXT :
switch (wc)
{
@@ -877,9 +879,8 @@ static int text_enriched_handler (BODY *a, STATE *s)
enriched_flush (&stte, 1);
else
{
- ungetwc (wc, s->fpin);
bytes++;
- state = TEXT;
+ state = TEXT_GOTWC;
}
break;
@@ -1567,7 +1568,7 @@ void mutt_decode_attachment (BODY *b, STATE *s)
* strip all trailing spaces to improve interoperability;
* if $text_flowed is unset, simply verbatim copy input
*/
-static int text_plain_handler (BODY *b, STATE *s)
+static int text_plain_handler (BODY *b __attribute__((unused)), STATE *s)
{
char *buf = NULL;
size_t l = 0, sz = 0;
@@ -1595,7 +1596,6 @@ static int run_decode_and_handler (BODY *b, STATE *s, handler_t handler, int pla
int origType;
char *savePrefix = NULL;
FILE *fp = NULL;
- char tempfile[_POSIX_PATH_MAX];
size_t tmplength = 0;
LOFF_T tmpoffset = 0;
int decode = 0;
@@ -1606,6 +1606,8 @@ static int run_decode_and_handler (BODY *b, STATE *s, handler_t handler, int pla
#ifdef HAVE_FMEMOPEN
char *temp;
size_t tempsize;
+#else
+ char tempfile[_POSIX_PATH_MAX];
#endif
/* see if we need to decode this part before processing it */
--
2.6.2