From 52644b08e77ddb3c146556451982dd3ff53bc1ef Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 13 Jun 2002 20:14:43 +0000 Subject: [PATCH] Make interval unsigned to match g_timeout_source_new(). (#82624, Tim Thu Jun 13 16:12:04 2002 Owen Taylor * glib/gmain.c (struct _GTimeoutSource): Make interval unsigned to match g_timeout_source_new(). (#82624, Tim Janik.) * glib/gmain.c (g_timeout_prepare): Add some extra gymnastics to avoid signed/unisgned integer overflows. --- ChangeLog | 10 ++++++++++ ChangeLog.pre-2-10 | 10 ++++++++++ ChangeLog.pre-2-12 | 10 ++++++++++ ChangeLog.pre-2-2 | 10 ++++++++++ ChangeLog.pre-2-4 | 10 ++++++++++ ChangeLog.pre-2-6 | 10 ++++++++++ ChangeLog.pre-2-8 | 10 ++++++++++ glib/gmain.c | 6 +++--- 8 files changed, 73 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 421410672..eae4f3f76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Thu Jun 13 16:12:04 2002 Owen Taylor + + * glib/gmain.c (struct _GTimeoutSource): Make + interval unsigned to match g_timeout_source_new(). + (#82624, Tim Janik.) + + * glib/gmain.c (g_timeout_prepare): Add some + extra gymnastics to avoid signed/unisgned integer + overflows. + Thu Jun 13 15:57:46 2002 Owen Taylor * INSTALL.in: Add a note about the deficiency diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 421410672..eae4f3f76 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +Thu Jun 13 16:12:04 2002 Owen Taylor + + * glib/gmain.c (struct _GTimeoutSource): Make + interval unsigned to match g_timeout_source_new(). + (#82624, Tim Janik.) + + * glib/gmain.c (g_timeout_prepare): Add some + extra gymnastics to avoid signed/unisgned integer + overflows. + Thu Jun 13 15:57:46 2002 Owen Taylor * INSTALL.in: Add a note about the deficiency diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 421410672..eae4f3f76 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,13 @@ +Thu Jun 13 16:12:04 2002 Owen Taylor + + * glib/gmain.c (struct _GTimeoutSource): Make + interval unsigned to match g_timeout_source_new(). + (#82624, Tim Janik.) + + * glib/gmain.c (g_timeout_prepare): Add some + extra gymnastics to avoid signed/unisgned integer + overflows. + Thu Jun 13 15:57:46 2002 Owen Taylor * INSTALL.in: Add a note about the deficiency diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 421410672..eae4f3f76 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,13 @@ +Thu Jun 13 16:12:04 2002 Owen Taylor + + * glib/gmain.c (struct _GTimeoutSource): Make + interval unsigned to match g_timeout_source_new(). + (#82624, Tim Janik.) + + * glib/gmain.c (g_timeout_prepare): Add some + extra gymnastics to avoid signed/unisgned integer + overflows. + Thu Jun 13 15:57:46 2002 Owen Taylor * INSTALL.in: Add a note about the deficiency diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 421410672..eae4f3f76 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,13 @@ +Thu Jun 13 16:12:04 2002 Owen Taylor + + * glib/gmain.c (struct _GTimeoutSource): Make + interval unsigned to match g_timeout_source_new(). + (#82624, Tim Janik.) + + * glib/gmain.c (g_timeout_prepare): Add some + extra gymnastics to avoid signed/unisgned integer + overflows. + Thu Jun 13 15:57:46 2002 Owen Taylor * INSTALL.in: Add a note about the deficiency diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 421410672..eae4f3f76 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +Thu Jun 13 16:12:04 2002 Owen Taylor + + * glib/gmain.c (struct _GTimeoutSource): Make + interval unsigned to match g_timeout_source_new(). + (#82624, Tim Janik.) + + * glib/gmain.c (g_timeout_prepare): Add some + extra gymnastics to avoid signed/unisgned integer + overflows. + Thu Jun 13 15:57:46 2002 Owen Taylor * INSTALL.in: Add a note about the deficiency diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 421410672..eae4f3f76 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +Thu Jun 13 16:12:04 2002 Owen Taylor + + * glib/gmain.c (struct _GTimeoutSource): Make + interval unsigned to match g_timeout_source_new(). + (#82624, Tim Janik.) + + * glib/gmain.c (g_timeout_prepare): Add some + extra gymnastics to avoid signed/unisgned integer + overflows. + Thu Jun 13 15:57:46 2002 Owen Taylor * INSTALL.in: Add a note about the deficiency diff --git a/glib/gmain.c b/glib/gmain.c index 3c7c9f22e..1c385e6ae 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -153,7 +153,7 @@ struct _GTimeoutSource { GSource source; GTimeVal expiration; - gint interval; + guint interval; }; struct _GPollRec @@ -2937,11 +2937,11 @@ g_timeout_prepare (GSource *source, * this at least avoids hanging for long periods of time. */ g_timeout_set_expiration (timeout_source, ¤t_time); - msec = timeout_source->interval; + msec = MIN (G_MAXINT, timeout_source->interval); } else { - msec += sec * 1000; + msec = MIN (G_MAXINT, (guint)msec + 1000 * (guint)sec); } } -- 2.34.1