Re: [gupnp] problem with GUPnPLastChangeParser
- From: "Zeeshan Ali (Khattak)" <zeenix gmail com>
- To: gupnp o-hand com
- Subject: Re: [gupnp] problem with GUPnPLastChangeParser
- Date: Wed, 29 Apr 2009 19:07:03 +0300
Hi Sven,
Does the attached patch solves the problem for you?
--
Regards,
Zeeshan Ali (Khattak)
FSF member#5124
From 9038315760c83215e185ecaccad431b07f112ecc Mon Sep 17 00:00:00 2001
From: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed, 29 Apr 2009 19:03:34 +0300
Subject: [PATCH] Dont copy the value if not provided in LastChange
There is no need to set the variable if it's value is not provided in the
LastChange event.
---
libgupnp-av/gupnp-last-change-parser.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/libgupnp-av/gupnp-last-change-parser.c b/libgupnp-av/gupnp-last-change-parser.c
index 87057f1..ff5397a 100644
--- a/libgupnp-av/gupnp-last-change-parser.c
+++ b/libgupnp-av/gupnp-last-change-parser.c
@@ -70,7 +70,7 @@ gupnp_last_change_parser_class_init (GUPnPLastChangeParserClass *klass)
/* Reads a value of state variable @variable_name to an initialised GValue pair
* from the InstanceID node of a LastChange xml doc */
-static void
+static gboolean
read_state_variable (const char *variable_name,
GValue *value,
xmlNode *instance_node)
@@ -83,7 +83,7 @@ read_state_variable (const char *variable_name,
variable_name,
NULL);
if (!variable_node)
- return;
+ return FALSE;
val_str = xml_util_get_attribute_content (variable_node, "val");
if (!val_str) {
@@ -91,12 +91,14 @@ read_state_variable (const char *variable_name,
"LastChange event",
variable_name);
- return;
+ return FALSE;
}
gvalue_util_set_value_from_string (value, (char *) val_str);
g_free (val_str);
+
+ return TRUE;
}
static xmlNode *
@@ -191,9 +193,11 @@ gupnp_last_change_parser_parse_last_change_valist
g_value_init (&value, variable_type);
- read_state_variable (variable_name, &value, instance_node);
-
- G_VALUE_LCOPY (&value, var_args, 0, ©_error);
+ if (read_state_variable (variable_name,
+ &value,
+ instance_node)) {
+ G_VALUE_LCOPY (&value, var_args, 0, ©_error);
+ }
g_value_unset (&value);
--
1.6.2.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]