aboutsummaryrefslogtreecommitdiffstats
path: root/libical/src
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-07-17 09:06:18 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-07-17 09:06:18 +0800
commit3b8e07c5b87acbda0f09155aa30bf9cc5e0ae8fc (patch)
tree44163ec23a3e491243ad9abda999d8ed8e09c0d0 /libical/src
parent36f546f021b1f0ef8fd6a634ce448cb99e3d5230 (diff)
downloadgsoc2013-evolution-3b8e07c5b87acbda0f09155aa30bf9cc5e0ae8fc.tar.gz
gsoc2013-evolution-3b8e07c5b87acbda0f09155aa30bf9cc5e0ae8fc.tar.zst
gsoc2013-evolution-3b8e07c5b87acbda0f09155aa30bf9cc5e0ae8fc.zip
return NULL if we couldn't find the LOCATION.
2001-07-16 Damon Chaplin <damon@ximian.com> * 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
Diffstat (limited to 'libical/src')
-rw-r--r--libical/src/libical/icalcomponent.c2
-rw-r--r--libical/src/libical/icaltimezone.c22
2 files changed, 15 insertions, 9 deletions
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;