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 ||
                           ^
This commit is contained in:
Emmanuel Fleury 2021-05-14 10:47:40 +02:00
parent 32b4c53295
commit 33c2968669

View File

@ -893,8 +893,9 @@ static GDateTime *
g_date_time_new_from_timeval (GTimeZone *tz, g_date_time_new_from_timeval (GTimeZone *tz,
const GTimeVal *tv) const GTimeVal *tv)
{ {
if ((gint64) tv->tv_sec > G_MAXINT64 - 1 || gint64 tv_sec = tv->tv_sec;
!UNIX_TO_INSTANT_IS_VALID ((gint64) tv->tv_sec + 1))
if (tv_sec > G_MAXINT64 - 1 || !UNIX_TO_INSTANT_IS_VALID (tv_sec + 1))
return NULL; return NULL;
return g_date_time_from_instant (tz, tv->tv_usec + return g_date_time_from_instant (tz, tv->tv_usec +