aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-09-07 11:36:30 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-09-07 11:36:30 +0800
commitda42183a7b7de1e9aef23f1d75f91f8935d01d7e (patch)
treeabfe5ca700f3b46b3245a09a7b9ce066859d3362
parentb7710c6101f2e485886eea33a8bfb91f39dc308e (diff)
downloadgsoc2013-evolution-da42183a7b7de1e9aef23f1d75f91f8935d01d7e.tar
gsoc2013-evolution-da42183a7b7de1e9aef23f1d75f91f8935d01d7e.tar.gz
gsoc2013-evolution-da42183a7b7de1e9aef23f1d75f91f8935d01d7e.tar.bz2
gsoc2013-evolution-da42183a7b7de1e9aef23f1d75f91f8935d01d7e.tar.lz
gsoc2013-evolution-da42183a7b7de1e9aef23f1d75f91f8935d01d7e.tar.xz
gsoc2013-evolution-da42183a7b7de1e9aef23f1d75f91f8935d01d7e.tar.zst
gsoc2013-evolution-da42183a7b7de1e9aef23f1d75f91f8935d01d7e.zip
pass the VTIMEZONE component to icalcomponent_compare_vtimezones(), not
2001-09-06 Damon Chaplin <damon@ximian.com> * src/libical/icalcomponent.c (icalcomponent_merge_vtimezone): pass the VTIMEZONE component to icalcomponent_compare_vtimezones(), not the icaltimezone*. Strangely we weren't getting a compiler error. Fixes bug #5275, hopefully. * src/libical/icaltimezone.c (icaltimezone_dump_changes): updated so it still outputs the same format, even though the '1 Jan 0001' component isn't included any more. svn path=/trunk/; revision=12670
-rw-r--r--libical/ChangeLog11
-rw-r--r--libical/src/libical/icalcomponent.c8
-rw-r--r--libical/src/libical/icaltimezone.c30
3 files changed, 43 insertions, 6 deletions
diff --git a/libical/ChangeLog b/libical/ChangeLog
index 2c20f8c270..bd481341ce 100644
--- a/libical/ChangeLog
+++ b/libical/ChangeLog
@@ -1,3 +1,14 @@
+2001-09-06 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icalcomponent.c (icalcomponent_merge_vtimezone): pass
+ the VTIMEZONE component to icalcomponent_compare_vtimezones(), not
+ the icaltimezone*. Strangely we weren't getting a compiler error.
+ Fixes bug #5275, hopefully.
+
+ * src/libical/icaltimezone.c (icaltimezone_dump_changes): updated so
+ it still outputs the same format, even though the '1 Jan 0001'
+ component isn't included any more.
+
2001-08-31 Damon Chaplin <damon@ximian.com>
* zoneinfo/*: updated all of the VTIMEZONE files to try to be more
diff --git a/libical/src/libical/icalcomponent.c b/libical/src/libical/icalcomponent.c
index 64b2e0d97f..660e739984 100644
--- a/libical/src/libical/icalcomponent.c
+++ b/libical/src/libical/icalcomponent.c
@@ -1578,7 +1578,8 @@ static void icalcomponent_merge_vtimezone (icalcomponent *comp,
icalproperty *tzid_prop;
const char *tzid;
char *tzid_copy;
- icaltimezone *existing_vtimezone;
+ icaltimezone *existing_zone;
+ icalcomponent *existing_vtimezone;
/* Get the TZID of the VTIMEZONE. */
tzid_prop = icalcomponent_get_first_property (vtimezone, ICAL_TZID_PROPERTY);
@@ -1590,11 +1591,11 @@ static void icalcomponent_merge_vtimezone (icalcomponent *comp,
return;
/* See if there is already a VTIMEZONE in comp with the same TZID. */
- existing_vtimezone = icalcomponent_get_timezone (comp, tzid);
+ existing_zone = icalcomponent_get_timezone (comp, tzid);
/* If there is no existing VTIMEZONE with the same TZID, we can just move
the VTIMEZONE to comp and return. */
- if (!existing_vtimezone) {
+ if (!existing_zone) {
icalcomponent_remove_component (icalcomponent_get_parent (vtimezone),
vtimezone);
icalcomponent_add_component (comp, vtimezone);
@@ -1616,6 +1617,7 @@ static void icalcomponent_merge_vtimezone (icalcomponent *comp,
return;
}
+ existing_vtimezone = icaltimezone_get_component (existing_zone);
if (!icalcomponent_compare_vtimezones (existing_vtimezone, vtimezone)) {
/* FIXME: Handle possible NEWFAILED error. */
diff --git a/libical/src/libical/icaltimezone.c b/libical/src/libical/icaltimezone.c
index fcb12c378b..17a3b437d7 100644
--- a/libical/src/libical/icaltimezone.c
+++ b/libical/src/libical/icaltimezone.c
@@ -1541,6 +1541,32 @@ icaltimezone_dump_changes (icaltimezone *zone,
printf ("Num changes: %i\n", zone->changes->num_elements);
#endif
+ /* This shouldn't happen. */
+ if (zone->changes->num_elements == 0) {
+ fprintf (fp, "%s\tNO CHANGES", zone->location);
+ return;
+ }
+
+ zone_change = icalarray_element_at (zone->changes, 0);
+
+ /* If there is just one change, and the TZOFFSETFROM and TZOFFSETTO are
+ the same, meaning the zone just uses the same offset forever, we output
+ the special '1 Jan 0001' date instead and return. */
+ if (zone->changes->num_elements == 1
+ && zone_change->prev_utc_offset == zone_change->utc_offset
+ && (zone_change->year == 1600 || zone_change->year == 1601)) {
+ fprintf (fp, "%s\t 1 Jan 0001\t 0:00:00", zone->location);
+ format_utc_offset (zone_change->utc_offset, buffer);
+ fprintf (fp, "\t%s\n", buffer);
+ return;
+ }
+
+ /* Output the special 1 Jan 0001 change here, using the TZOFFSET_FROM
+ field of the first change. */
+ fprintf (fp, "%s\t 1 Jan 0001\t 0:00:00", zone->location);
+ format_utc_offset (zone_change->prev_utc_offset, buffer);
+ fprintf (fp, "\t%s\n", buffer);
+
change_num = 0;
for (change_num = 0; change_num < zone->changes->num_elements; change_num++) {
zone_change = icalarray_element_at (zone->changes, change_num);
@@ -1556,9 +1582,7 @@ icaltimezone_dump_changes (icaltimezone *zone,
/* Wall Clock Time offset from UTC. */
format_utc_offset (zone_change->utc_offset, buffer);
- fprintf (fp, "\t%s", buffer);
-
- fprintf (fp, "\n");
+ fprintf (fp, "\t%s\n", buffer);
}
}