aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-filter-tohtml.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-04-10 19:35:00 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-04-10 19:35:00 +0800
commit2e7d1434aedfbb634ede57faf6741dae5419d520 (patch)
treec899efdc2fdbce344fbced33e345868d4259a37c /camel/camel-mime-filter-tohtml.c
parent0933b12476c210975487cd29c3e05a0f248eac04 (diff)
downloadgsoc2013-evolution-2e7d1434aedfbb634ede57faf6741dae5419d520.tar.gz
gsoc2013-evolution-2e7d1434aedfbb634ede57faf6741dae5419d520.tar.zst
gsoc2013-evolution-2e7d1434aedfbb634ede57faf6741dae5419d520.zip
filter data test cases.
2003-04-10 Not Zed <NotZed@Ximian.com> * tests/mime-filter/data: filter data test cases. * tests/mime-filter/test-tohtml.c: New test for html filter. ** See bug #40969 * camel-mime-filter-tohtml.c (html_convert): Change the logic slightly, scan a whole line within the main loop. svn path=/trunk/; revision=20799
Diffstat (limited to 'camel/camel-mime-filter-tohtml.c')
-rw-r--r--camel/camel-mime-filter-tohtml.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/camel/camel-mime-filter-tohtml.c b/camel/camel-mime-filter-tohtml.c
index 60c4686824..ca10d3d438 100644
--- a/camel/camel-mime-filter-tohtml.c
+++ b/camel/camel-mime-filter-tohtml.c
@@ -220,6 +220,14 @@ html_convert (CamelMimeFilter *filter, char *in, size_t inlen, size_t prespace,
char *start, *outend;
const char *inend;
int depth;
+
+ if (inlen == 0) {
+ *out = in;
+ *outlen = 0;
+ *outprespace = 0;
+
+ return;
+ }
camel_mime_filter_set_size (filter, inlen * 2 + 6, FALSE);
@@ -232,25 +240,24 @@ html_convert (CamelMimeFilter *filter, char *in, size_t inlen, size_t prespace,
outptr = g_stpcpy (outptr, "<pre>");
html->pre_open = TRUE;
}
-
+
start = inptr;
- while (inptr < inend && *inptr != '\n')
- inptr++;
-
- while (inptr < inend) {
+ do {
+ while (inptr < inend && *inptr != '\n')
+ inptr++;
+
+ if (*inptr != '\n' && !flush)
+ break;
+
html->column = 0;
depth = 0;
if (html->flags & CAMEL_MIME_FILTER_TOHTML_MARK_CITATION) {
if ((depth = citation_depth (start)) > 0) {
- char font[25];
-
/* FIXME: we could easily support multiple colour depths here */
- g_snprintf (font, 25, "<font color=\"#%06x\">", html->colour);
-
outptr = check_size (filter, outptr, &outend, 25);
- outptr = g_stpcpy (outptr, font);
+ outptr += sprintf(outptr, "<font color=\"#%06x\">", (html->colour & 0xffffff));
} else if (*start == '>') {
/* >From line */
start++;
@@ -319,11 +326,8 @@ html_convert (CamelMimeFilter *filter, char *in, size_t inlen, size_t prespace,
}
*outptr++ = '\n';
-
start = ++inptr;
- while (inptr < inend && *inptr != '\n')
- inptr++;
- }
+ } while (inptr < inend);
if (flush) {
/* flush the rest of our input buffer */