X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fmsg_renderers.c;h=97b454abdbdf3cfa4f1ee2c4361f3ca6503c2eff;hb=b73b5cda73bc2a5f5fa77a9caee5a542ad1c1475;hp=5e88b91721be8f03cc0fde5e20969be01a903411;hpb=2e22f3313ffab43f382a2a9137e5a2a3f4994ca2;p=citadel.git
diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c
index 5e88b9172..97b454abd 100644
--- a/webcit/msg_renderers.c
+++ b/webcit/msg_renderers.c
@@ -827,7 +827,7 @@ void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F
int ConvertIt = 1;
int bn = 0;
int bq = 0;
- int i, n, done = 0;
+ int i;
long len;
#ifdef HAVE_ICONV
iconv_t ic = (iconv_t)(-1) ;
@@ -869,47 +869,50 @@ void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F
Line2 = NewStrBufPlain(NULL, SIZ);
Target = NewStrBufPlain(NULL, StrLength(Mime->Data));
- while ((n = StrBufSipLine(Line, Mime->Data, &BufPtr), n >= 0) && !done)
- {
- done = n == 0;
- bq = 0;
- i = 0;
- ptr = ChrPtr(Line);
- len = StrLength(Line);
- pte = ptr + len;
-
- while ((ptr < pte) &&
- ((*ptr == '>') ||
- isspace(*ptr)))
+ if (StrLength(Mime->Data) > 0)
+ do
{
- if (*ptr == '>')
- bq++;
- ptr ++;
- i++;
- }
- if (i > 0) StrBufCutLeft(Line, i);
+ StrBufSipLine(Line, Mime->Data, &BufPtr);
+ bq = 0;
+ i = 0;
+ ptr = ChrPtr(Line);
+ len = StrLength(Line);
+ pte = ptr + len;
- if (StrLength(Line) == 0) {
- StrBufAppendBufPlain(Target, HKEY("
\n"), 0);
- continue;
- }
+ while ((ptr < pte) &&
+ ((*ptr == '>') ||
+ isspace(*ptr)))
+ {
+ if (*ptr == '>')
+ bq++;
+ ptr ++;
+ i++;
+ }
+ if (i > 0) StrBufCutLeft(Line, i);
+
+ if (StrLength(Line) == 0) {
+ StrBufAppendBufPlain(Target, HKEY("
\n"), 0);
+ continue;
+ }
- for (i = bn; i < bq; i++)
- StrBufAppendBufPlain(Target, HKEY("
"), 0); - for (i = bq; i < bn; i++) - StrBufAppendBufPlain(Target, HKEY(""), 0); + for (i = bn; i < bq; i++) + StrBufAppendBufPlain(Target, HKEY("
"), 0); + for (i = bq; i < bn; i++) + StrBufAppendBufPlain(Target, HKEY(""), 0); - if (ConvertIt) { - StrBufConvert(Line, Line1, &ic); - } + if (ConvertIt) { + StrBufConvert(Line, Line1, &ic); + } - StrBufAppendBufPlain(Target, HKEY(""), 0); - UrlizeText(Line1, Line, Line2); + StrBufAppendBufPlain(Target, HKEY(""), 0); + UrlizeText(Line1, Line, Line2); - StrEscAppend(Target, Line1, NULL, 0, 0); - StrBufAppendBufPlain(Target, HKEY("