[glib: 2/4] gdatetime: Port to use new g_time_zone_new_identifier() constructor
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/4] gdatetime: Port to use new g_time_zone_new_identifier() constructor
- Date: Sun, 22 Nov 2020 08:35:35 +0000 (UTC)
commit f9d0135a90a1995b850148327e72ec886f428689
Author: Philip Withnall <pwithnall endlessos org>
Date: Wed Nov 18 11:31:57 2020 +0000
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
glib/gdatetime.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/glib/gdatetime.c b/glib/gdatetime.c
index 1755257be..c2180e443 100644
--- a/glib/gdatetime.c
+++ b/glib/gdatetime.c
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]