forked from AuroraMiddleware/gtk
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)
This commit is contained in:
parent
6afcd45024
commit
8557b5e2d7
@ -1,5 +1,8 @@
|
||||
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)
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
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)
|
||||
l = r = 0;
|
||||
|
||||
list = gtk_tree_view_column_cell_first (column);
|
||||
|
||||
while (list)
|
||||
{
|
||||
rtl_left = right;
|
||||
rtl_right = left;
|
||||
}
|
||||
else
|
||||
{
|
||||
rtl_left = left;
|
||||
rtl_right = right;
|
||||
info = (GtkTreeViewColumnCellInfo *)list->data;
|
||||
|
||||
list = gtk_tree_view_column_cell_next (column, list);
|
||||
|
||||
if (info->cell == cell)
|
||||
break;
|
||||
|
||||
if (info->cell->visible)
|
||||
l += info->real_width;
|
||||
}
|
||||
|
||||
if (rtl_left)
|
||||
while (list)
|
||||
{
|
||||
*rtl_left = 0;
|
||||
list = gtk_tree_view_column_cell_first (column);
|
||||
info = (GtkTreeViewColumnCellInfo *)list->data;
|
||||
|
||||
list = gtk_tree_view_column_cell_next (column, list);
|
||||
|
||||
for (; list; list = gtk_tree_view_column_cell_next (column, list))
|
||||
{
|
||||
GtkTreeViewColumnCellInfo *info =
|
||||
(GtkTreeViewColumnCellInfo *)list->data;
|
||||
|
||||
if (info->cell == cell)
|
||||
break;
|
||||
|
||||
if (info->cell->visible)
|
||||
*rtl_left += info->real_width;
|
||||
}
|
||||
if (info->cell->visible)
|
||||
r += info->real_width;
|
||||
}
|
||||
|
||||
if (rtl_right)
|
||||
{
|
||||
GList *next;
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (column->tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
if (left)
|
||||
*left = rtl ? r : l;
|
||||
|
||||
*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;
|
||||
|
||||
if (info->cell == cell)
|
||||
break;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
if (info->cell->visible)
|
||||
*rtl_right += info->real_width;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (right)
|
||||
*right = rtl ? l : r;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user