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 | |
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
41 files changed, 146 insertions, 105 deletions
diff --git a/addressbook/gui/merging/eab-contact-compare.c b/addressbook/gui/merging/eab-contact-compare.c index 7f5dfe1564..7c30b28da8 100644 --- a/addressbook/gui/merging/eab-contact-compare.c +++ b/addressbook/gui/merging/eab-contact-compare.c @@ -679,7 +679,7 @@ use_common_book_client (EBookClient *book_client, EContact *contact = info->contact; EContactName *contact_name; GList *contact_email; - gchar *query_parts[MAX_QUERY_PARTS]; + gchar *query_parts[MAX_QUERY_PARTS + 1]; gint p = 0; gchar *contact_file_as, *qj; EBookQuery *query = NULL; diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 9d7b1826c7..5206041d29 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -1439,7 +1439,7 @@ e_addressbook_view_delete_selection (EAddressbookView *view, } /* Sets the cursor, at the row after the deleted row */ - if (GAL_IS_VIEW_MINICARD (gal_view) && row != 0) { + if (GAL_IS_VIEW_MINICARD (gal_view) && row != 0 && selection_model) { select = e_sorter_model_to_sorted (selection_model->sorter, row); /* Sets the cursor, before the deleted row if its the last row */ diff --git a/addressbook/gui/widgets/ea-minicard.c b/addressbook/gui/widgets/ea-minicard.c index 8a93265d7f..cfa35db349 100644 --- a/addressbook/gui/widgets/ea-minicard.c +++ b/addressbook/gui/widgets/ea-minicard.c @@ -140,7 +140,7 @@ ea_minicard_get_name (AtkObject *accessible) { #define BUFFERSIZE 500 - static gchar name[BUFFERSIZE]; + static gchar name[BUFFERSIZE + 1]; GString *new_str = g_string_new (NULL); gchar *string; EMinicard *card; @@ -167,6 +167,7 @@ ea_minicard_get_name (AtkObject *accessible) /* if there exist no enough space for remain info, return */ if (new_str->len >= BUFFERSIZE) { strncpy (name, new_str->str, BUFFERSIZE); + name[BUFFERSIZE] = '\0'; return name; } 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; } diff --git a/e-util/e-config.c b/e-util/e-config.c index 7a5aff07e1..fc30eea90e 100644 --- a/e-util/e-config.c +++ b/e-util/e-config.c @@ -1054,7 +1054,7 @@ ec_rebuild (EConfig *emp) case E_CONFIG_ITEM: case E_CONFIG_ITEM_TABLE: /* generated sections never retain their widgets on a rebuild */ - if (sectionnode->item->factory == NULL) + if (sectionnode && sectionnode->item->factory == NULL) wn->widget = NULL; /* ITEMs are called with the section parent. diff --git a/em-format/e-mail-formatter-message-rfc822.c b/em-format/e-mail-formatter-message-rfc822.c index 614efca6df..50e3a7bec7 100644 --- a/em-format/e-mail-formatter-message-rfc822.c +++ b/em-format/e-mail-formatter-message-rfc822.c @@ -87,7 +87,7 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension, iter = e_mail_part_list_get_iter (context->parts, part->id); end = g_strconcat (part->id, ".end", NULL); - for (iter = iter->next; iter; iter = g_slist_next (iter)) { + for (iter = g_slist_next (iter); iter; iter = g_slist_next (iter)) { EMailPart * p = iter->data; if (!p) continue; diff --git a/em-format/e-mail-formatter.c b/em-format/e-mail-formatter.c index 7d0f589b8a..9ac8cf7678 100644 --- a/em-format/e-mail-formatter.c +++ b/em-format/e-mail-formatter.c @@ -169,6 +169,9 @@ mail_formatter_run (EMailFormatter *formatter, iter = iter->next; } while (iter); + + if (!iter) + break; } } } @@ -845,8 +848,9 @@ e_mail_formatter_format (EMailFormatter *formatter, g_simple_async_result_set_check_cancellable (simple, cancellable); - if (!parts && callback) { - callback (G_OBJECT (formatter), G_ASYNC_RESULT (simple), user_data); + if (!parts) { + if (callback) + callback (G_OBJECT (formatter), G_ASYNC_RESULT (simple), user_data); g_object_unref (simple); return; } diff --git a/em-format/e-mail-parser.c b/em-format/e-mail-parser.c index 8f007a07f7..608bc467da 100644 --- a/em-format/e-mail-parser.c +++ b/em-format/e-mail-parser.c @@ -466,7 +466,7 @@ e_mail_parser_parse_part_as (EMailParser *parser, GList *iter; EMailExtensionRegistry *reg; EMailParserClass *parser_class; - GSList *part_list; + GSList *part_list = NULL; gchar *as_mime_type; if (g_cancellable_is_cancelled (cancellable)) diff --git a/em-format/e-mail-part-utils.c b/em-format/e-mail-part-utils.c index b1c514d49e..6f8013d7a8 100644 --- a/em-format/e-mail-part-utils.c +++ b/em-format/e-mail-part-utils.c @@ -444,6 +444,7 @@ e_mail_part_build_uri (CamelFolder *folder, } default: g_warning ("Invalid param type %s", g_type_name (type)); + va_end (ap); return NULL; } diff --git a/filter/e-filter-code.c b/filter/e-filter-code.c index 394f682b60..0352703638 100644 --- a/filter/e-filter-code.c +++ b/filter/e-filter-code.c @@ -41,7 +41,7 @@ filter_code_build_code (EFilterElement *element, { GList *l; EFilterInput *fi = (EFilterInput *) element; - gboolean is_rawcode = fi && fi->type && g_str_equal (fi->type, "rawcode"); + gboolean is_rawcode = fi->type && g_str_equal (fi->type, "rawcode"); if (!is_rawcode) g_string_append (out, "(match-all "); diff --git a/libemail-engine/mail-ops.c b/libemail-engine/mail-ops.c index 020ef339d3..bc49261c31 100644 --- a/libemail-engine/mail-ops.c +++ b/libemail-engine/mail-ops.c @@ -235,7 +235,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m, CamelStore *parent_store; CamelUIDCache *cache = NULL; CamelURL *url; - gboolean keep; + gboolean keep = TRUE; gboolean delete_fetched; gboolean is_local_delivery = FALSE; const gchar *uid = NULL; diff --git a/libemail-utils/mail-mt.c b/libemail-utils/mail-mt.c index 2a3f841f19..baf1476f82 100644 --- a/libemail-utils/mail-mt.c +++ b/libemail-utils/mail-mt.c @@ -590,6 +590,8 @@ do_call (struct _call_msg *m, break; } + va_end (ap); + if (g_cancellable_is_cancelled (cancellable)) { if (cancel_activity) cancel_activity (cancellable); @@ -602,12 +604,18 @@ do_call (struct _call_msg *m, e_flag_set (m->done); } +static void +do_free (struct _call_msg *msg) +{ + va_end (msg->ap); +} + static MailMsgInfo mail_call_info = { sizeof (struct _call_msg), (MailMsgDescFunc) NULL, (MailMsgExecFunc) do_call, (MailMsgDoneFunc) NULL, - (MailMsgFreeFunc) NULL + (MailMsgFreeFunc) do_free }; gpointer diff --git a/mail/e-mail-account-store.c b/mail/e-mail-account-store.c index acbce1f20c..8d8f867312 100644 --- a/mail/e-mail-account-store.c +++ b/mail/e-mail-account-store.c @@ -1251,7 +1251,7 @@ e_mail_account_store_enable_service (EMailAccountStore *store, CamelService *service) { GtkTreeIter iter; - gboolean proceed; + gboolean proceed = FALSE; g_return_if_fail (E_IS_MAIL_ACCOUNT_STORE (store)); g_return_if_fail (CAMEL_IS_SERVICE (service)); @@ -1279,7 +1279,7 @@ e_mail_account_store_disable_service (EMailAccountStore *store, CamelService *service) { GtkTreeIter iter; - gboolean proceed; + gboolean proceed = FALSE; g_return_if_fail (E_IS_MAIL_ACCOUNT_STORE (store)); g_return_if_fail (CAMEL_IS_SERVICE (service)); diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 615857eda1..7793f877d0 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -1912,7 +1912,7 @@ tree_drag_data_get (GtkWidget *widget, CamelFolder *folder; CamelStore *store; GtkTreeIter iter; - gchar *folder_name; + gchar *folder_name = NULL; gchar *folder_uri; if (!priv->drag_row || !(src_path = diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index d689c5c2bc..c211c03c44 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -634,6 +634,8 @@ em_folder_utils_create_folder (GtkWindow *parent, goto exit; } + g_return_if_fail (folder_name != NULL); + /* HACK: we need to create vfolders using the vfolder editor */ if (CAMEL_IS_VEE_STORE (store)) { EFilterRule *rule; diff --git a/mail/message-list.c b/mail/message-list.c index 959193a653..473cc4faec 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -3568,7 +3568,7 @@ build_subtree_diff (MessageList *ml, /* bigger run of old nodes - must be nodes to remove */ if (ai) { at = ap; - while (at != ai) { + while (at != NULL && at != ai) { t (printf ("removing old node 0\n")); tmp = e_tree_model_node_get_next (etm, at); remove_node_diff (ml, at, 0); @@ -4732,7 +4732,7 @@ regen_list_exec (struct _regen_list_msg *m, } /* camel_folder_summary_prepare_fetch_all (m->folder->summary, NULL); */ - if (!g_cancellable_is_cancelled (cancellable)) { + if (!g_cancellable_is_cancelled (cancellable) && uids) { /* update/build a new tree */ if (m->dotree) { ml_sort_uids_by_tree (m->ml, uids, cancellable); diff --git a/modules/mdn/evolution-mdn.c b/modules/mdn/evolution-mdn.c index 03abc00d24..7e7598895d 100644 --- a/modules/mdn/evolution-mdn.c +++ b/modules/mdn/evolution-mdn.c @@ -297,6 +297,8 @@ mdn_notify_sender (ESource *source, * hostname, then skip the part leading to '@' */ fake_msgid = camel_header_msgid_generate (); hostname = strchr (fake_msgid, '@'); + g_return_if_fail (hostname != NULL); + hostname++; /* Create toplevel container. */ diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index e691962f67..768d1b17c0 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -867,7 +867,7 @@ pst_import_folders (PstImporter *m, d_ptr = d_ptr->next; } else { - while (d_ptr != topitem && d_ptr->next == NULL) { + while (d_ptr && d_ptr != topitem && d_ptr->next == NULL) { if (m->folder) { g_object_unref (m->folder); m->folder = NULL; diff --git a/plugins/publish-calendar/publish-calendar.c b/plugins/publish-calendar/publish-calendar.c index 9a06c45b38..7175050aff 100644 --- a/plugins/publish-calendar/publish-calendar.c +++ b/plugins/publish-calendar/publish-calendar.c @@ -279,7 +279,7 @@ mount_ready_cb (GObject *source_object, g_file_mount_enclosing_volume_finish (G_FILE (source_object), result, &error); if (error) { - error_queue_add (g_strdup_printf (_("Mount of %s failed:"), ms->uri->location), error); + error_queue_add (g_strdup_printf (_("Mount of %s failed:"), ms ? ms->uri->location : "???"), error); if (ms) g_object_unref (ms->mount_op); diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c index 0738e475c2..5416a8f8f9 100644 --- a/plugins/templates/templates.c +++ b/plugins/templates/templates.c @@ -530,9 +530,7 @@ e_plugin_lib_get_configure_widget (EPlugin *epl) g_strfreev (temp); } - if (clue_list) { - g_strfreev (clue_list); - } + g_strfreev (clue_list); /* Add the list here */ diff --git a/smime/gui/certificate-viewer.c b/smime/gui/certificate-viewer.c index af1b3226ce..9f140cadaa 100644 --- a/smime/gui/certificate-viewer.c +++ b/smime/gui/certificate-viewer.c @@ -268,8 +268,9 @@ fill_in_details (CertificateViewerData *cvm_data, ECert *cert) { GList *l; - GtkTreeIter *root = NULL; + GtkTreeIter root; GtkTreeSelection *selection; + gboolean root_set = FALSE; /* hook up all the hierarchy tree foo */ cvm_data->hierarchy_store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_OBJECT); @@ -324,14 +325,15 @@ fill_in_details (CertificateViewerData *cvm_data, if (!str) str = e_cert_get_subject_name (c); - gtk_tree_store_insert (cvm_data->hierarchy_store, &new_iter, root, -1); + gtk_tree_store_insert (cvm_data->hierarchy_store, &new_iter, root_set ? &root : NULL, -1); gtk_tree_store_set ( cvm_data->hierarchy_store, &new_iter, 0, str, 1, c, -1); - root = &new_iter; + root = new_iter; + root_set = TRUE; } gtk_tree_view_expand_all (GTK_TREE_VIEW (cvm_data->hierarchy_tree)); diff --git a/widgets/menus/gal-view-etable.c b/widgets/menus/gal-view-etable.c index 01435f94d3..c259cc9004 100644 --- a/widgets/menus/gal-view-etable.c +++ b/widgets/menus/gal-view-etable.c @@ -236,9 +236,7 @@ gal_view_etable_construct (GalViewEtable *view, g_return_val_if_fail (GAL_IS_VIEW_ETABLE (view), NULL); g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (spec), NULL); - if (spec) - g_object_ref (spec); - view->spec = spec; + view->spec = g_object_ref (spec); if (view->state) g_object_unref (view->state); diff --git a/widgets/misc/e-send-options.c b/widgets/misc/e-send-options.c index 748f7b83b5..d84b8659e4 100644 --- a/widgets/misc/e-send-options.c +++ b/widgets/misc/e-send-options.c @@ -198,7 +198,7 @@ e_send_options_fill_widgets_with_data (ESendOptionsDialog *sod) else gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->delay_delivery), FALSE); - if (!gopts->delay_until || (!difftime (gopts->delay_until, tmp) < 0)) + if (!gopts->delay_until || difftime (gopts->delay_until, tmp) < 0) e_date_edit_set_time (E_DATE_EDIT (priv->delay_until), 0); else e_date_edit_set_time (E_DATE_EDIT (priv->delay_until), gopts->delay_until); diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index 4d685ae814..e871ac1dc0 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -889,7 +889,7 @@ ect_event (ECellView *ecell_view, return_val = TRUE; /* Fallthrough */ case GDK_KEY_RELEASE: - preedit_len = edit->preedit_length; + preedit_len = edit_display ? edit->preedit_length : 0; if (edit_display && edit->im_context && gtk_im_context_filter_keypress (\ edit->im_context, @@ -1798,7 +1798,7 @@ e_cell_text_commit_cb (GtkIMContext *context, ECellTextView *tv) { CellEdit *edit = tv->edit; - ETextEventProcessorCommand command; + ETextEventProcessorCommand command = { 0 }; if (g_utf8_validate (str, strlen (str), NULL)) { command.action = E_TEP_INSERT; @@ -2541,7 +2541,7 @@ paste_received (GtkClipboard *clipboard, edit = (CellEdit *) data; if (text && g_utf8_validate (text, strlen (text), NULL)) { - ETextEventProcessorCommand command; + ETextEventProcessorCommand command = { 0 }; command.action = E_TEP_INSERT; command.position = E_TEP_SELECTION; command.string = (gchar *) text; @@ -2603,7 +2603,7 @@ e_cell_text_set_selection (ECellView *cell_view, { ECellTextView *ectv; CellEdit *edit; - ETextEventProcessorCommand command1, command2; + ETextEventProcessorCommand command1 = { 0 }, command2 = { 0 }; g_return_val_if_fail (cell_view != NULL, FALSE); @@ -2688,7 +2688,7 @@ e_cell_text_copy_clipboard (ECellView *cell_view, { ECellTextView *ectv; CellEdit *edit; - ETextEventProcessorCommand command; + ETextEventProcessorCommand command = { 0 }; g_return_if_fail (cell_view != NULL); @@ -2722,7 +2722,7 @@ e_cell_text_paste_clipboard (ECellView *cell_view, { ECellTextView *ectv; CellEdit *edit; - ETextEventProcessorCommand command; + ETextEventProcessorCommand command = { 0 }; g_return_if_fail (cell_view != NULL); @@ -2756,7 +2756,7 @@ e_cell_text_delete_selection (ECellView *cell_view, { ECellTextView *ectv; CellEdit *edit; - ETextEventProcessorCommand command; + ETextEventProcessorCommand command = { 0 }; g_return_if_fail (cell_view != NULL); diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 602ef12e17..27f3116d26 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -742,15 +742,11 @@ static void etgc_compute_location (ETableGroup *etg, gint *x, gint *y, - gint *row, - gint *col) + gint *prow, + gint *pcol) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); - - if (row) - *row = -1; - if (col) - *col = -1; + gint row = -1, col = -1; *x -= GROUP_INDENT; *y -= TITLE_HEIGHT; @@ -761,11 +757,16 @@ etgc_compute_location (ETableGroup *etg, ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data; ETableGroup *child = child_node->child; - e_table_group_compute_location (child, x, y, row, col); - if ((*row != -1) && (*col != -1)) - return; + e_table_group_compute_location (child, x, y, &row, &col); + if (row != -1 && col != -1) + break; } } + + if (prow) + *prow = row; + if (pcol) + *pcol = col; } static void @@ -1395,23 +1396,25 @@ e_table_group_container_print_page (EPrintable *ep, cairo_clip (cr); cairo_restore (cr); - cairo_move_to (cr, 0, 0); - if (groupcontext->etgc->ecol->text) - string = g_strdup_printf ( - "%s : %s (%d item%s)", - groupcontext->etgc->ecol->text, - child_node->string, - (gint) child_node->count, - child_node->count == 1 ? "" : "s"); - else - string = g_strdup_printf ( - "%s (%d item%s)", - child_node->string, - (gint) child_node->count, - child_node->count == 1 ? "" : "s"); - pango_layout_set_text (layout, string, -1); - pango_cairo_show_layout (cr, layout); - g_free (string); + if (child_node) { + cairo_move_to (cr, 0, 0); + if (groupcontext->etgc->ecol->text) + string = g_strdup_printf ( + "%s : %s (%d item%s)", + groupcontext->etgc->ecol->text, + child_node->string, + (gint) child_node->count, + child_node->count == 1 ? "" : "s"); + else + string = g_strdup_printf ( + "%s (%d item%s)", + child_node->string, + (gint) child_node->count, + child_node->count == 1 ? "" : "s"); + pango_layout_set_text (layout, string, -1); + pango_cairo_show_layout (cr, layout); + g_free (string); + } cairo_translate (cr, 2 * TEXT_AREA_HEIGHT, TEXT_AREA_HEIGHT); cairo_move_to (cr, 0, 0); diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c index d233a4d16f..2bdfddc949 100644 --- a/widgets/table/e-table-utils.c +++ b/widgets/table/e-table-utils.c @@ -127,11 +127,13 @@ et_col_spec_to_col (ETableColumnSpecification *col_spec, col_spec->priority); } - col->search = search; - if (col_spec->sortable && !strcmp (col_spec->sortable, "false")) - col->sortable = FALSE; - else - col->sortable = TRUE; + if (col) { + col->search = search; + if (col_spec->sortable && !strcmp (col_spec->sortable, "false")) + col->sortable = FALSE; + else + col->sortable = TRUE; + } g_free (title); } if (col && col_spec->compare_col != col_spec->model_col) diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 3f3351d840..78eef72746 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -1678,7 +1678,7 @@ et_real_construct (ETree *e_tree, g_object_unref (ete); - return e_tree != NULL; + return TRUE; } /** @@ -2319,7 +2319,9 @@ ETreePath e_tree_node_at_row (ETree *et, gint row) { - ETreePath path; + ETreePath path = { 0 }; + + g_return_val_if_fail (et != NULL, path); path = e_tree_table_adapter_node_at_row (et->priv->etta, row); @@ -2330,12 +2332,16 @@ gint e_tree_row_of_node (ETree *et, ETreePath path) { + g_return_val_if_fail (et != NULL, -1); + return e_tree_table_adapter_row_of_node (et->priv->etta, path); } gboolean e_tree_root_node_is_visible (ETree *et) { + g_return_val_if_fail (et != NULL, FALSE); + return e_tree_table_adapter_root_node_is_visible (et->priv->etta); } @@ -2363,6 +2369,8 @@ void e_tree_load_expanded_state (ETree *et, gchar *filename) { + g_return_if_fail (et != NULL); + e_tree_table_adapter_load_expanded_state (et->priv->etta, filename); } @@ -2393,18 +2401,24 @@ void e_tree_force_expanded_state (ETree *et, gint state) { + g_return_if_fail (et != NULL); + e_tree_table_adapter_force_expanded_state (et->priv->etta, state); } gint e_tree_row_count (ETree *et) { + g_return_val_if_fail (et != NULL, -1); + return e_table_model_row_count (E_TABLE_MODEL (et->priv->etta)); } GtkWidget * e_tree_get_tooltip (ETree *et) { + g_return_val_if_fail (et != NULL, NULL); + return E_CANVAS (et->priv->table_canvas)->tooltip_window; } diff --git a/widgets/table/gal-a11y-e-cell.c b/widgets/table/gal-a11y-e-cell.c index d42aa6425f..3972c2de16 100644 --- a/widgets/table/gal-a11y-e-cell.c +++ b/widgets/table/gal-a11y-e-cell.c @@ -350,20 +350,17 @@ gal_a11y_e_cell_remove_action_by_name (GalA11yECell *cell, const gchar *action_name) { GList *list_node; - gboolean action_found= FALSE; g_return_val_if_fail (GAL_A11Y_IS_E_CELL (cell), FALSE); - for (list_node = cell->action_list; list_node && !action_found; - list_node = list_node->next) { - if (!g_ascii_strcasecmp ( - ((ActionInfo *)(list_node->data))->name, - action_name)) { - action_found = TRUE; + + for (list_node = cell->action_list; list_node; list_node = list_node->next) { + if (!g_ascii_strcasecmp (((ActionInfo *)(list_node->data))->name, action_name)) { break; } } - g_return_val_if_fail (action_found, FALSE); + g_return_val_if_fail (list_node != NULL, FALSE); + _gal_a11y_e_cell_destroy_action_info (list_node->data, NULL); cell->action_list = g_list_remove_link (cell->action_list, list_node); diff --git a/widgets/text/e-reflow.c b/widgets/text/e-reflow.c index e8304e4b38..350550fd80 100644 --- a/widgets/text/e-reflow.c +++ b/widgets/text/e-reflow.c @@ -373,7 +373,7 @@ reflow_columns (EReflow *reflow) reflow->columns = g_renew (int, reflow->columns, column_count); column_count--; - for (; column_count > column_start; column_count--) { + for (; list && column_count > column_start; column_count--) { GSList *to_free; reflow->columns[column_count] = GPOINTER_TO_INT (list->data); to_free = list; diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c index e1a7ee8526..5027b3a3f7 100644 --- a/widgets/text/e-text-model.c +++ b/widgets/text/e-text-model.c @@ -573,7 +573,7 @@ e_text_model_get_nth_object_bounds (ETextModel *model, if (start) *start = g_utf8_pointer_to_offset (txt, obj); if (end) - *end = *start + len; + *end = (start ? *start : 0) + len; } gint |