[mlview-list][patch] Bug correction



Hello,

There was an important bug in mlview : the comment's content was not escaped, so he was not displayed when he contained <, >, etc. (conflict with Pango markups).
This patch corrects this bug (bug #127697 on bugzilla.gnome.org).

I'm sorry, because this bug is in the new 0.6.1 version, and this bug exists because I have not tested the code I personally added to mlview enough. :-/

Thanks to waloo on #mlview GIMPNet, who discovered the bug.

Nicolas Centa
"HappyPeng"
? patch.diff
Index: src/mlview-icon-tree.c
===================================================================
RCS file: /cvs/gnome/mlview/src/mlview-icon-tree.c,v
retrieving revision 1.10
diff -a -u -r1.10 mlview-icon-tree.c
--- src/mlview-icon-tree.c	20 Nov 2003 20:07:14 -0000	1.10
+++ src/mlview-icon-tree.c	22 Nov 2003 22:00:50 -0000
@@ -386,7 +386,8 @@
 node_to_string_tag (xmlNode * a_node)
 {
         guchar *result = NULL,
-                *content = NULL;
+                *content = NULL,
+                *escaped = NULL;
   
         g_return_val_if_fail (a_node != NULL, NULL);
   
@@ -455,10 +456,10 @@
                 if (content == NULL) {
                         xmlNodeSetContent (a_node, "<!--comment-->");
                         content = xmlNodeGetContent (a_node); }
-    
+                escaped = g_markup_escape_text (content, strlen (content));
                 result = g_strdup_printf ("<span foreground=\"%s\">%s</span>",
-                                          colour_str, content);
-    
+                                          colour_str, escaped);
+                g_free (escaped);
                 xmlFree (content);
         } else if (a_node->type == XML_PI_NODE) {
                 content = xmlNodeGetContent (a_node);
Index: src/mlview-tree-editor2.c
===================================================================
RCS file: /cvs/gnome/mlview/src/mlview-tree-editor2.c,v
retrieving revision 1.53
diff -a -u -r1.53 mlview-tree-editor2.c
--- src/mlview-tree-editor2.c	20 Nov 2003 08:11:34 -0000	1.53
+++ src/mlview-tree-editor2.c	22 Nov 2003 22:00:51 -0000
@@ -758,7 +758,8 @@
 node_to_string_tag (xmlNode * a_node)
 {
         guchar *result = NULL,
-                *content = NULL;
+                *content = NULL,
+                *escaped = NULL;
 
         g_return_val_if_fail (a_node != NULL, NULL);
 
@@ -859,10 +860,12 @@
                 if (content == NULL) {
                         xmlNodeSetContent (a_node, "<!--comment-->");
                         content = xmlNodeGetContent (a_node); }
+                escaped = g_markup_escape_text (content, strlen (content));
                 result = g_strconcat 
                         ("<span foreground=\"",
-                         colour_str, "\">&lt;!--", content,
+                         colour_str, "\">&lt;!--", escaped,
                          "--&gt;</span>", NULL);
+                g_free (escaped);
                 xmlFree (content);
         } else if (a_node->type == XML_PI_NODE) {
                 content = xmlNodeGetContent (a_node);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]