Merge branch 'backport-1125-date-time-error-handling-again-glib-2-62' into 'glib-2-62'

Backport !1125 and !1115 GDateTime parsing fixes to glib-2-62

See merge request GNOME/glib!1127
This commit is contained in:
Sebastian Dröge 2019-09-26 08:17:35 +00:00
commit 2de58d25b3
2 changed files with 7 additions and 0 deletions

View File

@ -1220,6 +1220,8 @@ g_date_time_new_ordinal (GTimeZone *tz, gint year, gint ordinal_day, gint hour,
return NULL;
dt = g_date_time_new (tz, year, 1, 1, hour, minute, seconds);
if (dt == NULL)
return NULL;
dt->days += ordinal_day - 1;
return dt;
@ -1239,6 +1241,8 @@ g_date_time_new_week (GTimeZone *tz, gint year, gint week, gint week_day, gint h
return NULL;
dt = g_date_time_new (tz, year, 1, 4, 0, 0, 0);
if (dt == NULL)
return NULL;
g_date_time_get_week_number (dt, NULL, &jan4_week_day, NULL);
g_date_time_unref (dt);

View File

@ -866,6 +866,9 @@ test_GDateTime_new_from_iso8601_2 (void)
{ TRUE, "+1980-02-22T12:36:00+02:00", 1980, 2, 22, 12, 36, 0, 0, 2 * G_TIME_SPAN_HOUR },
{ TRUE, "1990-11-01T10:21:17 ", 1990, 11, 1, 10, 21, 17, 0, 0 },
*/
{ FALSE, "1719W462 407777-07", 0, 0, 0, 0, 0, 0, 0, 0 },
{ FALSE, "4011090 260528Z", 0, 0, 0, 0, 0, 0, 0, 0 },
{ FALSE, "0000W011 228214-22", 0, 0, 0, 0, 0, 0, 0, 0 },
};
GTimeZone *tz = NULL;
GDateTime *dt = NULL;