aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-util
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2001-11-03 06:08:50 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2001-11-03 06:08:50 +0800
commitdc354f10e83c1a1aca64454ef45059af4b69279e (patch)
tree15cf029f95cdd4575cb48a034983364d34ce7f98 /calendar/cal-util
parentda698af7bf49fa3cb4036046a902a0d31010b0aa (diff)
downloadgsoc2013-evolution-dc354f10e83c1a1aca64454ef45059af4b69279e.tar.gz
gsoc2013-evolution-dc354f10e83c1a1aca64454ef45059af4b69279e.tar.zst
gsoc2013-evolution-dc354f10e83c1a1aca64454ef45059af4b69279e.zip
Short-circuit the calculation of the repeat time if there are zero
2001-11-02 Federico Mena Quintero <federico@ximian.com> * cal-util/cal-util.c (compute_alarm_range): Short-circuit the calculation of the repeat time if there are zero repetitions. (compute_alarm_range): I'm a moron. De-reference alarm_start when subtracting stuff from it! Fixes bug #14209. svn path=/trunk/; revision=14572
Diffstat (limited to 'calendar/cal-util')
-rw-r--r--calendar/cal-util/cal-util.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/calendar/cal-util/cal-util.c b/calendar/cal-util/cal-util.c
index 5cc6bbfc77..a30329c638 100644
--- a/calendar/cal-util/cal-util.c
+++ b/calendar/cal-util/cal-util.c
@@ -142,9 +142,12 @@ compute_alarm_range (CalComponent *comp, GList *alarm_uids, time_t start, time_t
dur = &trigger.u.rel_duration;
dur_time = icaldurationtype_as_int (*dur);
- repeat_time = MAX (repeat_time,
- (repeat.repetitions
- * icaldurationtype_as_int (repeat.duration)));
+ if (repeat.repetitions != 0) {
+ int rdur;
+
+ rdur = repeat.repetitions * icaldurationtype_as_int (repeat.duration);
+ repeat_time = MAX (repeat_time, rdur);
+ }
if (dur->is_neg)
/* If the duration is negative then dur_time
@@ -162,7 +165,7 @@ compute_alarm_range (CalComponent *comp, GList *alarm_uids, time_t start, time_t
}
}
- alarm_start -= repeat_time;
+ *alarm_start -= repeat_time;
g_assert (*alarm_start <= *alarm_end);
}