Commit 8557b5e2 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

Reorganize to avoid a possible NULL pointer dereference. (Coverity)

2006-04-12  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_get_neighbor_sizes):
	Reorganize to avoid a possible NULL pointer dereference.  (Coverity)
parent 6afcd450
2006-04-12 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_get_neighbor_sizes):
Reorganize to avoid a possible NULL pointer dereference. (Coverity)
* gtk/gtknotebook.c (gtk_notebook_page_allocate): Reorganize
to avoid a possible NULL dereference. (Coverity)
......
2006-04-12 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_get_neighbor_sizes):
Reorganize to avoid a possible NULL pointer dereference. (Coverity)
* gtk/gtknotebook.c (gtk_notebook_page_allocate): Reorganize
to avoid a possible NULL dereference. (Coverity)
......
......@@ -3554,68 +3554,43 @@ _gtk_tree_view_column_get_neighbor_sizes (GtkTreeViewColumn *column,
gint *right)
{
GList *list;
gint *rtl_left, *rtl_right;
GtkTreeViewColumnCellInfo *info;
gint l, r;
gboolean rtl;
if (gtk_widget_get_direction (GTK_WIDGET (column->tree_view)) == GTK_TEXT_DIR_RTL)
{
rtl_left = right;
rtl_right = left;
}
else
{
rtl_left = left;
rtl_right = right;
}
l = r = 0;
if (rtl_left)
{
*rtl_left = 0;
list = gtk_tree_view_column_cell_first (column);
list = gtk_tree_view_column_cell_first (column);
for (; list; list = gtk_tree_view_column_cell_next (column, list))
{
GtkTreeViewColumnCellInfo *info =
(GtkTreeViewColumnCellInfo *)list->data;
if (info->cell == cell)
break;
while (list)
{
info = (GtkTreeViewColumnCellInfo *)list->data;
list = gtk_tree_view_column_cell_next (column, list);
if (info->cell->visible)
*rtl_left += info->real_width;
}
if (info->cell == cell)
break;
if (info->cell->visible)
l += info->real_width;
}
if (rtl_right)
while (list)
{
GList *next;
*rtl_right = 0;
list = gtk_tree_view_column_cell_first (column);
for (; list; list = gtk_tree_view_column_cell_next (column, list))
{
GtkTreeViewColumnCellInfo *info =
(GtkTreeViewColumnCellInfo *)list->data;
info = (GtkTreeViewColumnCellInfo *)list->data;
list = gtk_tree_view_column_cell_next (column, list);
if (info->cell == cell)
break;
}
if (info->cell->visible)
r += info->real_width;
}
/* skip cell */
next = gtk_tree_view_column_cell_next (column, list);
if (list && next)
{
list = next;
for ( ; list; list = gtk_tree_view_column_cell_next (column, list))
{
GtkTreeViewColumnCellInfo *info =
(GtkTreeViewColumnCellInfo *)list->data;
rtl = (gtk_widget_get_direction (GTK_WIDGET (column->tree_view)) == GTK_TEXT_DIR_RTL);
if (left)
*left = rtl ? r : l;
if (info->cell->visible)
*rtl_right += info->real_width;
}
}
}
if (right)
*right = rtl ? l : r;
}
/**
......
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