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 /widgets | |
parent | 1eb7481305d0feda31538d072c206aab5dbdeabd (diff) | |
download | gsoc2013-evolution-ab3f65a15e1b6fe5bdf488e6e879899e283ccc43.tar gsoc2013-evolution-ab3f65a15e1b6fe5bdf488e6e879899e283ccc43.tar.gz gsoc2013-evolution-ab3f65a15e1b6fe5bdf488e6e879899e283ccc43.tar.bz2 gsoc2013-evolution-ab3f65a15e1b6fe5bdf488e6e879899e283ccc43.tar.lz gsoc2013-evolution-ab3f65a15e1b6fe5bdf488e6e879899e283ccc43.tar.xz gsoc2013-evolution-ab3f65a15e1b6fe5bdf488e6e879899e283ccc43.tar.zst gsoc2013-evolution-ab3f65a15e1b6fe5bdf488e6e879899e283ccc43.zip |
Address couple issues found by a Coverity scan
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/menus/gal-view-etable.c | 4 | ||||
-rw-r--r-- | widgets/misc/e-send-options.c | 2 | ||||
-rw-r--r-- | widgets/table/e-cell-text.c | 14 | ||||
-rw-r--r-- | widgets/table/e-table-group-container.c | 57 | ||||
-rw-r--r-- | widgets/table/e-table-utils.c | 12 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 18 | ||||
-rw-r--r-- | widgets/table/gal-a11y-e-cell.c | 13 | ||||
-rw-r--r-- | widgets/text/e-reflow.c | 2 | ||||
-rw-r--r-- | widgets/text/e-text-model.c | 2 |
9 files changed, 69 insertions, 55 deletions
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 |