Remove a suspected C99-ism
'lower_bound()' iterates between param #1 and param #2, comparing the result with param #3 - either by making the comparison internally or by deferring to an external comparator function. Prior to C99 however, BOTH cases required param #3 to match the type being iterated. In the case of a deferred comparison, there was apparently a proposal to relax this restriction in C99, though I'm not sure if it in fact got implemented (can't find any examples of it anywhere...)
This commit is contained in:
parent
f49aedaa39
commit
9a3159c2c0
@ -233,12 +233,13 @@ RTMidiBuffer::write (TimeType time, Evoral::EventType /*type*/, uint32_t size, c
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* These (non-matching) comparison arguments weren't supported prior to C99 !!!
|
||||||
static
|
static
|
||||||
bool
|
bool
|
||||||
item_timestamp_earlier (ARDOUR::RTMidiBuffer::Item const & item, samplepos_t time)
|
item_timestamp_earlier (ARDOUR::RTMidiBuffer::Item const & item, samplepos_t time)
|
||||||
{
|
{
|
||||||
return item.timestamp < time;
|
return item.timestamp < time;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
static
|
static
|
||||||
bool
|
bool
|
||||||
@ -256,21 +257,22 @@ RTMidiBuffer::read (MidiBuffer& dst, samplepos_t start, samplepos_t end, MidiSta
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool reverse;
|
||||||
|
Item foo;
|
||||||
Item* iend;
|
Item* iend;
|
||||||
Item* item;
|
Item* item;
|
||||||
|
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
bool reverse;
|
foo.timestamp = start;
|
||||||
|
|
||||||
if (start < end) {
|
if (start < end) {
|
||||||
iend = _data+_size;
|
iend = _data+_size;
|
||||||
item = lower_bound (_data, iend, start, item_timestamp_earlier);
|
item = lower_bound (_data, iend, foo, item_item_earlier);
|
||||||
reverse = false;
|
reverse = false;
|
||||||
} else {
|
} else {
|
||||||
iend = _data;
|
iend = _data;
|
||||||
--iend; /* yes, this is technically "illegal" but we will never indirect */
|
--iend; /* yes, this is technically "illegal" but we will never indirect */
|
||||||
Item* uend = _data+_size;
|
Item* uend = _data+_size;
|
||||||
Item foo;
|
|
||||||
foo.timestamp = start;
|
|
||||||
item = upper_bound (_data, uend, foo, item_item_earlier);
|
item = upper_bound (_data, uend, foo, item_item_earlier);
|
||||||
|
|
||||||
if (item == uend) {
|
if (item == uend) {
|
||||||
|
Loading…
Reference in New Issue
Block a user