diff options
author | Milan Crha <mcrha@redhat.com> | 2012-11-30 22:29:34 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-11-30 22:30:45 +0800 |
commit | ab3f65a15e1b6fe5bdf488e6e879899e283ccc43 (patch) | |
tree | ac594d423506e1fa1d47fbf057a1ec71947bf7a5 /calendar | |
parent | 1eb7481305d0feda31538d072c206aab5dbdeabd (diff) | |
download | gsoc2013-evolution-ab3f65a15e1b6fe5bdf488e6e879899e283ccc43.tar.gz gsoc2013-evolution-ab3f65a15e1b6fe5bdf488e6e879899e283ccc43.tar.zst gsoc2013-evolution-ab3f65a15e1b6fe5bdf488e6e879899e283ccc43.zip |
Address couple issues found by a Coverity scan
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/alarm-notify/alarm-notify-dialog.c | 2 | ||||
-rw-r--r-- | calendar/alarm-notify/alarm-queue.c | 3 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 3 | ||||
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.c | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/schedule-page.c | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.c | 2 | ||||
-rw-r--r-- | calendar/gui/e-cell-date-edit-text.c | 3 | ||||
-rw-r--r-- | calendar/gui/e-day-view-time-item.c | 10 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 7 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 2 | ||||
-rw-r--r-- | calendar/gui/itip-utils.c | 2 | ||||
-rw-r--r-- | calendar/gui/print.c | 23 |
12 files changed, 35 insertions, 26 deletions
diff --git a/calendar/alarm-notify/alarm-notify-dialog.c b/calendar/alarm-notify/alarm-notify-dialog.c index e59080d14e..3bb705a772 100644 --- a/calendar/alarm-notify/alarm-notify-dialog.c +++ b/calendar/alarm-notify/alarm-notify-dialog.c @@ -434,7 +434,7 @@ add_alarm_to_notified_alarms_dialog (AlarmNotificationsDialog *na, AlarmNotifyFunc func, gpointer func_data) { - GtkTreeIter iter; + GtkTreeIter iter = { 0 }; GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (na->treeview)); AlarmFuncInfo *funcinfo = NULL; gchar *to_display = NULL, *start, *end, *str_time; diff --git a/calendar/alarm-notify/alarm-queue.c b/calendar/alarm-notify/alarm-queue.c index e152b59056..18bd49e6e0 100644 --- a/calendar/alarm-notify/alarm-queue.c +++ b/calendar/alarm-notify/alarm-queue.c @@ -1139,7 +1139,8 @@ on_dialog_objs_removed_async (struct _query_msg *msg) if (!id) continue; - if (g_strcmp0 (id->uid, our_id->uid) == 0 && + if (tray_data && + g_strcmp0 (id->uid, our_id->uid) == 0 && g_strcmp0 (id->rid, our_id->rid) == 0) { tray_data->cqa = NULL; tray_data->alarm_id = NULL; diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index cb4698fcf3..12931cee09 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -779,6 +779,9 @@ update_time (EventPage *epage, end_tt = &implied_tt; *end_tt = *start_tt; icaltime_adjust (end_tt, 1, 0, 0, 0); + } else if (!end_tt) { + end_tt = &implied_tt; + *end_tt = *start_tt; } if (start_tt->is_date && end_tt->is_date) { diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index d04d490b3d..77862c6584 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -992,7 +992,7 @@ fill_component (RecurrencePage *rpage, if (gtk_widget_get_visible (priv->ending_combo) && gtk_widget_get_sensitive (priv->ending_combo) && e_dialog_combo_box_get (priv->ending_combo, ending_types_map) == ENDING_UNTIL) { /* check whether the "until" date is in the future */ - struct icaltimetype tt; + struct icaltimetype tt = icaltime_null_time (); gboolean ok = TRUE; if (e_date_edit_get_date (E_DATE_EDIT (priv->ending_date_edit), &tt.year, &tt.month, &tt.day)) { diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index eafdb91744..516a973751 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -143,6 +143,8 @@ update_time (SchedulePage *spage, if (!end_date->value && start_tt.is_date) { end_tt = start_tt; icaltime_adjust (&end_tt, 1, 0, 0, 0); + } else if (!end_date->value) { + end_tt = start_tt; } else { end_tt = *end_date->value; } diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 49f86212c0..ebf279cb22 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -2108,7 +2108,7 @@ task_page_select_organizer (TaskPage *tpage, gint ii; /* Treat an empty backend address as NULL. */ - if (backend_address == NULL && *backend_address == '\0') + if (backend_address != NULL && *backend_address == '\0') backend_address = NULL; default_address = priv->fallback_address; diff --git a/calendar/gui/e-cell-date-edit-text.c b/calendar/gui/e-cell-date-edit-text.c index 3076c537a0..82d94eff11 100644 --- a/calendar/gui/e-cell-date-edit-text.c +++ b/calendar/gui/e-cell-date-edit-text.c @@ -186,6 +186,7 @@ cell_date_edit_text_set_value (ECellText *cell, ECellDateEditText *ecd = E_CELL_DATE_EDIT_TEXT (cell); ETimeParseStatus status; struct tm tmp_tm; + ECellDateEditValue dv; ECellDateEditValue *value; gboolean is_date = TRUE; @@ -205,8 +206,6 @@ cell_date_edit_text_set_value (ECellText *cell, if (status == E_TIME_PARSE_NONE) { value = NULL; } else { - ECellDateEditValue dv; - dv.tt = icaltime_null_time (); dv.tt.year = tmp_tm.tm_year + 1900; diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c index 506292d80f..3a8284be03 100644 --- a/calendar/gui/e-day-view-time-item.c +++ b/calendar/gui/e-day-view-time-item.c @@ -500,9 +500,7 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item, cairo_restore (cr); if (show_midnight_date) { - strcpy (buffer, midnight_day); - strcat (buffer, " "); - strcat (buffer, midnight_month); + g_snprintf (buffer, sizeof (buffer), "%s %s", midnight_day, midnight_month); } else if (e_cal_model_get_use_24_hour_format (model)) { g_snprintf ( buffer, sizeof (buffer), "%i:%02i", @@ -540,7 +538,7 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item, cairo_save (cr); gdk_cairo_set_source_color (cr, &dark); if (show_midnight_date) - strcpy (buffer, midnight_day); + g_snprintf (buffer, sizeof (buffer), "%s", midnight_day); else g_snprintf ( buffer, sizeof (buffer), "%i", @@ -590,10 +588,10 @@ edvti_draw_zone (GnomeCanvasItem *canvas_item, /* In 12-hour format we display 'am' or 'pm' * instead of '00'. */ if (show_midnight_date) - strcpy (buffer, midnight_month); + g_snprintf (buffer, sizeof (buffer), "%s", midnight_month); else if (minute == 0 && !e_cal_model_get_use_24_hour_format (model)) { - strcpy (buffer, suffix); + g_snprintf (buffer, sizeof (buffer), "%s", suffix); } else { g_snprintf ( buffer, sizeof (buffer), diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 306755ef39..0f0448d3df 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -2014,6 +2014,9 @@ e_day_view_foreach_event_with_uid (EDayView *day_view, gint day, event_num; const gchar *u; + if (!uid) + return; + for (day = 0; day < day_view->days_shown; day++) { for (event_num = day_view->events[day]->len - 1; event_num >= 0; @@ -2025,7 +2028,7 @@ e_day_view_foreach_event_with_uid (EDayView *day_view, continue; u = icalcomponent_get_uid (event->comp_data->icalcomp); - if (uid && !strcmp (uid, u)) { + if (u && !strcmp (uid, u)) { if (!(*callback) (day_view, day, event_num, data)) return; } @@ -7888,7 +7891,7 @@ e_day_view_update_main_canvas_drag (EDayView *day_view, num_rows = end_row - start_row + 1; } - if (day_view->drag_event_day == day && start_row == row) { + if (event && day_view->drag_event_day == day && start_row == row) { cols_in_row = day_view->cols_per_row[day][row]; start_col = event->start_row_or_col; num_columns = event->num_columns; diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 83c41499cf..9a3e92de24 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -4702,6 +4702,8 @@ e_week_view_on_jump_button_event (GnomeCanvasItem *item, break; } + g_return_val_if_fail (day < E_WEEK_VIEW_MAX_WEEKS * 7, FALSE); + if (focus_event->in) { week_view->focused_jump_button = day; pixbuf = gdk_pixbuf_new_from_xpm_data ((const gchar **) jump_xpm_focused); diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index e77f88aa24..1af60b8192 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -945,7 +945,7 @@ comp_subject (ESourceRegistry *registry, g_free (sender); } - if (alist != NULL) { + if (a != NULL) { switch (a->status) { case ICAL_PARTSTAT_ACCEPTED: diff --git a/calendar/gui/print.c b/calendar/gui/print.c index 85a293e6fa..b4e6ff2133 100644 --- a/calendar/gui/print.c +++ b/calendar/gui/print.c @@ -672,32 +672,33 @@ format_date (struct tm *tm, gchar *buffer, gint bufflen) { - gchar fmt[64]; + GString *fmt = g_string_new (""); - fmt[0] = 0; if (flags & DATE_DAYNAME) { - strcat (fmt, "%A"); + g_string_append (fmt, "%A"); } if (flags & DATE_DAY) { if (flags & DATE_DAYNAME) - strcat (fmt, " "); - strcat (fmt, gettext (days[tm->tm_mday - 1])); + g_string_append (fmt, " "); + g_string_append (fmt, gettext (days[tm->tm_mday - 1])); } if (flags & DATE_MONTH) { if (flags & (DATE_DAY | DATE_DAYNAME)) - strcat (fmt, " "); - strcat (fmt, "%B"); + g_string_append (fmt, " "); + g_string_append (fmt, "%B"); if ((flags & (DATE_DAY | DATE_YEAR)) == (DATE_DAY | DATE_YEAR)) - strcat (fmt, ","); + g_string_append (fmt, ","); } if (flags & DATE_YEAR) { if (flags & (DATE_DAY | DATE_DAYNAME | DATE_MONTH)) - strcat (fmt, " "); - strcat (fmt, "%Y"); + g_string_append (fmt, " "); + g_string_append (fmt, "%Y"); } - e_utf8_strftime (buffer, bufflen, fmt, tm); + e_utf8_strftime (buffer, bufflen, fmt->str, tm); buffer[bufflen - 1] = '\0'; + g_string_free (fmt, TRUE); + return buffer; } |