mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-13 15:56:23 +01:00
gdatetime: Port to use new g_time_zone_new_identifier() constructor
This allows slightly more reliable error checking on this code path. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #553
This commit is contained in:
parent
8105c36e84
commit
f9d0135a90
@ -1383,15 +1383,15 @@ parse_iso8601_timezone (const gchar *text, gsize length, gssize *tz_offset)
|
||||
return NULL;
|
||||
|
||||
*tz_offset = i;
|
||||
tz = g_time_zone_new (text + i);
|
||||
tz = g_time_zone_new_identifier (text + i);
|
||||
|
||||
/* Double-check that the GTimeZone matches our interpretation of the timezone.
|
||||
* This can fail because our interpretation is less strict than (for example)
|
||||
* parse_time() in gtimezone.c, which restricts the range of the parsed
|
||||
* integers. */
|
||||
if (g_time_zone_get_offset (tz, 0) != offset_sign * (offset_hours * 3600 + offset_minutes * 60))
|
||||
if (tz == NULL || g_time_zone_get_offset (tz, 0) != offset_sign * (offset_hours * 3600 + offset_minutes * 60))
|
||||
{
|
||||
g_time_zone_unref (tz);
|
||||
g_clear_pointer (&tz, g_time_zone_unref);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user