libsoup.soap-response.awn.{1,2}.patch



libsoup.soap-response.awn.1.patch:
	Make GCC happy: avoid warnings about "cast discards qualifiers
	from pointer target type".

libsoup.soap-response.awn.2.patch:
	Skip whitespaces and comments between: (a) "Envelope"
	node and its children nodes ("Header" and "Body"); (b) "Body" node
	and its children nodes (method node).

	Requires libsoup.soap-response.awn.1.patch to be applied before.

--
Andrew W. Nosenko <andrew w nosenko gmail com>
2006-09-13  Andrew W. Nosenko  <andrew w nosenko gmail com>

	* libsoup/soup-soap-response.c: 
	Make GCC happy: avoid warnings about "cast discards qualifiers
	from pointer target type".

Index: libsoup/soup-soap-response.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-soap-response.c,v
retrieving revision 1.17
diff -u -p -r1.17 soup-soap-response.c
--- libsoup/soup-soap-response.c	2 Apr 2006 21:46:18 -0000	1.17
+++ libsoup/soup-soap-response.c	13 Sep 2006 12:45:14 -0000
@@ -51,7 +51,7 @@ soup_soap_response_init (SoupSoapRespons
 {
 	SoupSoapResponsePrivate *priv = SOUP_SOAP_RESPONSE_GET_PRIVATE (response);
 
-	priv->xmldoc = xmlNewDoc ((xmlChar *)"1.0");
+	priv->xmldoc = xmlNewDoc ((const xmlChar *)"1.0");
 }
 
 
@@ -105,7 +105,7 @@ parse_parameters (SoupSoapResponsePrivat
 	xmlNodePtr tmp;
 
 	for (tmp = xml_method->xmlChildrenNode; tmp != NULL; tmp = tmp->next) {
-		if (!strcmp ((char *)tmp->name, "Fault")) {
+		if (!strcmp ((const char *)tmp->name, "Fault")) {
 			priv->soap_fault = tmp;
 			continue;
 		} else {
@@ -154,7 +154,7 @@ soup_soap_response_from_string (SoupSoap
 		return FALSE;
 	}
 
-	if (strcmp ((char *)xml_root->name, "Envelope") != 0) {
+	if (strcmp ((const char *)xml_root->name, "Envelope") != 0) {
 		xmlFreeDoc (priv->xmldoc);
 		priv->xmldoc = old_doc;
 		return FALSE;
@@ -162,9 +162,9 @@ soup_soap_response_from_string (SoupSoap
 
 	if (xml_root->xmlChildrenNode != NULL) {
 		xml_body = xml_root->xmlChildrenNode;
-		if (strcmp ((char *)xml_body->name, "Header") == 0)
+		if (strcmp ((const char *)xml_body->name, "Header") == 0)
 			xml_body = xml_root->xmlChildrenNode->next;
-		if (strcmp ((char *)xml_body->name, "Body") != 0) {
+		if (strcmp ((const char *)xml_body->name, "Body") != 0) {
 			xmlFreeDoc (priv->xmldoc);
 			priv->xmldoc = old_doc;
 			return FALSE;
@@ -223,7 +223,7 @@ soup_soap_response_set_method_name (Soup
 	g_return_if_fail (priv->xml_method != NULL);
 	g_return_if_fail (method_name != NULL);
 
-	xmlNodeSetName (priv->xml_method, (xmlChar *)method_name);
+	xmlNodeSetName (priv->xml_method, (const xmlChar *)method_name);
 }
 
 /**
@@ -331,7 +331,7 @@ soup_soap_parameter_get_first_child_by_n
 	for (tmp = soup_soap_parameter_get_first_child (param);
 	     tmp != NULL;
 	     tmp = soup_soap_parameter_get_next_child (tmp)) {
-		if (!strcmp (name, (char *)tmp->name))
+		if (!strcmp (name, (const char *)tmp->name))
 			return tmp;
 	}
 
@@ -383,7 +383,7 @@ soup_soap_parameter_get_next_child_by_na
 	for (tmp = soup_soap_parameter_get_next_child (param);
 	     tmp != NULL;
 	     tmp = soup_soap_parameter_get_next_child (tmp)) {
-		if (!strcmp (name, (char *)tmp->name))
+		if (!strcmp (name, (const char *)tmp->name))
 			return tmp;
 	}
 
@@ -408,7 +408,7 @@ soup_soap_parameter_get_property (SoupSo
 	g_return_val_if_fail (param != NULL, NULL);
 	g_return_val_if_fail (prop_name != NULL, NULL);
 
-	xml_s = xmlGetProp (param, (xmlChar *)prop_name);
+	xml_s = xmlGetProp (param, (const xmlChar *)prop_name);
 	s = g_strdup ((char *)xml_s);
 	xmlFree (xml_s);
 
@@ -479,7 +479,7 @@ soup_soap_response_get_first_parameter_b
 	for (l = priv->parameters; l != NULL; l = l->next) {
 		SoupSoapParameter *param = (SoupSoapParameter *) l->data;
 
-		if (!strcmp (name, (char *)param->name))
+		if (!strcmp (name, (const char *)param->name))
 			return param;
 	}
 
2006-09-13  Andrew W. Nosenko  <andrew w nosenko gmail com>

	* libsoup/soup-soap-response.c: 
	(skip_ws_siblings):
	New static function.
	(soup_soap_response_from_string):
	Use it for skip whitespaces and comments between: (a) "Envelope"
	node and its children nodes ("Header" and "Body"); (b) "Body" node
	and its children nodes (method node).

Requires libsoup.soap-response.awn.1.patch to be applied before.

--- libsoup/soup-soap-response.c	Wed Sep 13 17:13:10 2006
+++ libsoup/soup-soap-response.c-awn	Wed Sep 13 17:11:37 2006
@@ -99,6 +99,29 @@ soup_soap_response_new_from_string (cons
 	return response;
 }
 
+/*
+ *  Skip all comment and whitespace only text nodes.
+ *  
+ *  Return value: first non-WS sibling (including current node), or
+ *  %NULL if passed node is %NULL or it and its siblings are comment
+ *  nodes or text nodes with whitespeces only.
+ */
+static xmlNodePtr
+skip_ws_siblings(xmlNodePtr node)
+{
+    xmlNodePtr p = node;
+
+    while (p)
+    {
+        gboolean is_ws = xmlIsBlankNode(p);
+        if (is_ws || p->type == XML_COMMENT_NODE)
+            p = p->next;
+        else
+            break;
+    }
+    return p;
+}
+
 static void
 parse_parameters (SoupSoapResponsePrivate *priv, xmlNodePtr xml_method)
 {
@@ -161,16 +184,16 @@ soup_soap_response_from_string (SoupSoap
 	}
 
 	if (xml_root->xmlChildrenNode != NULL) {
-		xml_body = xml_root->xmlChildrenNode;
-		if (strcmp ((const char *)xml_body->name, "Header") == 0)
-			xml_body = xml_root->xmlChildrenNode->next;
-		if (strcmp ((const char *)xml_body->name, "Body") != 0) {
+		xml_body = skip_ws_siblings(xml_root->xmlChildrenNode);
+		if (xml_body && strcmp ((const char *)xml_body->name, "Header") == 0)
+			xml_body = skip_ws_siblings(xml_root->xmlChildrenNode->next);
+		if (!xml_body || strcmp ((const char *)xml_body->name, "Body") != 0) {
 			xmlFreeDoc (priv->xmldoc);
 			priv->xmldoc = old_doc;
 			return FALSE;
 		}
 
-		xml_method = xml_body->xmlChildrenNode;
+		xml_method = skip_ws_siblings(xml_body->xmlChildrenNode);
 
 		/* read all parameters */
 		if (xml_method)


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