From f8421674d57276014b97a6dc2c7e131d766e5b9e Mon Sep 17 00:00:00 2001 From: Nick Schermer Date: Sat, 21 Nov 2009 13:26:32 +0100 Subject: [PATCH] Fix compiler warnings. --- panel-plugin/weather-config.c | 2 +- panel-plugin/weather-data.c | 2 +- panel-plugin/weather-http.c | 4 +- panel-plugin/weather-http.h | 2 +- panel-plugin/weather-icon.c | 2 + panel-plugin/weather-search.c | 8 +------ panel-plugin/weather-search.h | 2 +- panel-plugin/weather-summary.c | 3 +- panel-plugin/weather-translate.c | 40 +++++++++++++++++++------------------- panel-plugin/weather.c | 14 ++++++------ 10 files changed, 38 insertions(+), 41 deletions(-) diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c index c472619..a1dc33b 100644 --- a/panel-plugin/weather-config.c +++ b/panel-plugin/weather-config.c @@ -35,7 +35,7 @@ #define OPTIONS_N 11 #define BORDER 8 -const static labeloption labeloptions[OPTIONS_N] = { +static const labeloption labeloptions[OPTIONS_N] = { {N_("Windchill (F)"), FLIK}, {N_("Temperature (T)"), TEMP}, {N_("Atmosphere pressure (P)"), BAR_R}, diff --git a/panel-plugin/weather-data.c b/panel-plugin/weather-data.c index bce8f6e..715cb85 100644 --- a/panel-plugin/weather-data.c +++ b/panel-plugin/weather-data.c @@ -402,7 +402,7 @@ get_data_f (xml_dayf *data, str = data->hi; break; default: - str = g_strdup ("-"); + str = EMPTY_STRING; break; } break; diff --git a/panel-plugin/weather-http.c b/panel-plugin/weather-http.c index 0fe7713..6114bd4 100644 --- a/panel-plugin/weather-http.c +++ b/panel-plugin/weather-http.c @@ -85,7 +85,7 @@ struct _WeatherConnection gint status; /* received data */ - void *received; + gchar *received; size_t received_len; /* connection descriptor */ @@ -133,7 +133,7 @@ static void refresh_resolvers(void) #ifdef G_OS_UNIX static sigjmp_buf jmpenv; -static void timeout_handler(gint sig) +G_GNUC_NORETURN static void timeout_handler(gint sig) { siglongjmp(jmpenv, 1); } diff --git a/panel-plugin/weather-http.h b/panel-plugin/weather-http.h index 664e2ce..1f22a1b 100644 --- a/panel-plugin/weather-http.h +++ b/panel-plugin/weather-http.h @@ -22,7 +22,7 @@ G_BEGIN_DECLS -typedef void (*WeatherFunc) (gboolean succeed, void *received, size_t len, gpointer user_data); +typedef void (*WeatherFunc) (gboolean succeed, gchar *received, size_t len, gpointer user_data); void weather_http_cleanup_qeue (void); diff --git a/panel-plugin/weather-icon.c b/panel-plugin/weather-icon.c index ea389d6..3a77aa6 100644 --- a/panel-plugin/weather-icon.c +++ b/panel-plugin/weather-icon.c @@ -21,6 +21,8 @@ #include #endif +#include + #include #include diff --git a/panel-plugin/weather-search.c b/panel-plugin/weather-search.c index ea6b8e8..eb5109d 100644 --- a/panel-plugin/weather-search.c +++ b/panel-plugin/weather-search.c @@ -350,9 +350,6 @@ cb_geo_searchdone (gboolean succeed, xmlDoc *doc; xmlNode *cur_node; gchar *id, *city; - gboolean found = FALSE; - GtkTreeIter iter; - GtkTreeSelection *selection; if (!succeed || received == NULL) { data->cb(NULL, NULL, data->user_data); @@ -418,7 +415,6 @@ cb_geolocation (gboolean succeed, xmlNode *cur_node; gchar *city = NULL, *country = NULL; gchar *country_code = NULL, *region = NULL; - gboolean found = FALSE; if (!succeed || received == NULL) { data->cb(NULL, NULL, data->user_data); @@ -499,13 +495,11 @@ cb_geolocation (gboolean succeed, -gboolean weather_search_by_ip( +void weather_search_by_ip( const gchar *proxy_host, gint proxy_port, void (*gui_cb)(const gchar *loc_name, const gchar *loc_code, gpointer user_data), gpointer user_data) { - gchar *city = NULL, *country = NULL; - gchar *search = NULL; geolocation_data *data; if (!gui_cb) diff --git a/panel-plugin/weather-search.h b/panel-plugin/weather-search.h index 07e3deb..ea9f188 100644 --- a/panel-plugin/weather-search.h +++ b/panel-plugin/weather-search.h @@ -49,7 +49,7 @@ search_dialog *create_search_dialog (GtkWindow *, gchar *, gint); gboolean run_search_dialog (search_dialog * dialog); -gboolean weather_search_by_ip(const gchar *proxy_host, gint proxy_port, +void weather_search_by_ip(const gchar *proxy_host, gint proxy_port, void (*gui_cb)(const gchar *loc_name, const gchar *loc_code, gpointer user_data), gpointer user_data); diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c index 48bf44e..0557e0a 100644 --- a/panel-plugin/weather-summary.c +++ b/panel-plugin/weather-summary.c @@ -25,6 +25,7 @@ #include "weather-parsers.h" #include "weather-data.h" +#include "weather-http.h" #include "weather.h" #include "weather-summary.h" @@ -182,7 +183,7 @@ static gchar *get_logo_path (void) static void logo_fetched (gboolean succeed, - void *result, + gchar *result, size_t len, gpointer user_data) { diff --git a/panel-plugin/weather-translate.c b/panel-plugin/weather-translate.c index 9663d21..d5bbdbc 100644 --- a/panel-plugin/weather-translate.c +++ b/panel-plugin/weather-translate.c @@ -286,19 +286,19 @@ translate_desc (const gchar *desc) /* used by translate_lsup and translate_time */ static void -_fill_time (struct tm *time, +_fill_time (struct tm *time_tm, const gchar *hour, const gchar *minute, const gchar *am) { - time->tm_hour = atoi (hour); + time_tm->tm_hour = atoi (hour); - if (am[0] == 'P' && time->tm_hour != 12) /* PM or AM */ - time->tm_hour += 12; + if (am[0] == 'P' && time_tm->tm_hour != 12) /* PM or AM */ + time_tm->tm_hour += 12; - time->tm_min = atoi (minute); - time->tm_sec = 0; - time->tm_isdst = -1; + time_tm->tm_min = atoi (minute); + time_tm->tm_sec = 0; + time_tm->tm_isdst = -1; } @@ -307,7 +307,7 @@ gchar * translate_lsup (const gchar *lsup) { gchar *hdate; - struct tm time; + struct tm time_tm; gint size = 0, i = 0; gchar **lsup_split; int len; @@ -328,19 +328,19 @@ translate_lsup (const gchar *lsup) return NULL; } - time.tm_mon = atoi (lsup_split[0]) - 1; - time.tm_mday = atoi (lsup_split[1]); - time.tm_year = atoi (lsup_split[2]) + 100; + time_tm.tm_mon = atoi (lsup_split[0]) - 1; + time_tm.tm_mday = atoi (lsup_split[1]); + time_tm.tm_year = atoi (lsup_split[2]) + 100; - _fill_time (&time, lsup_split[3], lsup_split[4], lsup_split[5]); + _fill_time (&time_tm, lsup_split[3], lsup_split[4], lsup_split[5]); g_strfreev (lsup_split); - if (mktime (&time) != -1) + if (mktime (&time_tm) != -1) { hdate = g_malloc (HDATE_N); - len = strftime (hdate, HDATE_N, _("%x at %X Local Time"), &time); + len = strftime (hdate, HDATE_N, _("%x at %X Local Time"), &time_tm); hdate[len] = 0; if (!g_utf8_validate(hdate, -1, NULL)) { gchar *utf8 = g_locale_to_utf8(hdate, -1, NULL, NULL, NULL); @@ -359,7 +359,7 @@ gchar * translate_day (const gchar *day) { gint wday = -1; - struct tm time; + struct tm time_tm; guint i; const gchar *days[] = {"su", "mo", "tu", "we", "th", "fr", "sa", NULL}; gchar *day_loc; @@ -376,11 +376,11 @@ translate_day (const gchar *day) return NULL; else { - time.tm_wday = wday; + time_tm.tm_wday = wday; day_loc = g_malloc (DAY_LOC_N); - len = strftime (day_loc, DAY_LOC_N, "%A", &time); + len = strftime (day_loc, DAY_LOC_N, "%A", &time_tm); day_loc[len] = 0; if (!g_utf8_validate(day_loc, -1, NULL)) { gchar *utf8 = g_locale_to_utf8(day_loc, -1, NULL, NULL, NULL); @@ -459,17 +459,17 @@ translate_wind_speed (const gchar *wspeed, gchar * -translate_time (const gchar *time) +translate_time (const gchar *timestr) { gchar **time_split, *time_loc; gint i = 0, size = 0; struct tm time_tm; int len; - if (strlen (time) == 0) + if (strlen (timestr) == 0) return NULL; - time_split = g_strsplit_set (time, ": ", 3); + time_split = g_strsplit_set (timestr, ": ", 3); while (time_split[i++]) size++; diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c index 764f641..f1bde41 100644 --- a/panel-plugin/weather.c +++ b/panel-plugin/weather.c @@ -320,7 +320,7 @@ set_icon_current (xfceweather_data *data) static void cb_update (gboolean succeed, - void *result, + gchar *result, size_t len, gpointer user_data) { @@ -786,7 +786,7 @@ static xfceweather_data * xfceweather_create_control (XfcePanelPlugin *plugin) { xfceweather_data *data = panel_slice_new0 (xfceweather_data); - GtkWidget *refresh, *forecast; + GtkWidget *refresh, *mi; datas lbl; GdkPixbuf *icon = NULL; @@ -846,18 +846,18 @@ xfceweather_create_control (XfcePanelPlugin *plugin) xfce_panel_plugin_menu_insert_item (plugin, GTK_MENU_ITEM (refresh)); /* add refresh button to right click menu, for people who missed the middle mouse click feature */ - forecast = gtk_image_menu_item_new_with_mnemonic (_("_Forecast")); + mi = gtk_image_menu_item_new_with_mnemonic (_("_Forecast")); icon = get_icon ("32", 16); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(forecast), + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), gtk_image_new_from_pixbuf(icon)); if (G_LIKELY (icon)) g_object_unref (G_OBJECT (icon)); - gtk_widget_show (forecast); + gtk_widget_show (mi); - g_signal_connect (G_OBJECT (forecast), "activate", + g_signal_connect (G_OBJECT (mi), "activate", G_CALLBACK (forecast_click), data); - xfce_panel_plugin_menu_insert_item (plugin, GTK_MENU_ITEM (forecast)); + xfce_panel_plugin_menu_insert_item (plugin, GTK_MENU_ITEM (mi)); /* assign to tempval because g_array_append_val () is using & operator */ lbl = TEMP; -- 1.6.5.3