From 33c29686690ee16fa437d64a479793e9fdc212e3 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Fri, 14 May 2021 10:47:40 +0200 Subject: [PATCH] Fix always false statement warning in glib/gdatetime.c glib/gdatetime.c:896:27: warning: comparison is always false due to limited range of data type if ((gint64) tv->tv_sec > G_MAXINT64 - 1 || ^ --- glib/gdatetime.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/glib/gdatetime.c b/glib/gdatetime.c index a31afe713..429cadefc 100644 --- a/glib/gdatetime.c +++ b/glib/gdatetime.c @@ -893,8 +893,9 @@ static GDateTime * g_date_time_new_from_timeval (GTimeZone *tz, const GTimeVal *tv) { - if ((gint64) tv->tv_sec > G_MAXINT64 - 1 || - !UNIX_TO_INSTANT_IS_VALID ((gint64) tv->tv_sec + 1)) + gint64 tv_sec = tv->tv_sec; + + if (tv_sec > G_MAXINT64 - 1 || !UNIX_TO_INSTANT_IS_VALID (tv_sec + 1)) return NULL; return g_date_time_from_instant (tz, tv->tv_usec +