[libgweather] Fix newly introduced compiler warnings
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather] Fix newly introduced compiler warnings
- Date: Mon, 21 Dec 2015 12:56:03 +0000 (UTC)
commit e9358ac6a8eba9c95d139daade5c6dc1a73e679e
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Mon Dec 21 13:53:55 2015 +0100
Fix newly introduced compiler warnings
configure.ac | 4 ++--
libgweather/gweather-location-entry.c | 2 +-
libgweather/gweather-location.c | 10 ++++++----
libgweather/gweather-timezone.c | 3 ++-
libgweather/gweather-weather.c | 13 +++++++------
libgweather/weather-iwin.c | 9 ++++-----
libgweather/weather-owm.c | 2 +-
libgweather/weather-yahoo.c | 6 +++---
libgweather/weather-yrno.c | 2 +-
9 files changed, 27 insertions(+), 24 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e097d4a..f718910 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,7 +42,7 @@ AC_SUBST(LT_VERSION)
GTK_REQUIRED=3.13.5
GLIB_REQUIRED=2.35.1
-LIBSOUP_REQUIRED=2.34.0
+LIBSOUP_REQUIRED=2.44.0
LIBXML_REQUIRED=2.6.0
LT_PREREQ([2.2.6])
@@ -56,7 +56,7 @@ AM_PROG_CC_C_O
GLIB_GSETTINGS
-AX_COMPILER_FLAGS([WARN_CFLAGS],[WARN_LDFLAGS])
+AX_COMPILER_FLAGS([WARN_CFLAGS],[WARN_LDFLAGS], [$ax_is_release], [], [-Wno-switch-default])
PKG_CHECK_MODULES(DEPS, [gtk+-3.0 >= $GTK_REQUIRED
libxml-2.0 >= $LIBXML_REQUIRED
diff --git a/libgweather/gweather-location-entry.c b/libgweather/gweather-location-entry.c
index 7480a17..51cc254 100644
--- a/libgweather/gweather-location-entry.c
+++ b/libgweather/gweather-location-entry.c
@@ -599,7 +599,7 @@ static gboolean
match_compare_name (const char *key, const char *name)
{
gboolean is_first_word = TRUE;
- int len;
+ size_t len;
/* Ignore whitespace before the string */
key += strspn (key, " ");
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index 78bd239..40f5624 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -132,7 +132,8 @@ location_new_from_xml (GWeatherParser *parser, GWeatherLocationLevel level,
GPtrArray *children = NULL;
const char *tagname;
char *value, *normalized;
- int tagtype, i;
+ int tagtype;
+ unsigned int i;
loc = g_slice_new0 (GWeatherLocation);
loc->latitude = loc->longitude = DBL_MAX;
@@ -699,9 +700,11 @@ _got_place (GObject *source_object,
{
ArgData *info = (user_data);
GTask *task = info->task;
-
GeocodePlace *place;
GError *error = NULL;
+ const char *country_code;
+ struct FindNearestCityData data;
+
place = geocode_reverse_resolve_finish (GEOCODE_REVERSE (source_object), result, &error);
if (place == NULL) {
g_task_return_error (task, error);
@@ -709,9 +712,8 @@ _got_place (GObject *source_object,
g_object_unref (task);
return;
}
- const char *country_code = geocode_place_get_country_code (place);
+ country_code = geocode_place_get_country_code (place);
- struct FindNearestCityData data;
data.latitude = info->latitude * M_PI / 180.0;
data.longitude = info->longitude * M_PI / 180.0;
data.location = NULL;
diff --git a/libgweather/gweather-timezone.c b/libgweather/gweather-timezone.c
index 0112937..7364f69 100644
--- a/libgweather/gweather-timezone.c
+++ b/libgweather/gweather-timezone.c
@@ -234,7 +234,8 @@ _gweather_timezones_parse_xml (GWeatherParser *parser)
GPtrArray *zones;
GWeatherTimezone *zone;
const char *tagname;
- int tagtype, i;
+ int tagtype;
+ unsigned int i;
zones = g_ptr_array_new ();
diff --git a/libgweather/gweather-weather.c b/libgweather/gweather-weather.c
index 3c56b5e..b940276 100644
--- a/libgweather/gweather-weather.c
+++ b/libgweather/gweather-weather.c
@@ -329,6 +329,7 @@ calc_apparent (GWeatherInfo *info)
else if (temp >= 80.0) {
if (temp >= -500. && humidity >= 0) {
gdouble t2, h2;
+ gdouble t3, h3;
t2 = temp * temp;
h2 = humidity * humidity;
@@ -339,8 +340,9 @@ calc_apparent (GWeatherInfo *info)
* constrained by the accuracy of the instruments and that the
* we receive the temperature and dewpoints as integers.
*/
- gdouble t3 = t2 * temp;
- gdouble h3 = h2 * temp;
+
+ t3 = t2 * temp;
+ h3 = h2 * temp;
apparent = 16.923
+ 0.185212 * temp
@@ -500,9 +502,7 @@ ref_session (void)
if (session != NULL)
return g_object_ref (session);
- session = soup_session_async_new ();
- soup_session_add_feature_by_type (session, SOUP_TYPE_PROXY_RESOLVER_DEFAULT);
- soup_session_add_feature_by_type (session, SOUP_TYPE_CONTENT_DECODER);
+ session = soup_session_new ();
cache = get_cache ();
soup_session_add_feature (session, SOUP_SESSION_FEATURE (cache));
@@ -2006,9 +2006,10 @@ gweather_info_set_location_internal (GWeatherInfo *info,
gweather_location_ref (location);
} else {
GWeatherLocation *world;
- GVariant *default_loc = g_settings_get_value (priv->settings, DEFAULT_LOCATION);
const gchar *station_code;
+ default_loc = g_settings_get_value (priv->settings, DEFAULT_LOCATION);
+
g_variant_get (default_loc, "(&s&sm(dd))", &name, &station_code, &latlon_override, &lat, &lon);
if (strcmp(name, "") == 0)
diff --git a/libgweather/weather-iwin.c b/libgweather/weather-iwin.c
index 3a4d9da..5146d76 100644
--- a/libgweather/weather-iwin.c
+++ b/libgweather/weather-iwin.c
@@ -191,7 +191,7 @@ parseForecastXml (const char *buff, GWeatherInfo *master_info)
if (val && nfo) {
/* Checking from top to bottom, if 'value' contains 'name', then
that win,
thus put longer (more precise) values to the top. */
- int i;
+ unsigned int i;
struct _ph_list {
const char *name;
GWeatherConditionPhenomenon ph;
@@ -342,6 +342,9 @@ iwin_start_open (GWeatherInfo *info)
gchar *url;
WeatherLocation *loc;
SoupMessage *msg;
+ struct tm tm;
+ time_t now;
+ gchar latstr[G_ASCII_DTOSTR_BUF_SIZE], lonstr[G_ASCII_DTOSTR_BUF_SIZE];
g_assert (info != NULL);
@@ -358,10 +361,6 @@ iwin_start_open (GWeatherInfo *info)
return FALSE;
/* see the description here: http://www.weather.gov/forecasts/xml/ */
- struct tm tm;
- time_t now;
- gchar latstr[G_ASCII_DTOSTR_BUF_SIZE], lonstr[G_ASCII_DTOSTR_BUF_SIZE];
-
now = time (NULL);
localtime_r (&now, &tm);
diff --git a/libgweather/weather-owm.c b/libgweather/weather-owm.c
index 6628653..61b7d87 100644
--- a/libgweather/weather-owm.c
+++ b/libgweather/weather-owm.c
@@ -199,7 +199,7 @@ read_wind_direction (GWeatherInfo *info,
xmlNodePtr node)
{
xmlChar *val;
- int i;
+ unsigned int i;
val = xmlGetProp (node, XC("code"));
if (val == NULL)
diff --git a/libgweather/weather-yahoo.c b/libgweather/weather-yahoo.c
index 67c305b..27df81c 100644
--- a/libgweather/weather-yahoo.c
+++ b/libgweather/weather-yahoo.c
@@ -164,7 +164,7 @@ make_info_from_node (GWeatherInfo *master_info,
GWeatherInfo *info;
GWeatherInfoPrivate *priv;
xmlChar *val;
- int code;
+ unsigned long code;
g_return_val_if_fail (node->type == XML_ELEMENT_NODE, NULL);
@@ -187,8 +187,8 @@ make_info_from_node (GWeatherInfo *master_info,
priv->valid = priv->tempMinMaxValid;
val = xmlGetProp (node, XC("code"));
- code = strtol((const char*) val, NULL, 0);
- if (code >= 0 && code < G_N_ELEMENTS (condition_codes)) {
+ code = strtoul((const char*) val, NULL, 0);
+ if (code < G_N_ELEMENTS (condition_codes)) {
priv->cond = condition_codes[code];
priv->sky = sky_codes[code];
} else
diff --git a/libgweather/weather-yrno.c b/libgweather/weather-yrno.c
index da6a943..2b6e7b8 100644
--- a/libgweather/weather-yrno.c
+++ b/libgweather/weather-yrno.c
@@ -189,7 +189,7 @@ read_wind_direction (GWeatherInfo *info,
xmlNodePtr node)
{
xmlChar *val;
- int i;
+ unsigned int i;
val = xmlGetProp (node, XC("code"));
if (val == NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]