libgsf r1041 - in trunk: . gsf



Author: mortenw
Date: Wed Feb  4 20:42:23 2009
New Revision: 1041
URL: http://svn.gnome.org/viewvc/libgsf?rev=1041&view=rev

Log:
2009-02-04  Morten Welinder  <terra gnome org>

	* gsf/gsf-libxml.c (gsf_xml_out_add_cstr): Drop characters that
	xml 1.0 cannot represent.  Bandaids #568919.



Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/gsf/gsf-libxml.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Wed Feb  4 20:42:23 2009
@@ -7,6 +7,7 @@
 
 Morten:
 	* Handle malformed xml better.  [#568994]
+	* Drop characters that xml 1.0 cannot represent.  [#568919]
 
 --------------------------------------------------------------------------
 libgsf 1.14.11

Modified: trunk/gsf/gsf-libxml.c
==============================================================================
--- trunk/gsf/gsf-libxml.c	(original)
+++ trunk/gsf/gsf-libxml.c	Wed Feb  4 20:42:23 2009
@@ -431,6 +431,7 @@
 static void
 gsf_xml_probe_error (GsfXMLProbeState *state, char const *msg, ...)
 {
+	(void)msg;
 	state->func = NULL;
 	state->success = FALSE;
 }
@@ -1642,7 +1643,8 @@
 				gsf_output_write (xout->output, cur-start, start);
 			start = ++cur;
 			gsf_output_write (xout->output, 6, "&quot;");
-		} else if (*cur < 0x20 && id != NULL) {
+		} else if ((*cur == '\n' || *cur == '\r' || *cur == '\t') &&
+			   id != NULL) {
 			guint8 buf[8];
 			sprintf (buf, "&#%d;", *cur);
 
@@ -1651,8 +1653,8 @@
 			start = ++cur;
 
 			gsf_output_write (xout->output, strlen (buf), buf);
-		} else if (((*cur >= 0x20) && (*cur != 0x7f)) ||
-			   (*cur == '\n') || (*cur == '\r') || (*cur == '\t')) {
+		} else if ((*cur >= 0x20 && *cur != 0x7f) ||
+			   (*cur == '\n' || *cur == '\r' || *cur == '\t')) {
 			cur++;
 		} else {
 			/*



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