diff options
author | Dan Winship <danw@src.gnome.org> | 2001-05-02 00:46:31 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-05-02 00:46:31 +0800 |
commit | eba2691d5dbd944058b5c7645f0ced9bcfee6e72 (patch) | |
tree | 35d121fbd24a79933783ffac723d1d554a435a62 | |
parent | 22f54199e78743297e7d78f3195b92f279cbd621 (diff) | |
download | gsoc2013-evolution-eba2691d5dbd944058b5c7645f0ced9bcfee6e72.tar gsoc2013-evolution-eba2691d5dbd944058b5c7645f0ced9bcfee6e72.tar.gz gsoc2013-evolution-eba2691d5dbd944058b5c7645f0ced9bcfee6e72.tar.bz2 gsoc2013-evolution-eba2691d5dbd944058b5c7645f0ced9bcfee6e72.tar.lz gsoc2013-evolution-eba2691d5dbd944058b5c7645f0ced9bcfee6e72.tar.xz gsoc2013-evolution-eba2691d5dbd944058b5c7645f0ced9bcfee6e72.tar.zst gsoc2013-evolution-eba2691d5dbd944058b5c7645f0ced9bcfee6e72.zip |
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
-rw-r--r-- | e-util/ChangeLog | 6 | ||||
-rw-r--r-- | e-util/e-html-utils.c | 8 |
2 files changed, 11 insertions, 3 deletions
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 <danw@ximian.com> + + * 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 <danw@ximian.com> * 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); |