Hello,

here is a short patch to fix the xml output of monocov.

The monocov-profiler does not replace the "<" and ">" of generic members with 
the right HTML-Entities when outputting to xml this caused the monocov-gui to 
crash when trying to display the .cov file.

This has been fixed by the attached patch, so please take a look at it.

Kind Regards,
Valentin
Index: coverage.c
===================================================================
--- coverage.c	(revision 76009)
+++ coverage.c	(working copy)
@@ -31,6 +31,9 @@
 	FILE *outfile;
 };
 
+static char
+*filter_html_from_classname(char *string);
+
 static void
 add_filter (MonoProfiler *prof, const char *filter);
 
@@ -270,6 +273,41 @@
 	prev_offset = entry->iloffset;
 }
 
+static char
+*filter_html_from_classname(char *string)
+{
+	char *string2,*ret;
+	if( !(string2=calloc(strlen(string)*4+1,sizeof(char))) )
+		return NULL;
+
+	ret=string2;
+	while(*string)
+	{
+		switch(*string)
+		{
+			case '<':
+				*string2++='&';
+				*string2++='l';
+				*string2++='t';
+				*string2++=';';
+				string++;
+				break;
+			case '>':
+				*string2++='&';
+				*string2++='g';
+				*string2++='t';
+				*string2++=';';
+				string++;
+				break;
+			default:
+				*string2++=*string++;
+				break;
+		}
+	}
+	*string2='\0';
+	return ret;
+}
+
 static void
 output_method (MonoMethod *method, gpointer dummy, MonoProfiler *prof)
 {
@@ -288,7 +326,7 @@
 	tmpsig = g_markup_escape_text (tmpsig, strlen (tmpsig));
 
 	klass = mono_method_get_class (method);
-	classname = mono_type_get_name (mono_class_get_type (klass));
+	classname = filter_html_from_classname (mono_type_get_name (mono_class_get_type (klass)));
 	image = mono_class_get_image (klass);
 
 	tmpname = mono_method_get_name (method);
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to