- the_start = max (the_start, (framepos_t) region->position());
- if (max_framepos - the_start < region->length()) {
- the_end = the_start + region->length() - 1;
- } else {
- the_end = max_framepos;
- }
- the_end = min (end, the_end);
- cnt = the_end - the_start + 1;
+ pos = (*i)->position();
+ new_start = max (start, pos);
+ if (max_framepos - pos > (*i)->length()) {
+ new_end = pos + (*i)->length() - 1;
+ } else {
+ new_end = max_framepos;
+ }
+ new_end = min (end, new_end);
+ new_length = new_end - new_start + 1;