[gupnp] Only count element nodes as arguments



commit cd73a5440a5b1ae85d93db2f00817889c24528ca
Author: Jens Georg <mail jensge org>
Date:   Thu Jun 23 13:54:31 2011 +0200

    Only count element nodes as arguments
    
    Previously it was also counting text nodes, thus something like
    
    <u:Action>
    </u:Action>
    
    would result in an argument count of 1.

 libgupnp/gupnp-service.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c
index 562fc0c..90de9db 100644
--- a/libgupnp/gupnp-service.c
+++ b/libgupnp/gupnp-service.c
@@ -968,16 +968,19 @@ control_server_handler (SoupServer        *server,
         /* Create action structure */
         action = g_slice_new0 (GUPnPServiceAction);
 
-        action->ref_count    = 1;
-        action->name         = g_strdup (action_name);
-        action->msg          = g_object_ref (msg);
-        action->doc          = gupnp_xml_doc_new(doc);
-        action->node         = action_node;
-        action->response_str = new_action_response_str (action_name,
+        action->ref_count      = 1;
+        action->name           = g_strdup (action_name);
+        action->msg            = g_object_ref (msg);
+        action->doc            = gupnp_xml_doc_new(doc);
+        action->node           = action_node;
+        action->response_str   = new_action_response_str (action_name,
                                                         soap_action);
-        action->context      = g_object_ref (context);
+        action->context        = g_object_ref (context);
+        action->argument_count = 0;
+
         for (node = action->node->children; node; node = node->next)
-                action->argument_count++;
+                if (node->type == XML_ELEMENT_NODE)
+                        action->argument_count++;
 
         /* Get accepted encodings */
         accept_encoding = soup_message_headers_get_list (msg->request_headers,



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