Commit bf677ce8 authored by Harald Judt's avatar Harald Judt

Fix cppcheck test results.

parent 84b595ba
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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)) {
......
......@@ -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));
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
/*
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment