[libgdata] core: Use namespaces from all entries in a feed



commit 99636752cacaa97580e5575ae38372caa7a7fd8e
Author: Philip Withnall <philip tecnocode co uk>
Date:   Wed Aug 25 00:03:15 2010 +0100

    core: Use namespaces from all entries in a feed
    
    We were previously assuming that all entries in the feed had identical sets
    of namespaces, and just using the namespaces from the first entry. This can
    be untrue for batch feeds, so we must use the namespaces from all entries in
    the feed.

 gdata/gdata-feed.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gdata/gdata-feed.c b/gdata/gdata-feed.c
index dc2a607..e1e6825 100644
--- a/gdata/gdata-feed.c
+++ b/gdata/gdata-feed.c
@@ -570,10 +570,12 @@ static void
 get_namespaces (GDataParsable *parsable, GHashTable *namespaces)
 {
 	GDataFeedPrivate *priv = GDATA_FEED (parsable)->priv;
+	GList *i;
 
-	/* Assume that all the entries in the feed have identical namespaces, so we just call get_namespaces() for the first one */
-	if (priv->entries != NULL)
-		GDATA_PARSABLE_GET_CLASS (priv->entries->data)->get_namespaces (GDATA_PARSABLE (priv->entries->data), namespaces);
+	/* We can't assume that all the entries in the feed have identical namespaces, so we have to call get_namespaces() for all of them.
+	 * GDataBatchFeeds, for example, can easily contain entries with differing sets of namespaces. */
+	for (i = priv->entries; i != NULL; i = i->next)
+		GDATA_PARSABLE_GET_CLASS (i->data)->get_namespaces (GDATA_PARSABLE (i->data), namespaces);
 }
 
 /*



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