aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-group-container.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-11-30 22:29:34 +0800
committerMilan Crha <mcrha@redhat.com>2012-11-30 22:30:45 +0800
commitab3f65a15e1b6fe5bdf488e6e879899e283ccc43 (patch)
treeac594d423506e1fa1d47fbf057a1ec71947bf7a5 /widgets/table/e-table-group-container.c
parent1eb7481305d0feda31538d072c206aab5dbdeabd (diff)
downloadgsoc2013-evolution-ab3f65a15e1b6fe5bdf488e6e879899e283ccc43.tar.gz
gsoc2013-evolution-ab3f65a15e1b6fe5bdf488e6e879899e283ccc43.tar.zst
gsoc2013-evolution-ab3f65a15e1b6fe5bdf488e6e879899e283ccc43.zip
Address couple issues found by a Coverity scan
Diffstat (limited to 'widgets/table/e-table-group-container.c')
-rw-r--r--widgets/table/e-table-group-container.c57
1 files changed, 30 insertions, 27 deletions
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);