Closed Bug 330522 Opened 18 years ago Closed 17 years ago

libical only outputs 7 or fewer BYDAY rules

Categories

(Calendar :: Internal Components, defect)

All
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mehovis, Assigned: gray)

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7

Create an event with more than 7 BYDAY rules, for instance with the following string:
"FREQ=YEARLY;UNTIL=20000131T090000Z;BYMONTH=1;BYDAY=-50SU,+5MO,-222TU,WE,TH,FR,SA,-50FRI";

You'll end up losing one of the BYDAY rules.


Reproducible: Always

Steps to Reproduce:
1.  Create a test app that links with libical
2.  Call icalrecurrencetype craprecur = icalrecurrencetype_from_string(value); with the string above.
3.  cout << std::string(icalrecurrencetype_as_string(const_cast<icalrecurrencetype *>(&craprecur )) << endl;

Actual Results:  
One of the rules won't get displayed.

Expected Results:  
All the BYDAY rules should get printed out.
Attached patch Patch to fix BYDAY recur bug (obsolete) — Splinter Review
Removes hard-coded ints, uses defines from ical.h instead.
Attachment #215083 - Flags: first-review?(dmose)
Comment on attachment 215083 [details] [diff] [review]
Patch to fix BYDAY recur bug

>Index: calendar/libical/src/libical/icalrecur.c
>===================================================================
>RCS file: /cvsroot/mozilla/calendar/libical/src/libical/icalrecur.c,v
>retrieving revision 1.4
>diff -u -r1.4 icalrecur.c
>--- calendar/libical/src/libical/icalrecur.c	15 Feb 2005 20:48:26 -0000	1.4
>+++ calendar/libical/src/libical/icalrecur.c	15 Mar 2006 00:15:17 -0000
>@@ -493,15 +493,15 @@
> 
> static struct { char* str;size_t offset; int limit;  } recurmap[] = 
> {
>-    {";BYSECOND=",offsetof(struct icalrecurrencetype,by_second),60},
>-    {";BYMINUTE=",offsetof(struct icalrecurrencetype,by_minute),60},
>-    {";BYHOUR=",offsetof(struct icalrecurrencetype,by_hour),24},
>-    {";BYDAY=",offsetof(struct icalrecurrencetype,by_day),7},
>-    {";BYMONTHDAY=",offsetof(struct icalrecurrencetype,by_month_day),31},
>-    {";BYYEARDAY=",offsetof(struct icalrecurrencetype,by_year_day),366},
>-    {";BYWEEKNO=",offsetof(struct icalrecurrencetype,by_week_no),52},
>-    {";BYMONTH=",offsetof(struct icalrecurrencetype,by_month),12},
>-    {";BYSETPOS=",offsetof(struct icalrecurrencetype,by_set_pos),366},
>+    {";BYSECOND=",offsetof(struct icalrecurrencetype,by_second),ICAL_BY_SECOND_SIZE - 1},
>+    {";BYMINUTE=",offsetof(struct icalrecurrencetype,by_minute),ICAL_BY_MINUTE_SIZE - 1},
>+    {";BYHOUR=",offsetof(struct icalrecurrencetype,by_hour),ICAL_BY_HOUR_SIZE - 1},
>+    {";BYDAY=",offsetof(struct icalrecurrencetype,by_day),ICAL_BY_DAY_SIZE - 1},
>+    {";BYMONTHDAY=",offsetof(struct icalrecurrencetype,by_month_day),ICAL_BY_MONTHDAY_SIZE - 1},
>+    {";BYYEARDAY=",offsetof(struct icalrecurrencetype,by_year_day),ICAL_BY_YEARDAY_SIZE - 1},
>+    {";BYWEEKNO=",offsetof(struct icalrecurrencetype,by_week_no),ICAL_BY_WEEKNO_SIZE - 1},
>+    {";BYMONTH=",offsetof(struct icalrecurrencetype,by_month),ICAL_BY_MONTH_SIZE - 1},
>+    {";BYSETPOS=",offsetof(struct icalrecurrencetype,by_set_pos),ICAL_BY_SETPOS_SIZE - 1},
>     {0,0,0},
> };
>
Attachment #215083 - Attachment is obsolete: true
Attachment #215084 - Flags: first-review?(dmose)
Attachment #215083 - Flags: first-review?(dmose)
Comment on attachment 215084 [details] [diff] [review]
Stupid paste mistake from first attachment

r=dmose; thanks for the fix!  (And sorry for the delay in landing it).
Attachment #215084 - Flags: first-review?(dmose) → first-review+
Hmm, my trunk build is a bit wonky, so I'll have to do the actual landing of this tomorrow.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Fix landed.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Component: libical → Internal Components
The bugspam monkeys have been set free and are feeding on Calendar :: Internal Components. Be afraid for your sanity!
QA Contact: libical → base
You need to log in before you can comment on or make changes to this bug.