My apologies for the extra traffic.  Please find attached an
updated patch based on feedback received.  Changes from the previous
patch are:

1)  strcmp -> strncmp, which should improve performance
2)  addition of more entities, which should avoid this recurring.

--
Emmet HIKORY
--- src/libs/tgf/params.cpp.orig	2007-01-22 16:43:35.000000000 +0900
+++ src/libs/tgf/params.cpp	2007-01-22 16:45:52.000000000 +0900
@@ -31,6 +31,7 @@
 #include <unistd.h>
 #endif
 #include <math.h>
+#include <string.h>
 
 #include <xmlparse.h>
 #ifdef WIN32
@@ -1179,7 +1180,24 @@
 		    }
 		    s += sprintf (s, "\"");
 		}
-		sprintf (s, " val=\"%s\"/>\n", curParam->value);
+		if (! strncmp(curParam->value,"<",1)) {
+		    sprintf (s, " val=\"&lt;\"/>\n");
+		}
+		else if (! strncmp(curParam->value,">",1)) {
+		    sprintf (s, " val=\"&gt;\"/>\n");
+		}
+		else if (! strncmp(curParam->value,"&",1)) {
+		    sprintf (s, " val=\"&amp;\"/>\n");
+		}
+		else if (! strncmp(curParam->value,"'",1)) {
+		    sprintf (s, " val=\"&apos;\"/>\n");
+		}
+		else if (! strncmp(curParam->value,"\"",1)) {
+		    sprintf (s, " val=\"&quot;\"/>\n");
+		}
+		else {
+		    sprintf (s, " val=\"%s\"/>\n", curParam->value);
+		}
 		outCtrl->curParam = GF_TAILQ_NEXT (curParam, linkParam);
 		return 1;
 

Reply via email to