diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-03-30 21:34:53 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-03-30 21:46:46 +0200 |
commit | 516a793375424ea2bbdc891bf0c917a8f7b388a1 (patch) | |
tree | d6ef9a3897e510f963dcb8686cad82336b975d45 /src | |
parent | d31cda54243fd5c91696eb21e60e84241b9b3397 (diff) | |
download | calcurse-516a793375424ea2bbdc891bf0c917a8f7b388a1.tar.gz calcurse-516a793375424ea2bbdc891bf0c917a8f7b388a1.zip |
Do not use LLIST_*_CONT for appointments
This no longer works since we allow appointments lasting longer than 24
hours. This means that there might be an appointment that starts after
another one and lasts until the selected day, even though the former
doesn't. A simple example, where the old LLIST_TS_FOREACH_CONT approach
fails, is:
03/29/2012 @ 19:00 -> 03/30/2012 @ 10:00 |Long event
03/29/2012 @ 21:00 -> 03/29/2012 @ 23:15 |Event 1 (shown)
03/30/2012 @ 14:00 -> 03/30/2012 @ 15:00 |Event 2 (not shown)
Instead, allow incoherent appointments and only break if the current
appointment *starts after* the selected day.
Reported-by: Baptiste Jonglez <baptiste@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/day.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -195,9 +195,13 @@ day_store_apoints (long date) int a_nb = 0; LLIST_TS_LOCK (&alist_p); - LLIST_TS_FIND_FOREACH_CONT (&alist_p, date, apoint_inday, i) + LLIST_TS_FIND_FOREACH (&alist_p, date, apoint_inday, i) { struct apoint *apt = LLIST_TS_GET_DATA (i); + + if (apt->start >= date + DAYINSEC) + break; + day_add_apoint (APPT, apt->mesg, apt->note, apt->start, apt->dur, apt->state, 0); a_nb++; @@ -547,12 +551,15 @@ day_chk_busy_slices (struct date day, int slicesno, int *slices) LLIST_TS_UNLOCK (&recur_alist_p); LLIST_TS_LOCK (&alist_p); - LLIST_TS_FIND_FOREACH_CONT (&alist_p, date, apoint_inday, i) + LLIST_TS_FIND_FOREACH (&alist_p, date, apoint_inday, i) { struct apoint *apt = LLIST_TS_GET_DATA (i); long start = get_item_time (apt->start); long end = get_item_time (apt->start + apt->dur); + if (apt->start >= date + DAYINSEC) + break; + if (!fill_slices (slices, slicesno, SLICENUM (start), SLICENUM (end))) { LLIST_TS_UNLOCK (&alist_p); |