X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=handler.c;h=2eb2dc10829ddb233d495668e61db37cb2230ef8;hb=000b7ffd7d9cc9cfd9395727227bcbadbe8cdb18;hp=521bcc3681ff77c0bd7e0e4969432cc04191dabe;hpb=cf69ddd650f124d3aed242285434ba2b97fb4b79;p=apps%2Fmadmutt.git diff --git a/handler.c b/handler.c index 521bcc3..2eb2dc1 100644 --- a/handler.c +++ b/handler.c @@ -27,6 +27,7 @@ #include "charset.h" #include "mutt_crypt.h" #include "state.h" +#include "attach.h" #include "lib.h" #include "lib/mem.h" @@ -894,7 +895,7 @@ static void text_plain_flowed_handler (BODY * a, STATE * s) int bytes = a->length; char buf[LONG_STRING]; char *curline = strdup (""); - char *t; + char *t = NULL; unsigned int curline_len = 1; unsigned int quotelevel = 0, newql = 0; int first_line = 1; @@ -905,8 +906,9 @@ static void text_plain_flowed_handler (BODY * a, STATE * s) newql = get_quote_level (buf); - if ((t = strrchr (buf, '\n')) || (t = strrchr (buf, '\r'))) { - *t = '\0'; + if (bytes == 0 || ((t = strrchr (buf, '\n')) || (t = strrchr (buf, '\r')))) { + if (t) + *t = '\0'; if (str_len (curline) > 0 && curline[str_len (curline) - 1] == ' ' && newql == quotelevel && strcmp (curline + quotelevel, "-- ") != 0) { @@ -937,19 +939,6 @@ static void text_plain_flowed_handler (BODY * a, STATE * s) quotelevel = newql; } } - else if (bytes == 0) { - /* in case there's no line end it's likely the last line - * so append to current (if any) */ - if (buf[newql] == ' ') - curline[str_len (curline) - 1] = '\0'; - curline = realloc (curline, curline_len + str_len (buf)); - if (curline_len == 1) - *curline = '\0'; - curline_len += str_len (buf); - str_ncat (curline, curline_len, buf + newql, - str_len (buf + newql)); - break; - } } if (curline) { print_flowed_line (curline, s, quotelevel);