From 3b8e07c5b87acbda0f09155aa30bf9cc5e0ae8fc Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Tue, 17 Jul 2001 01:06:18 +0000 Subject: return NULL if we couldn't find the LOCATION. 2001-07-16 Damon Chaplin * src/libical/icaltimezone.c (icaltimezone_get_location_from_vtimezone): return NULL if we couldn't find the LOCATION. (icaltimezone_get_utc_offset): ifdef'd out a debugging message. (icaltimezone_get_location): (icaltimezone_get_latitude): (icaltimezone_get_longitude): don't load the builtin timezone for these. We should already have the data from reading zones.tab. (icaltimezone_get_builtin_timezone_from_tzid): return NULL if the TZID given is NULL or "" (i.e. a floating time). svn path=/trunk/; revision=11143 --- libical/ChangeLog | 11 +++++++++++ libical/src/libical/icalcomponent.c | 2 ++ libical/src/libical/icaltimezone.c | 22 +++++++++++++--------- 3 files changed, 26 insertions(+), 9 deletions(-) (limited to 'libical') diff --git a/libical/ChangeLog b/libical/ChangeLog index b43f41b042..5b5990baf9 100644 --- a/libical/ChangeLog +++ b/libical/ChangeLog @@ -1,3 +1,14 @@ +2001-07-16 Damon Chaplin + + * src/libical/icaltimezone.c (icaltimezone_get_location_from_vtimezone): return NULL if we couldn't find the LOCATION. + (icaltimezone_get_utc_offset): ifdef'd out a debugging message. + (icaltimezone_get_location): + (icaltimezone_get_latitude): + (icaltimezone_get_longitude): don't load the builtin timezone for + these. We should already have the data from reading zones.tab. + (icaltimezone_get_builtin_timezone_from_tzid): return NULL if the TZID + given is NULL or "" (i.e. a floating time). + 2001-07-10 Peter Williams * src/libicalss/Makefile.am (libicalss_la_SOURCES): Add the diff --git a/libical/src/libical/icalcomponent.c b/libical/src/libical/icalcomponent.c index a9ce7537b8..fa97c59f9c 100644 --- a/libical/src/libical/icalcomponent.c +++ b/libical/src/libical/icalcomponent.c @@ -573,6 +573,8 @@ icalcomponent_add_component (icalcomponent* parent, icalcomponent* child) if (cimpl->kind == ICAL_VTIMEZONE_COMPONENT) { fprintf (stderr, " it is a VTIMEZONE component.\n"); + /* FIXME: Currently we are also creating this array when loading in + a builtin VTIMEZONE, when we don't need it. */ if (!impl->timezones) impl->timezones = icaltimezone_array_new (); diff --git a/libical/src/libical/icaltimezone.c b/libical/src/libical/icaltimezone.c index 91f72470c7..eb2392414f 100644 --- a/libical/src/libical/icaltimezone.c +++ b/libical/src/libical/icaltimezone.c @@ -308,6 +308,8 @@ icaltimezone_get_location_from_vtimezone (icalcomponent *component) prop = icalcomponent_get_next_property (component, ICAL_X_PROPERTY); } + + return NULL; } @@ -881,8 +883,10 @@ icaltimezone_get_utc_offset (icaltimezone *zone, standard time instead. */ want_daylight = (tt->is_daylight == 1) ? 1 : 0; +#if 0 if (zone_change->is_daylight == prev_zone_change->is_daylight) printf (" **** Same is_daylight setting\n"); +#endif if (zone_change->is_daylight != want_daylight && prev_zone_change->is_daylight == want_daylight) @@ -1143,9 +1147,8 @@ icaltimezone_get_tzid (icaltimezone *zone) char* icaltimezone_get_location (icaltimezone *zone) { - if (!zone->component) - icaltimezone_load_builtin_timezone (zone); - + /* Note that for builtin timezones this comes from zones.tab so we don't + need to check the timezone is loaded here. */ return zone->location; } @@ -1164,9 +1167,8 @@ icaltimezone_get_tznames (icaltimezone *zone) double icaltimezone_get_latitude (icaltimezone *zone) { - if (!zone->component) - icaltimezone_load_builtin_timezone (zone); - + /* Note that for builtin timezones this comes from zones.tab so we don't + need to check the timezone is loaded here. */ return zone->latitude; } @@ -1175,9 +1177,8 @@ icaltimezone_get_latitude (icaltimezone *zone) double icaltimezone_get_longitude (icaltimezone *zone) { - if (!zone->component) - icaltimezone_load_builtin_timezone (zone); - + /* Note that for builtin timezones this comes from zones.tab so we don't + need to check the timezone is loaded here. */ return zone->longitude; } @@ -1310,6 +1311,9 @@ icaltimezone_get_builtin_timezone_from_tzid (const char *tzid) fprintf (stderr, "Getting builtin timezone from TZID: %s\n", tzid); + if (!tzid || !tzid[0]) + return NULL; + /* Check that the TZID starts with our unique prefix. */ if (strncmp (tzid, TZID_PREFIX, TZID_PREFIX_LEN)) return NULL; -- cgit v1.2.3