[Xfce4-commits] <xfce4-weather-plugin:master> Cleanup: Fix unused, uninitialized variables and silence warnings.

Harald Judt noreply at xfce.org
Wed Jul 25 13:40:01 CEST 2012


Updating branch refs/heads/master
         to 13adc71ad5bbc2f5636c4c11f7f89b8dc50f9d8e (commit)
       from d0de0fc0e670cb6ccc0ad07c105b4c7041b65577 (commit)

commit 13adc71ad5bbc2f5636c4c11f7f89b8dc50f9d8e
Author: Harald Judt <h.judt at gmx.at>
Date:   Wed Jul 25 13:38:30 2012 +0200

    Cleanup: Fix unused, uninitialized variables and silence warnings.

 panel-plugin/weather-config.c  |    4 ++--
 panel-plugin/weather-data.c    |   10 +---------
 panel-plugin/weather-http.c    |    8 ++------
 panel-plugin/weather-search.c  |    4 +---
 panel-plugin/weather-summary.c |    4 ----
 panel-plugin/weather.c         |    7 +------
 6 files changed, 7 insertions(+), 30 deletions(-)

diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index c572d96..b1bf8ad 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -218,7 +218,7 @@ sanitize_location_name(const gchar *location_name)
       offset = g_utf8_pointer_to_offset (location_name, pos);
       if (offset > LOC_NAME_MAX_LEN)
         offset = LOC_NAME_MAX_LEN;
-      pos = g_utf8_strncpy (sane, location_name, offset);
+      (void) g_utf8_strncpy (sane, location_name, offset);
       sane[LOC_NAME_MAX_LEN * 4 - 1] = '\0';
       return g_strdup (sane);
     }
@@ -228,7 +228,7 @@ sanitize_location_name(const gchar *location_name)
 
       if (len >= LOC_NAME_MAX_LEN)
         {
-          pos = g_utf8_strncpy (sane, location_name, len);
+          (void) g_utf8_strncpy (sane, location_name, len);
           sane[LOC_NAME_MAX_LEN * 4 - 1] = '\0';
           return g_strdup (sane);
         }
diff --git a/panel-plugin/weather-data.c b/panel-plugin/weather-data.c
index c029ea7..cff2b20 100644
--- a/panel-plugin/weather-data.c
+++ b/panel-plugin/weather-data.c
@@ -119,13 +119,6 @@ get_data (xml_time *timeslice, unit_systems unit_system, datas type)
 const gchar *
 get_unit (xml_time *timeslice, unit_systems unit_system, datas type)
 {
-	const xml_location *loc = NULL;
-
-	if (timeslice == NULL)
-		return "";
-
-	loc = timeslice->location;
-
 	switch(type) {
 	case ALTITUDE:
 		return (unit_system == IMPERIAL) ? _("ft") : _("m");
@@ -411,7 +404,6 @@ xml_time *make_current_conditions(xml_weather *data)
     /* now search for the nearest and shortest interval data
      * available, using a maximum interval of 6 hours */
     end_tm = start_tm = now_tm;
-    start_t = mktime(&start_tm);
 
     /* set interval to 1 hour as minimum, we don't want to retrieve point data */
     end_t = time_calc_hour(end_tm, 1);
@@ -441,7 +433,7 @@ xml_time *make_current_conditions(xml_weather *data)
 xml_time *
 make_forecast_data(xml_weather *data, int day, daytime dt)
 {
-	xml_time *forecast, *point_data, *interval_data;
+	xml_time *forecast = NULL, *point_data = NULL, *interval_data = NULL;
 	struct tm now_tm, start_tm, end_tm;
 	time_t now_t, start_t, end_t;
 	gint interval;
diff --git a/panel-plugin/weather-http.c b/panel-plugin/weather-http.c
index 0c6b540..30d72c5 100644
--- a/panel-plugin/weather-http.c
+++ b/panel-plugin/weather-http.c
@@ -145,7 +145,7 @@ weather_http_receive_data_idle (gpointer user_data)
 {
   WeatherConnection  *connection = user_data;
   gchar               buffer[1024];
-  gint                bytes, n, m;
+  gint                bytes = 0, n, m = 0;
   gchar              *request;
   fd_set              fds;
   struct timeval      select_timeout;
@@ -216,10 +216,8 @@ weather_http_receive_data_idle (gpointer user_data)
 
   for (a = r; a != NULL; a = a->ai_next) {
     connection->fd = socket (a->ai_family, a->ai_socktype, a->ai_protocol);
-    if (connection->fd < 0) {
-      err = errno;
+    if (connection->fd < 0)
       continue;
-    }
 #ifdef G_OS_UNIX
     signal(SIGALRM, timeout_handler);
     alarm(WEATHER_MAX_CONN_TIMEOUT);
@@ -231,8 +229,6 @@ weather_http_receive_data_idle (gpointer user_data)
 #endif
     if (m == 0)
       break;
-    else
-      err = errno;
 
     if (weather_http_receive_data_check (connection, timeout))
       break;
diff --git a/panel-plugin/weather-search.c b/panel-plugin/weather-search.c
index ecf59d9..3a814d6 100644
--- a/panel-plugin/weather-search.c
+++ b/panel-plugin/weather-search.c
@@ -215,7 +215,7 @@ create_search_dialog (GtkWindow *parent,
   GtkWidget         *vbox, *hbox, *scroll, *frame;
   GtkCellRenderer   *renderer = gtk_cell_renderer_text_new ();
   search_dialog     *dialog;
-  GtkWidget         *dialog_vbox, *dialog_action;
+  GtkWidget         *dialog_vbox;
 
   dialog = g_slice_new0 (search_dialog);
 
@@ -238,10 +238,8 @@ create_search_dialog (GtkWindow *parent,
 
 #if GTK_CHECK_VERSION(2,14,0)
   dialog_vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog->dialog));
-  dialog_action = gtk_dialog_get_action_area(GTK_DIALOG(dialog->dialog));
 #else
   dialog_vbox = GTK_DIALOG (dialog->dialog)->vbox;
-  dialog_action = GTK_DIALOG (dialog->dialog)->action_area;
 #endif
 
   vbox = gtk_vbox_new (FALSE, BORDER);
diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c
index cc8eb39..3b529b6 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -97,10 +97,6 @@ static gboolean view_motion_notify(GtkWidget *widget,
 				   GdkEventMotion *event,
 				   GtkWidget *view)
 {
-  GtkTextBuffer *buffer;
-
-  buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view));
-
   if (event->x != -1 && event->y != -1) {
     gint bx, by;
     GtkTextIter iter;
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 7777b24..e8f3de5 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -61,9 +61,7 @@ check_envproxy (gchar **proxy_host,
 
   tmp = strstr (env_proxy, "://");
 
-  if (!tmp)
-    tmp = env_proxy;
-  else if (strlen (tmp) >= 3)
+  if (tmp && strlen (tmp) >= 3)
     env_proxy = tmp + 3;
   else
     return FALSE;
@@ -226,12 +224,9 @@ set_icon_error (xfceweather_data *data)
 {
   GdkPixbuf   *icon;
   gint         height;
-  gint         size;
   gchar       *str;
   const gchar *txtsize;
 
-  size = data->panel_size;
-
   if (data->weatherdata)
     {
       xml_weather_free (data->weatherdata);


More information about the Xfce4-commits mailing list