libgweather r260 - in trunk: . libgweather
- From: danw svn gnome org
- To: svn-commits-list gnome org
- Subject: libgweather r260 - in trunk: . libgweather
- Date: Wed, 18 Jun 2008 22:01:04 +0000 (UTC)
Author: danw
Date: Wed Jun 18 22:01:04 2008
New Revision: 260
URL: http://svn.gnome.org/viewvc/libgweather?rev=260&view=rev
Log:
* libgweather/gweather-xml.c (gweather_xml_parse_node): When
skipping an unrecognized node, use xmlTextReaderNext(), which
properly handles skipping its children, making the parsing more
future-proof. (The old code could only deal with skipping nodes
containing only text.) Also, don't examine &iter if it hasn't been
set (fixing a g_warning).
Modified:
trunk/ChangeLog
trunk/libgweather/gweather-xml.c
Modified: trunk/libgweather/gweather-xml.c
==============================================================================
--- trunk/libgweather/gweather-xml.c (original)
+++ trunk/libgweather/gweather-xml.c Wed Jun 18 22:01:04 2008
@@ -290,11 +290,9 @@
if ((coordinates = gweather_xml_get_value (xml)) == NULL)
goto error_out;
} else /* some strange tag */ {
- /* skip past it */
- char *junk;
- junk = gweather_xml_get_value (xml);
- if (junk)
- xmlFree (junk);
+ /* skip past it (and any children it might have) */
+ if (xmlTextReaderNext (xml) != 1)
+ goto error_out;
}
xmlFree (tagname);
@@ -320,11 +318,11 @@
dflt_radar, coordinates,
country_code, tz_hint);
- gtk_tree_store_set (store, &iter, GWEATHER_XML_COL_POINTER, new_loc, -1);
+ gtk_tree_store_set (store, self, GWEATHER_XML_COL_POINTER, new_loc, -1);
}
/* if this is not a location and there's no child, then it's useless */
- else if (!gtk_tree_model_iter_has_child (GTK_TREE_MODEL (store), &iter)) {
- gtk_tree_store_remove (store, &iter);
+ else if (self && !gtk_tree_model_iter_has_child (GTK_TREE_MODEL (store), self)) {
+ gtk_tree_store_remove (store, self);
}
/* if this is a city with only one location, then we merge the location and
@@ -333,16 +331,16 @@
int n_children;
n_children = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store),
- &iter);
+ self);
if (n_children == 1) {
GtkTreeIter child;
WeatherLocation *loc;
- gtk_tree_model_iter_children (GTK_TREE_MODEL (store), &child, &iter);
+ gtk_tree_model_iter_children (GTK_TREE_MODEL (store), &child, self);
gtk_tree_model_get (GTK_TREE_MODEL (store), &child,
GWEATHER_XML_COL_POINTER, &loc, -1);
gtk_tree_store_remove (store, &child);
- gtk_tree_store_set (store, &iter, GWEATHER_XML_COL_POINTER, loc, -1);
+ gtk_tree_store_set (store, self, GWEATHER_XML_COL_POINTER, loc, -1);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]