From b17ab2ab37c011d31bedf2528ce95023c41700fd Mon Sep 17 00:00:00 2001 From: teuf Date: Tue, 7 Oct 2008 18:57:06 +0000 Subject: Fix blank node handling in the plist parser git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2136 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- ChangeLog | 6 ++++++ src/itdb_plist.c | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0fb880..32159f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-10-07 Christophe Fergeau + + * src/itdb_plist.c: fix handling on blank nodes (ie nodes + containing only white spaces), fixes parsing of SysInfoExtended files + as well ;) + 2008-10-07 Christophe Fergeau * src/itdb_plist.c: add support for tags to the plist diff --git a/src/itdb_plist.c b/src/itdb_plist.c index a0ea8f4..00e2b4b 100644 --- a/src/itdb_plist.c +++ b/src/itdb_plist.c @@ -197,7 +197,7 @@ parse_one_dict_entry (xmlNode *a_node, GHashTable *dict, GError **error) GValue *value; while ((cur_node != NULL) && (xmlStrcmp(cur_node->name, (xmlChar *)"key") != 0)) { - if (!xmlNodeIsText (cur_node)) { + if (!xmlIsBlankNode (cur_node)) { DEBUG ("skipping %s\n", cur_node->name); } cur_node = cur_node->next; @@ -207,9 +207,9 @@ parse_one_dict_entry (xmlNode *a_node, GHashTable *dict, GError **error) "Dict entry contains no node"); return NULL; } - key_name = xmlNodeGetContent(cur_node); + key_name = xmlNodeGetContent (cur_node); cur_node = cur_node->next; - while ((cur_node != NULL) && xmlNodeIsText(cur_node)) { + while ((cur_node != NULL) && xmlIsBlankNode (cur_node)) { cur_node = cur_node->next; } if (cur_node == NULL) { @@ -243,7 +243,11 @@ parse_dict (xmlNode *a_node, GError **error) g_free, (GDestroyNotify)value_free); while (cur_node != NULL) { - cur_node = parse_one_dict_entry (cur_node, dict, error); + if (xmlIsBlankNode (cur_node)) { + cur_node = cur_node->next; + } else { + cur_node = parse_one_dict_entry (cur_node, dict, error); + } } if ((error != NULL) && (*error != NULL)) { g_hash_table_destroy (dict); @@ -356,7 +360,7 @@ itdb_plist_parse (xmlNode * a_node, GError **error) return NULL; } cur_node = a_node->xmlChildrenNode; - while ((cur_node != NULL) && (xmlNodeIsText (cur_node))) { + while ((cur_node != NULL) && (xmlIsBlankNode (cur_node))) { cur_node = cur_node->next; } if (cur_node != NULL) { -- cgit