[Kazehakase-cvs] CVS update: kazehakase/src/utils

Back to archive index

Hiroyuki Ikezoe ikezo****@users*****
Wed Dec 6 09:45:49 JST 2006


Index: kazehakase/src/utils/utils.c
diff -u kazehakase/src/utils/utils.c:1.62 kazehakase/src/utils/utils.c:1.63
--- kazehakase/src/utils/utils.c:1.62	Wed Dec  6 09:29:59 2006
+++ kazehakase/src/utils/utils.c	Wed Dec  6 09:45:49 2006
@@ -154,7 +154,9 @@
 	while (html[i] != '\0')
 	{
 		gboolean ignore = FALSE;
-		if (html[i] == '<')
+		switch (html[i])
+		{
+		case '<':
 		{
 			gchar *name = NULL;
 			if (!g_ascii_strncasecmp(html+i+1, "script", 6))
@@ -178,11 +180,37 @@
 				while (html[i] != '>' && html[i] != '\0')
 					i++;
 			}
+			break;
 		}
-		else
-		{
-			/* FIXME! convert special character */
+		case '&':
+			if (!strncmp(html+i, "&amp;", 5))
+			{
+				g_string_append_c(work_string, '&');
+				i+=4;
+			}
+			else if (!strncmp(html+i, "&quot;", 6))
+			{
+				g_string_append_c(work_string, '"');
+				i+=5;
+			}
+			else if (!strncmp(html+i, "&lt;", 4))
+			{
+				g_string_append_c(work_string, '<');
+				i+=3;
+			}
+			else if (!strncmp(html+i, "&gt;", 4))
+			{
+				g_string_append_c(work_string, '>');
+				i+=3;
+			}
+			else
+			{
+				g_string_append_c(work_string, html[i]);
+			}
+			break;
+		default:
 			g_string_append_c(work_string, html[i]);
+			break;
 		}
 		i++;
 	}


More information about the Kazehakase-cvs mailing list
Back to archive index