From dc354f10e83c1a1aca64454ef45059af4b69279e Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 2 Nov 2001 22:08:50 +0000 Subject: Short-circuit the calculation of the repeat time if there are zero 2001-11-02 Federico Mena Quintero * 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 --- calendar/ChangeLog | 7 +++++++ calendar/cal-util/cal-util.c | 11 +++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 88ad3dff4d..d0e8b004dd 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2001-11-02 Federico Mena Quintero + + * 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. + 2001-10-31 Ettore Perazzoli * gui/dialogs/Makefile.am: Added rules to generate 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); } -- cgit v1.2.3