From f50fed40981e8d2783be743dfc4149bba01e7343 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Tue, 20 Jul 1999 21:59:11 +0000 Subject: [PATCH] convert allocation-> width/height to (gint) before calculations and check Tue Jul 20 23:29:48 1999 Tim Janik * gtk/gtknotebook.c (gtk_notebook_page_allocate): convert allocation-> width/height to (gint) before calculations and check against < 0 to avoid guint wraparounds. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-0 | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-2 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtknotebook.c | 36 +++++++++++++++++------------------- 8 files changed, 59 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index cabe51cd56..41ccfe2c1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Jul 20 23:29:48 1999 Tim Janik + + * gtk/gtknotebook.c (gtk_notebook_page_allocate): convert allocation-> + width/height to (gint) before calculations and check against < 0 to + avoid guint wraparounds. + Sun Jul 18 00:35:49 1999 Tim Janik * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index cabe51cd56..41ccfe2c1e 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,9 @@ +Tue Jul 20 23:29:48 1999 Tim Janik + + * gtk/gtknotebook.c (gtk_notebook_page_allocate): convert allocation-> + width/height to (gint) before calculations and check against < 0 to + avoid guint wraparounds. + Sun Jul 18 00:35:49 1999 Tim Janik * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index cabe51cd56..41ccfe2c1e 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Tue Jul 20 23:29:48 1999 Tim Janik + + * gtk/gtknotebook.c (gtk_notebook_page_allocate): convert allocation-> + width/height to (gint) before calculations and check against < 0 to + avoid guint wraparounds. + Sun Jul 18 00:35:49 1999 Tim Janik * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index cabe51cd56..41ccfe2c1e 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +Tue Jul 20 23:29:48 1999 Tim Janik + + * gtk/gtknotebook.c (gtk_notebook_page_allocate): convert allocation-> + width/height to (gint) before calculations and check against < 0 to + avoid guint wraparounds. + Sun Jul 18 00:35:49 1999 Tim Janik * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index cabe51cd56..41ccfe2c1e 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Tue Jul 20 23:29:48 1999 Tim Janik + + * gtk/gtknotebook.c (gtk_notebook_page_allocate): convert allocation-> + width/height to (gint) before calculations and check against < 0 to + avoid guint wraparounds. + Sun Jul 18 00:35:49 1999 Tim Janik * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index cabe51cd56..41ccfe2c1e 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Tue Jul 20 23:29:48 1999 Tim Janik + + * gtk/gtknotebook.c (gtk_notebook_page_allocate): convert allocation-> + width/height to (gint) before calculations and check against < 0 to + avoid guint wraparounds. + Sun Jul 18 00:35:49 1999 Tim Janik * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index cabe51cd56..41ccfe2c1e 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Tue Jul 20 23:29:48 1999 Tim Janik + + * gtk/gtknotebook.c (gtk_notebook_page_allocate): convert allocation-> + width/height to (gint) before calculations and check against < 0 to + avoid guint wraparounds. + Sun Jul 18 00:35:49 1999 Tim Janik * gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 45c748f399..f0ea77e1e6 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -3057,16 +3057,14 @@ gtk_notebook_page_allocate (GtkNotebook *notebook, { case GTK_POS_TOP: width = widget->allocation.width; - height = MAX (page->allocation.height, allocation->height) + - ythickness; + height = MAX (page->allocation.height, allocation->height) + ythickness; x = 0; y = border_width; break; case GTK_POS_BOTTOM: width = widget->allocation.width + xthickness; - height = MAX (page->allocation.height, allocation->height) + - ythickness; + height = MAX (page->allocation.height, allocation->height) + ythickness; x = 0; y = widget->allocation.height - height - border_width; break; @@ -3100,12 +3098,14 @@ gtk_notebook_page_allocate (GtkNotebook *notebook, case GTK_POS_TOP: page->allocation.y += ythickness; case GTK_POS_BOTTOM: - page->allocation.height -= ythickness; + if (page->allocation.height > ythickness) + page->allocation.height -= ythickness; break; case GTK_POS_LEFT: page->allocation.x += xthickness; case GTK_POS_RIGHT: - page->allocation.width -= xthickness; + if (page->allocation.width > xthickness) + page->allocation.width -= xthickness; break; } } @@ -3119,8 +3119,8 @@ gtk_notebook_page_allocate (GtkNotebook *notebook, { child_allocation.x = (xthickness + FOCUS_WIDTH + notebook->tab_hborder); - child_allocation.width = (page->allocation.width - - 2 * child_allocation.x); + child_allocation.width = MAX (1, (((gint) page->allocation.width) - + 2 * child_allocation.x)); child_allocation.x += page->allocation.x; } else @@ -3134,8 +3134,8 @@ gtk_notebook_page_allocate (GtkNotebook *notebook, page->allocation.y); if (notebook->tab_pos == GTK_POS_TOP) child_allocation.y += ythickness; - child_allocation.height = (page->allocation.height - ythickness - - 2 * (notebook->tab_vborder + FOCUS_WIDTH)); + child_allocation.height = MAX (1, (((gint) page->allocation.height) - ythickness - + 2 * (notebook->tab_vborder + FOCUS_WIDTH))); break; case GTK_POS_LEFT: case GTK_POS_RIGHT: @@ -3143,23 +3143,21 @@ gtk_notebook_page_allocate (GtkNotebook *notebook, if (page->fill) { child_allocation.y = ythickness + padding; - child_allocation.height = (page->allocation.height - - 2 * child_allocation.y); + child_allocation.height = MAX (1, (((gint) page->allocation.height) - + 2 * child_allocation.y)); child_allocation.y += page->allocation.y; } else { - child_allocation.y = (page->allocation.y + - (page->allocation.height - - tab_requisition.height) / 2); + child_allocation.y = (page->allocation.y + (page->allocation.height - + tab_requisition.height) / 2); child_allocation.height = tab_requisition.height; } - child_allocation.x = (page->allocation.x + notebook->tab_hborder + - FOCUS_WIDTH); + child_allocation.x = page->allocation.x + notebook->tab_hborder + FOCUS_WIDTH; if (notebook->tab_pos == GTK_POS_LEFT) child_allocation.x += xthickness; - child_allocation.width = (page->allocation.width - xthickness - - 2 * (notebook->tab_hborder + FOCUS_WIDTH)); + child_allocation.width = MAX (1, (((gint) page->allocation.width) - xthickness - + 2 * (notebook->tab_hborder + FOCUS_WIDTH))); break; }