static GWeatherInfo * make_info_from_node (GWeatherInfo *master_info, xmlNodePtr node) { GWeatherInfo *info; GWeatherInfoPrivate *priv; xmlChar *val; int code; g_return_val_if_fail (node->type == XML_ELEMENT_NODE, NULL); info = _gweather_info_new_clone (master_info); priv = info->priv; val = xmlGetProp (node, XC("date")); priv->current_time = priv->update = date_to_time_t (val); xmlFree (val); val = xmlGetProp (node, XC("high")); priv->temp_max = g_ascii_strtod ((const char*) val, NULL); xmlFree (val); val = xmlGetProp (node, XC("low")); priv->temp_min = g_ascii_strtod ((const char*) val, NULL); xmlFree (val); priv->tempMinMaxValid = priv->tempMinMaxValid || (priv->temp_max > -999.0 && priv->temp_min > -999.0); priv->valid = priv->tempMinMaxValid; val = xmlGetProp (node, XC("text")); priv->forecast = g_strdup ((const char*) val); xmlFree (val); val = xmlGetProp (node, XC("code")); code = strtol((const char*) val, NULL, 0); if (code >= 0 && code < G_N_ELEMENTS (condition_codes)) { priv->cond = condition_codes[code]; priv->sky = sky_codes[code]; } else priv->valid = FALSE; xmlFree (val); return info; }
static GWeatherInfo * make_info_from_node (GWeatherInfo *master_info, xmlNodePtr node) { GWeatherInfo *info; GWeatherInfoPrivate *priv; xmlChar *val; g_return_val_if_fail (node->type == XML_ELEMENT_NODE, NULL); info = _gweather_info_new_clone (master_info); priv = info->priv; val = xmlGetProp (node, XC("from")); priv->current_time = priv->update = date_to_time_t (val, info->priv->location.tz_hint); xmlFree (val); fill_info_from_node (info, node); return info; }