From eba2691d5dbd944058b5c7645f0ced9bcfee6e72 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 1 May 2001 16:46:31 +0000 Subject: Don't use g_utf8_next_char on text that isn't valid UTF8, since it won't * e-html-utils.c (e_text_to_html_full): Don't use g_utf8_next_char on text that isn't valid UTF8, since it won't work (and might even get into an infinite loop). svn path=/trunk/; revision=9637 --- e-util/ChangeLog | 6 ++++++ e-util/e-html-utils.c | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'e-util') diff --git a/e-util/ChangeLog b/e-util/ChangeLog index bbc5ceeafc..027717987e 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,9 @@ +2001-05-01 Dan Winship + + * e-html-utils.c (e_text_to_html_full): Don't use g_utf8_next_char + on text that isn't valid UTF8, since it won't work (and might even + get into an infinite loop). + 2001-04-29 Dan Winship * e-html-utils.c (email_address_extract): Make this smarter. Now diff --git a/e-util/e-html-utils.c b/e-util/e-html-utils.c index 3b40c6ae87..1561492454 100644 --- a/e-util/e-html-utils.c +++ b/e-util/e-html-utils.c @@ -198,7 +198,7 @@ is_citation (const unsigned char *c, gboolean saw_citation) char * e_text_to_html_full (const char *input, unsigned int flags, guint32 color) { - const unsigned char *cur, *linestart; + const unsigned char *cur, *next, *linestart; char *buffer = NULL; char *out = NULL; int buffer_size = 0, col; @@ -214,7 +214,7 @@ e_text_to_html_full (const char *input, unsigned int flags, guint32 color) col = 0; - for (cur = linestart = input; cur && *cur; cur = g_utf8_next_char (cur)) { + for (cur = linestart = input; cur && *cur; cur = next) { gunichar u; if (flags & E_TEXT_TO_HTML_MARK_CITATION && col == 0) { @@ -309,7 +309,9 @@ e_text_to_html_full (const char *input, unsigned int flags, guint32 color) * Assume it's iso-8859-1. */ u = *cur; - } + next = cur + 1; + } else + next = g_utf8_next_char (cur); out = check_size (&buffer, &buffer_size, out, 10); -- cgit