summaryrefslogtreecommitdiff
path: root/libs/ardour/rt_midibuffer.cc
diff options
context:
space:
mode:
authorJohn Emmas <john@creativepost.co.uk>2020-03-05 12:52:22 +0000
committerJohn Emmas <john@creativepost.co.uk>2020-03-05 12:52:22 +0000
commit9a3159c2c081ff02f8af87a0863f079214613429 (patch)
treea10ba703e862770b6b886629d1291dc108b437a8 /libs/ardour/rt_midibuffer.cc
parentf49aedaa39ce4362b3f6cc3ea348e89e4b4e0c85 (diff)
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...)
Diffstat (limited to 'libs/ardour/rt_midibuffer.cc')
-rw-r--r--libs/ardour/rt_midibuffer.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/libs/ardour/rt_midibuffer.cc b/libs/ardour/rt_midibuffer.cc
index b3cd0f934e..2422eb96d9 100644
--- a/libs/ardour/rt_midibuffer.cc
+++ b/libs/ardour/rt_midibuffer.cc
@@ -233,12 +233,13 @@ RTMidiBuffer::write (TimeType time, Evoral::EventType /*type*/, uint32_t size, c
return size;
}
+/* These (non-matching) comparison arguments weren't supported prior to C99 !!!
static
bool
item_timestamp_earlier (ARDOUR::RTMidiBuffer::Item const & item, samplepos_t time)
{
return item.timestamp < time;
-}
+}*/
static
bool
@@ -256,21 +257,22 @@ RTMidiBuffer::read (MidiBuffer& dst, samplepos_t start, samplepos_t end, MidiSta
return 0;
}
+ bool reverse;
+ Item foo;
Item* iend;
Item* item;
+
uint32_t count = 0;
- bool reverse;
+ foo.timestamp = start;
if (start < end) {
iend = _data+_size;
- item = lower_bound (_data, iend, start, item_timestamp_earlier);
+ item = lower_bound (_data, iend, foo, item_item_earlier);
reverse = false;
} else {
iend = _data;
--iend; /* yes, this is technically "illegal" but we will never indirect */
Item* uend = _data+_size;
- Item foo;
- foo.timestamp = start;
item = upper_bound (_data, uend, foo, item_item_earlier);
if (item == uend) {