From 0e1f62e60518dc10d98bdfdb99bcb1c3328d2984 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 21 Jun 2022 18:37:08 -0600 Subject: [PATCH] fix optimized build unused variable warnings and abort not assert --- libs/ardour/midi_ring_buffer.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/ardour/midi_ring_buffer.cc b/libs/ardour/midi_ring_buffer.cc index c7f1649362..ebd108fb85 100644 --- a/libs/ardour/midi_ring_buffer.cc +++ b/libs/ardour/midi_ring_buffer.cc @@ -23,6 +23,7 @@ #include "pbd/compose.h" #include "pbd/enumwriter.h" #include "pbd/error.h" +#include "pbd/i18n.h" #include "ardour/debug.h" #include "ardour/midi_ring_buffer.h" @@ -95,7 +96,10 @@ MidiRingBuffer::read (MidiBuffer& dst, samplepos_t start, samplepos_t end, sa uint8_t status; bool r = this->peek (&status, sizeof(uint8_t)); - assert (r); // If this failed, buffer is corrupt, all hope is lost + if (!r) { + fatal << string_compose (_("programming error: %1\n"), X_("MIDI buffer corrupt in MidiRingBuffer::read()")) << endmsg; + abort(); // If this failed, buffer is corrupt, all hope is lost + } /* lets see if we are going to be able to write this event into dst. */ @@ -159,7 +163,10 @@ MidiRingBuffer::skip_to(samplepos_t start) uint8_t peekbuf[prefix_size]; bool r = this->peek (peekbuf, prefix_size); - assert (r); + if (!r) { + fatal << string_compose (_("programming error: %1\n"), X_("MIDI buffer corrupt in MidiRingBuffer::skip_to()")) << endmsg; + abort (); + } ev_time = *(reinterpret_cast((uintptr_t)peekbuf)); ev_size = *(reinterpret_cast((uintptr_t)(peekbuf + sizeof(T) + sizeof (Evoral::EventType))));