From d9f8a78c903bbf72d1ef51a0edace566969e9cbd Mon Sep 17 00:00:00 2001 From: znek Date: Wed, 2 Mar 2005 19:51:57 +0000 Subject: [PATCH] yet another bugfix for recurrence calculation git-svn-id: http://svn.opengroupware.org/SOPE/trunk@609 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-ical/NGiCal/ChangeLog | 3 +++ sope-ical/NGiCal/NGiCal.xcode/project.pbxproj | 4 ++-- sope-ical/NGiCal/Version | 2 +- sope-ical/NGiCal/iCalRecurrenceCalculator.m | 20 +++++++++++++------ 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/sope-ical/NGiCal/ChangeLog b/sope-ical/NGiCal/ChangeLog index f2ca3804..3816b102 100644 --- a/sope-ical/NGiCal/ChangeLog +++ b/sope-ical/NGiCal/ChangeLog @@ -1,5 +1,8 @@ 2005-03-02 Marcus Mueller + * iCalRecurrenceCalculator.m: bugfix for monthly and yearly recurrences + (v4.5.49) + * iCalRecurrenceCalculator.m: optimized exception date handling in complex calculation method quite a bit. Fixed bugs in all calculation methods by introducing checks on the desired range. (v4.5.48) diff --git a/sope-ical/NGiCal/NGiCal.xcode/project.pbxproj b/sope-ical/NGiCal/NGiCal.xcode/project.pbxproj index dda6ae5a..2372cd34 100644 --- a/sope-ical/NGiCal/NGiCal.xcode/project.pbxproj +++ b/sope-ical/NGiCal/NGiCal.xcode/project.pbxproj @@ -173,7 +173,7 @@ ); buildSettings = { DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 4.5.48; + DYLIB_CURRENT_VERSION = 4.5.49; FRAMEWORK_SEARCH_PATHS = "\"$(USER_LIBRARY_DIR)/EmbeddedFrameworks\""; FRAMEWORK_VERSION = A; GCC_PRECOMPILE_PREFIX_HEADER = NO; @@ -587,7 +587,7 @@ ); buildSettings = { DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 4.5.48; + DYLIB_CURRENT_VERSION = 4.5.49; FRAMEWORK_SEARCH_PATHS = "$(LOCAL_LIBRARY_DIR)/Frameworks"; FRAMEWORK_VERSION = A; GCC_PRECOMPILE_PREFIX_HEADER = YES; diff --git a/sope-ical/NGiCal/Version b/sope-ical/NGiCal/Version index aa4b2707..4d808abe 100644 --- a/sope-ical/NGiCal/Version +++ b/sope-ical/NGiCal/Version @@ -2,7 +2,7 @@ MAJOR_VERSION=4 MINOR_VERSION=5 -SUBMINOR_VERSION:=48 +SUBMINOR_VERSION:=49 # v4.5.40 requires NGExtensions v4.5.145 # v4.5.37 requires NGExtensions v4.5.140 diff --git a/sope-ical/NGiCal/iCalRecurrenceCalculator.m b/sope-ical/NGiCal/iCalRecurrenceCalculator.m index 797037e1..18ef6b3c 100644 --- a/sope-ical/NGiCal/iCalRecurrenceCalculator.m +++ b/sope-ical/NGiCal/iCalRecurrenceCalculator.m @@ -548,7 +548,8 @@ static Class yearlyCalcClass = Nil; - (NSArray *)recurrenceRangesWithinCalendarDateRange:(NGCalendarDateRange *)_r { NSMutableArray *ranges; NSCalendarDate *firStart, *rStart, *rEnd, *until; - unsigned i, count, interval, diff; + unsigned i, count, interval; + int diff; firStart = [self->firstRange startDate]; rStart = [_r startDate]; @@ -564,13 +565,16 @@ static Class yearlyCalcClass = Nil; } diff = [firStart monthsBetweenDate:rStart]; + if ((diff != 0) && [rStart compare:firStart] == NSOrderedAscending) + diff = -diff; + count = [rStart monthsBetweenDate:rEnd] + 1; ranges = [NSMutableArray arrayWithCapacity:count]; for (i = 0 ; i < count; i++) { - unsigned test; + int test; test = diff + i; - if ((test % interval) == 0) { + if ((test >= 0) && (test % interval) == 0) { NSCalendarDate *start, *end; NGCalendarDateRange *r; @@ -610,7 +614,8 @@ static Class yearlyCalcClass = Nil; - (NSArray *)recurrenceRangesWithinCalendarDateRange:(NGCalendarDateRange *)_r { NSMutableArray *ranges; NSCalendarDate *firStart, *rStart, *rEnd, *until; - unsigned i, count, interval, diff; + unsigned i, count, interval; + int diff; firStart = [self->firstRange startDate]; rStart = [_r startDate]; @@ -626,13 +631,16 @@ static Class yearlyCalcClass = Nil; } diff = [firStart yearsBetweenDate:rStart]; + if ((diff != 0) && [rStart compare:firStart] == NSOrderedAscending) + diff = -diff; + count = [rStart yearsBetweenDate:rEnd] + 1; ranges = [NSMutableArray arrayWithCapacity:count]; for (i = 0 ; i < count; i++) { - unsigned test; + int test; test = diff + i; - if ((test % interval) == 0) { + if ((test >= 0) && (test % interval) == 0) { NSCalendarDate *start, *end; NGCalendarDateRange *r; -- 2.39.5