projects
/
modest
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* trivial fix to show the right banner, fixes NB#60521
[modest]
/
src
/
modest-text-utils.c
diff --git
a/src/modest-text-utils.c
b/src/modest-text-utils.c
index
52d9ecf
..
3c32ada
100644
(file)
--- a/
src/modest-text-utils.c
+++ b/
src/modest-text-utils.c
@@
-300,6
+300,7
@@
modest_text_utils_convert_buffer_to_html (GString *html, const gchar *data)
guint i;
gboolean space_seen = FALSE;
gsize len;
guint i;
gboolean space_seen = FALSE;
gsize len;
+ guint break_dist = 0; /* distance since last break point */
len = strlen (data);
len = strlen (data);
@@
-312,6
+313,15
@@
modest_text_utils_convert_buffer_to_html (GString *html, const gchar *data)
space_seen = FALSE;
}
space_seen = FALSE;
}
+ /* we artificially insert a breakpoint (newline)
+ * after 256, to make sure our lines are not so long
+ * they will DOS the regexping later
+ */
+ if (++break_dist == 256) {
+ g_string_append_c (html, '\n');
+ break_dist = 0;
+ }
+
switch (kar) {
case 0: break; /* ignore embedded \0s */
case '<' : g_string_append (html, "<"); break;
switch (kar) {
case 0: break; /* ignore embedded \0s */
case '<' : g_string_append (html, "<"); break;
@@
-319,9
+329,10
@@
modest_text_utils_convert_buffer_to_html (GString *html, const gchar *data)
case '&' : g_string_append (html, "&"); break;
case '"' : g_string_append (html, """); break;
case '\'' : g_string_append (html, "'"); break;
case '&' : g_string_append (html, "&"); break;
case '"' : g_string_append (html, """); break;
case '\'' : g_string_append (html, "'"); break;
- case '\n' : g_string_append (html, "<br>\n"); break;
- case '\t' : g_string_append (html, " "); break; /* note the space at the end*/
+ case '\n' : g_string_append (html, "<br>\n"); break_dist= 0; break;
+ case '\t' : g_string_append (html, " "); break_dist=0; break; /* note the space at the end*/
case ' ':
case ' ':
+ break_dist = 0;
if (space_seen) { /* second space in a row */
g_string_append (html, " ");
space_seen = FALSE;
if (space_seen) { /* second space in a row */
g_string_append (html, " ");
space_seen = FALSE;