[Xfce4-commits] <xfce4-weather-plugin:master> Fix cppcheck test results.
Harald Judt
noreply at xfce.org
Mon Dec 10 19:58:02 CET 2012
Updating branch refs/heads/master
to bf677ce8060735744f29ae3578ddc256546cff6c (commit)
from 84b595ba41a2cdd9a1969469e7bec79abe5dfe1a (commit)
commit bf677ce8060735744f29ae3578ddc256546cff6c
Author: Harald Judt <h.judt at gmx.at>
Date: Mon Dec 10 19:24:39 2012 +0100
Fix cppcheck test results.
panel-plugin/weather-config.c | 7 ++-----
panel-plugin/weather-data.c | 5 ++---
panel-plugin/weather-debug.c | 8 +++-----
panel-plugin/weather-icon.c | 1 -
panel-plugin/weather-scrollbox.c | 2 +-
panel-plugin/weather-search.c | 3 +--
panel-plugin/weather-summary.c | 2 +-
panel-plugin/weather-translate.c | 6 +-----
panel-plugin/weather.c | 18 ++++--------------
9 files changed, 15 insertions(+), 37 deletions(-)
diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index 91d170f..30aef60 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -222,7 +222,7 @@ cb_lookup_altitude(SoupSession *session,
gpointer user_data)
{
xfceweather_dialog *dialog = (xfceweather_dialog *) user_data;
- xml_altitude *altitude = NULL;
+ xml_altitude *altitude;
gdouble alt;
altitude = (xml_altitude *)
@@ -248,7 +248,7 @@ cb_lookup_timezone(SoupSession *session,
gpointer user_data)
{
xfceweather_dialog *dialog = (xfceweather_dialog *) user_data;
- xml_timezone *timezone = NULL;
+ xml_timezone *timezone;
gint tz;
timezone = (xml_timezone *)
@@ -1002,9 +1002,6 @@ button_scrollbox_color_pressed(GtkWidget *button,
gpointer user_data)
{
xfceweather_dialog *dialog = (xfceweather_dialog *) user_data;
- GtkStyle *style;
- GdkColor color;
- gchar *colstr;
if (event->type != GDK_BUTTON_PRESS)
return FALSE;
diff --git a/panel-plugin/weather-data.c b/panel-plugin/weather-data.c
index 7e50a2c..d3b8a4d 100644
--- a/panel-plugin/weather-data.c
+++ b/panel-plugin/weather-data.c
@@ -415,8 +415,7 @@ make_combined_timeslice(xml_weather *wd,
const xml_time *interval,
const time_t *between_t)
{
- xml_time *comb, *start = NULL, *end = NULL;
- xml_location *combloc, *startloc, *endloc;
+ xml_time *comb, *start, *end;
gboolean ipol = (between_t != NULL) ? TRUE : FALSE;
guint i;
@@ -788,7 +787,7 @@ find_point_data(const xml_weather *wd,
const gdouble min_diff,
const gdouble max_diff)
{
- point_data_results *found = NULL;
+ point_data_results *found;
xml_time *timeslice;
guint i;
gdouble diff;
diff --git a/panel-plugin/weather-debug.c b/panel-plugin/weather-debug.c
index e879f8b..e3bc0b6 100644
--- a/panel-plugin/weather-debug.c
+++ b/panel-plugin/weather-debug.c
@@ -113,7 +113,6 @@ gchar *
weather_debug_strftime_t(const time_t t)
{
struct tm tm;
- gchar *res;
gchar str[20];
size_t size;
@@ -228,14 +227,14 @@ weather_dump_astrodata(const xml_astro *astro)
{
gchar *out, *sunrise, *sunset, *moonrise, *moonset;
+ if (!astro)
+ return g_strdup("No astronomical data.");
+
sunrise = weather_debug_strftime_t(astro->sunrise);
sunset = weather_debug_strftime_t(astro->sunset);
moonrise = weather_debug_strftime_t(astro->moonrise);
moonset = weather_debug_strftime_t(astro->moonset);
- if (!astro)
- return g_strdup("No astronomical data.");
-
out = g_strdup_printf("Astronomical data:\n"
" --------------------------------------------\n"
" sunrise: %s\n"
@@ -408,7 +407,6 @@ gchar *
weather_dump_plugindata(const plugin_data *data)
{
GString *out;
- GtkOrientation orientation, panel_orientation;
gchar *last_astro_update, *last_data_update, *last_conditions_update;
gchar *result;
diff --git a/panel-plugin/weather-icon.c b/panel-plugin/weather-icon.c
index 6422e12..f9c429f 100644
--- a/panel-plugin/weather-icon.c
+++ b/panel-plugin/weather-icon.c
@@ -46,7 +46,6 @@ get_icon(const icon_theme *theme,
GdkPixbuf *image = NULL;
const gchar* dir;
gchar *filename, *suffix = "";
- guint i;
g_assert(theme != NULL);
if (G_UNLIKELY(!theme)) {
diff --git a/panel-plugin/weather-scrollbox.c b/panel-plugin/weather-scrollbox.c
index 7104511..6f4dd79 100644
--- a/panel-plugin/weather-scrollbox.c
+++ b/panel-plugin/weather-scrollbox.c
@@ -380,7 +380,7 @@ void
gtk_scrollbox_set_color(GtkScrollbox *self,
const GdkColor color)
{
- PangoAttribute *pattr = NULL;
+ PangoAttribute *pattr;
g_return_if_fail(GTK_IS_SCROLLBOX(self));
diff --git a/panel-plugin/weather-search.c b/panel-plugin/weather-search.c
index 48991bd..d4b18fa 100644
--- a/panel-plugin/weather-search.c
+++ b/panel-plugin/weather-search.c
@@ -364,9 +364,8 @@ cb_geolocation(SoupSession *session,
{
geolocation_data *data = (geolocation_data *) user_data;
xml_geolocation *geo;
- gchar *full_loc, *p;
+ gchar *full_loc;
units_config *units;
- gsize length;
geo = (xml_geolocation *)
parse_xml_document(msg, (XmlParseFunc) parse_geolocation);
diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c
index 637c537..e827a55 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -254,7 +254,7 @@ static GtkWidget *
weather_summary_get_logo(plugin_data *data)
{
GtkWidget *image = gtk_image_new();
- GdkPixbuf *pixbuf = NULL;
+ GdkPixbuf *pixbuf;
gchar *path = get_logo_path();
pixbuf = gdk_pixbuf_new_from_file(path, NULL);
diff --git a/panel-plugin/weather-translate.c b/panel-plugin/weather-translate.c
index 06b9d6b..aae4c7b 100644
--- a/panel-plugin/weather-translate.c
+++ b/panel-plugin/weather-translate.c
@@ -240,14 +240,10 @@ translate_day(const gint weekday)
gchar *
translate_wind_direction(const gchar *wdir)
{
- gint wdir_len;
gchar *wdir_loc, *tmp, wdir_i[2];
guint i;
- if (wdir == NULL || (wdir_len = strlen(wdir)) < 1)
- return NULL;
-
- if (strchr(wdir, '/')) /* N/A */
+ if (wdir == NULL || strlen(wdir) < 1)
return NULL;
/*
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index bd829ee..aef99f5 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -198,7 +198,7 @@ get_cache_directory(void)
void
update_icon(plugin_data *data)
{
- GdkPixbuf *icon = NULL;
+ GdkPixbuf *icon;
xml_time *conditions;
gchar *str;
gint size;
@@ -298,8 +298,7 @@ update_current_conditions(plugin_data *data)
/* use exact 5 minute intervals for calculation */
time(&data->last_conditions_update);
now_tm = *localtime(&data->last_conditions_update);
- if (now_tm.tm_min % 5 < 5)
- now_tm.tm_min -= (now_tm.tm_min % 5);
+ now_tm.tm_min -= (now_tm.tm_min % 5);
if (now_tm.tm_min < 0)
now_tm.tm_min = 0;
now_tm.tm_sec = 0;
@@ -764,7 +763,6 @@ static gchar *
cache_file_strftime_t(const time_t t)
{
struct tm *tm;
- gchar *res;
gchar str[21];
size_t size;
@@ -1175,7 +1173,7 @@ weather_get_tooltip_text(const plugin_data *data)
{
xml_time *conditions;
struct tm *point_tm, *start_tm, *end_tm, *sunrise_tm, *sunset_tm;
- gchar *text, *sym, *symbol, *alt, *lat, *lon, *temp;
+ gchar *text, *sym, *alt, *temp;
gchar *windspeed, *windbeau, *winddir, *winddir_trans, *winddeg;
gchar *pressure, *humidity, *precipitations;
gchar *fog, *cloudiness, *sunval, *value;
@@ -1215,10 +1213,7 @@ weather_get_tooltip_text(const plugin_data *data)
sunval = g_strdup_printf("");
sym = get_data(conditions, data->units, SYMBOL, FALSE);
- DATA_AND_UNIT(symbol, SYMBOL);
DATA_AND_UNIT(alt, ALTITUDE);
- DATA_AND_UNIT(lat, LATITUDE);
- DATA_AND_UNIT(lon, LONGITUDE);
DATA_AND_UNIT(temp, TEMPERATURE);
DATA_AND_UNIT(windspeed, WIND_SPEED);
DATA_AND_UNIT(windbeau, WIND_BEAUFORT);
@@ -1272,8 +1267,7 @@ weather_get_tooltip_text(const plugin_data *data)
"<b>Pressure:</b> %s <b>Humidity:</b> %s\n"
"<b>Fog:</b> %s <b>Cloudiness:</b> %s\n\n"
"<span size=\"smaller\">%s</span>"),
- data->location_name,
- alt,
+ data->location_name, alt,
translate_desc(sym, data->night_time),
interval_start, interval_end,
precipitations,
@@ -1286,10 +1280,7 @@ weather_get_tooltip_text(const plugin_data *data)
}
g_free(sunval);
g_free(sym);
- g_free(symbol);
g_free(alt);
- g_free(lat);
- g_free(lon);
g_free(temp);
g_free(windspeed);
g_free(windbeau);
@@ -1350,7 +1341,6 @@ static plugin_data *
xfceweather_create_control(XfcePanelPlugin *plugin)
{
plugin_data *data = g_slice_new0(plugin_data);
- SoupMessage *msg;
SoupURI *soup_proxy_uri;
const gchar *proxy_uri;
GtkWidget *refresh;
More information about the Xfce4-commits
mailing list