[Xfce4-commits] <xfce4-weather-plugin:master> Fix compiler warnings

Florian Rivoal noreply at xfce.org
Tue Jan 4 15:34:03 CET 2011


Updating branch refs/heads/master
         to 1eda30de4e6974b3a727df9507441d18bc744c81 (commit)
       from 6c0621681612fb7ac7136019b72f2b828edfc93c (commit)

commit 1eda30de4e6974b3a727df9507441d18bc744c81
Author: Florian Rivoal <frivoal at xfce.org>
Date:   Tue Jan 4 18:46:40 2011 +0900

    Fix compiler warnings
    
    Applied the patch from bug #6038

 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-search.c    |    6 -----
 panel-plugin/weather-summary.c   |    3 +-
 panel-plugin/weather-translate.c |   40 +++++++++++++++++++-------------------
 panel-plugin/weather.c           |   14 ++++++------
 8 files changed, 34 insertions(+), 39 deletions(-)

diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index 62be55c..ab9691b 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -33,7 +33,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 cef4aac..2f5181d 100644
--- a/panel-plugin/weather-data.c
+++ b/panel-plugin/weather-data.c
@@ -400,7 +400,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 0d104bf..2b6b185 100644
--- a/panel-plugin/weather-http.c
+++ b/panel-plugin/weather-http.c
@@ -86,7 +86,7 @@ struct _WeatherConnection
   gint         status;
 
   /* received data */
-  void     *received;
+  gchar     *received;
   size_t    received_len;
 
   /* connection descriptor */
@@ -134,7 +134,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 fafd806..f32446f 100644
--- a/panel-plugin/weather-http.h
+++ b/panel-plugin/weather-http.h
@@ -20,7 +20,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-search.c b/panel-plugin/weather-search.c
index 6e62cfb..026a85b 100644
--- a/panel-plugin/weather-search.c
+++ b/panel-plugin/weather-search.c
@@ -348,9 +348,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);
@@ -416,7 +413,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);
@@ -502,8 +498,6 @@ void weather_search_by_ip(
         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-summary.c b/panel-plugin/weather-summary.c
index fc41985..8acc819 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -23,6 +23,7 @@
 
 #include "weather-parsers.h"
 #include "weather-data.h"
+#include "weather-http.h"
 #include "weather.h"
 
 #include "weather-summary.h"
@@ -180,7 +181,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 45d5358..0a083a2 100644
--- a/panel-plugin/weather-translate.c
+++ b/panel-plugin/weather-translate.c
@@ -284,19 +284,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;
 }
 
 
@@ -305,7 +305,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;
@@ -326,19 +326,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);
@@ -357,7 +357,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;
@@ -374,11 +374,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);
@@ -457,17 +457,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 1e14d4b..7a73cf6 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -318,7 +318,7 @@ set_icon_current (xfceweather_data *data)
 
 static void
 cb_update (gboolean  succeed,
-           void    *result,
+           gchar    *result,
 	   size_t    len,
            gpointer  user_data)
 {
@@ -784,7 +784,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;
 
@@ -844,18 +844,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;



More information about the Xfce4-commits mailing list