|
15 | 15 | How this code works: |
16 | 16 |
|
17 | 17 | Processing starts when the caller generates a new recurrence |
18 | | - iterator via icalrecur_iterator_new(). This routine copies the |
19 | | - recurrence rule into the iterator and extracts things like start and |
| 18 | + iterator via icalrecur_iterator_new(). This routine stores a |
| 19 | + reference to the recurrence rule and extracts things like start and |
20 | 20 | end dates. Then, it checks if the rule is legal, using some logic |
21 | 21 | from RFC5545 and some logic that probably should be in RFC5545. |
22 | 22 |
|
|
25 | 25 | and configures ICU4C to convert occurrences to/from non-Gregorian dates. |
26 | 26 |
|
27 | 27 | Then, icalrecur_iterator_new() re-writes some of the BY* |
28 | | - arrays. This involves ( via a call to setup_defaults() ) : |
| 28 | + arrays (this happens within the iterator, the rule itselfs is |
| 29 | + treated immutable). This involves ( via a call to setup_defaults() ) : |
29 | 30 |
|
30 | 31 | 1) For BY rule parts with no data ( ie BYSECOND was not specified ) |
31 | | - copy the corresponding time part from DTSTART into the BY array. ( |
32 | | - So impl->by_ptrs[ICAL_BY_SECOND] will then have one element if is |
33 | | - originally had none ) This only happens if the BY* rule part data |
| 32 | + set up the corresponding time part from DTSTART in the corresponding |
| 33 | + impl->bydata. So impl->bydata[ICAL_BY_SECOND].by will then have one |
| 34 | + element if is originally had none ). |
| 35 | + This only happens if the BY* rule part data |
34 | 36 | would expand the number of occurrences in the occurrence set. This |
35 | 37 | lets the code ignore DTSTART later on and still use it to get the |
36 | 38 | time parts that were not specified in any other way. |
@@ -1171,7 +1173,7 @@ static void recur_iterator_set_static_single_by_value(icalrecur_iterator *impl, |
1171 | 1173 | by->by.size = 1; |
1172 | 1174 | by->by.data = &by->buffer_value; |
1173 | 1175 | by->by.data[0] = value; |
1174 | | - } |
| 1176 | +} |
1175 | 1177 |
|
1176 | 1178 | static void setup_defaults(icalrecur_iterator *impl, |
1177 | 1179 | icalrecurrencetype_byrule byrule, int deftime) |
@@ -2143,15 +2145,15 @@ icalrecur_iterator *icalrecur_iterator_new(struct icalrecurrencetype *rule, |
2143 | 2145 | for (byrule = 0; byrule < ICAL_BY_NUM_PARTS; byrule++) { |
2144 | 2146 | impl->bydata[byrule].by = impl->rule->by[byrule]; |
2145 | 2147 |
|
2146 | | - /* Note which by rules had data in them when the iterator was |
2147 | | - created. We can't use the actual by_x arrays, because the |
2148 | | - empty ones will be given default values later in this |
2149 | | - routine. The orig_data array will be used later in has_by_data */ |
| 2148 | + /* Note which by rules had data in them when the iterator was |
| 2149 | + created. We can't use the actual by_x arrays, because the |
| 2150 | + empty ones will be given default values later in this |
| 2151 | + routine. The orig_data array will be used later in has_by_data */ |
2150 | 2152 |
|
2151 | | - impl->bydata[byrule].orig_data = |
2152 | | - (short)(impl->rule->by[byrule].size > 0); |
| 2153 | + impl->bydata[byrule].orig_data = |
| 2154 | + (short)(impl->rule->by[byrule].size > 0); |
2153 | 2155 |
|
2154 | | - /* Check if the recurrence rule is legal */ |
| 2156 | + /* Check if the recurrence rule is legal */ |
2155 | 2157 | if (expand_map[freq].map[byrule] == ILLEGAL && |
2156 | 2158 | has_by_data(impl, byrule)) { |
2157 | 2159 | ical_invalid_rrule_handling rruleHandlingSetting = |
@@ -2258,7 +2260,7 @@ static void increment_month(icalrecur_iterator *impl, int inc) |
2258 | 2260 | struct icaltimetype this = occurrence_as_icaltime(impl, 0); |
2259 | 2261 |
|
2260 | 2262 | while (this.year < 20000) { |
2261 | | -icalrecurrence_iterator_by_data *bydata = &impl->bydata[ICAL_BY_MONTH]; |
| 2263 | + icalrecurrence_iterator_by_data *bydata = &impl->bydata[ICAL_BY_MONTH]; |
2262 | 2264 | for (bydata->index = 0; |
2263 | 2265 | bydata->index < bydata->by.size; bydata->index++) { |
2264 | 2266 | if (this.month == bydata->by.data[bydata->index]) |
@@ -2387,7 +2389,7 @@ static int prev_unit(icalrecur_iterator *impl, |
2387 | 2389 | void (*increment_unit)(icalrecur_iterator *, int), |
2388 | 2390 | void (*increment_super_unit)(icalrecur_iterator *, int)) |
2389 | 2391 | { |
2390 | | -icalrecurrence_iterator_by_data *bydata = &impl->bydata[by_unit]; |
| 2392 | + icalrecurrence_iterator_by_data *bydata = &impl->bydata[by_unit]; |
2391 | 2393 | int has_by_unit = (by_unit > ICAL_BYRULE_NO_CONTRACTION) && |
2392 | 2394 | (bydata->by.size > 0); |
2393 | 2395 | int this_frequency = (impl->rule->freq == frequency); |
|
0 commit comments