summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-01-27 03:31:49 +0100
committerRobin Gareus <robin@gareus.org>2020-01-27 03:31:49 +0100
commitfc7dd5115def88d0dd74cc038517680f050a4ded (patch)
tree48b2eb998939605fe64a6cc96acece8f3f8b3b73
parentcf4d7387d2afe092bb110e1b14415fa07448ee55 (diff)
Fix some clang-scan warnings
-rw-r--r--libs/ardour/ardour/event_ring_buffer.h2
-rw-r--r--libs/ardour/midi_model.cc18
-rw-r--r--libs/ardour/midi_ring_buffer.cc5
-rw-r--r--libs/ardour/tempo.cc3
-rw-r--r--libs/vamp-plugins/TruePeak.cpp2
5 files changed, 15 insertions, 15 deletions
diff --git a/libs/ardour/ardour/event_ring_buffer.h b/libs/ardour/ardour/event_ring_buffer.h
index f8c8e005db..2ccb11dc2d 100644
--- a/libs/ardour/ardour/event_ring_buffer.h
+++ b/libs/ardour/ardour/event_ring_buffer.h
@@ -76,6 +76,8 @@ EventRingBuffer<Time>::peek (uint8_t* buf, size_t size)
return false;
}
+ assert (vec.len[0] > 0 || vec.len[1] > 0);
+
if (vec.len[0] > 0) {
memcpy (buf, vec.buf[0], std::min (vec.len[0], size));
}
diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc
index c52ac4d2de..c65aeb2494 100644
--- a/libs/ardour/midi_model.cc
+++ b/libs/ardour/midi_model.cc
@@ -455,40 +455,34 @@ MidiModel::NoteDiffCommand::marshal_note(const NotePtr note)
Evoral::Sequence<MidiModel::TimeType>::NotePtr
MidiModel::NoteDiffCommand::unmarshal_note (XMLNode *xml_note)
{
- Evoral::event_id_t id;
+ Evoral::event_id_t id = -1;
if (!xml_note->get_property ("id", id)) {
error << "note information missing ID value" << endmsg;
- id = -1;
}
- uint8_t note;
+ uint8_t note = 127;
if (!xml_note->get_property("note", note)) {
warning << "note information missing note value" << endmsg;
- note = 127;
}
- uint8_t channel;
+ uint8_t channel = 0;
if (!xml_note->get_property("channel", channel)) {
warning << "note information missing channel" << endmsg;
- channel = 0;
}
- MidiModel::TimeType time;
+ MidiModel::TimeType time = MidiModel::TimeType();
if (!xml_note->get_property("time", time)) {
warning << "note information missing time" << endmsg;
- time = MidiModel::TimeType();
}
- MidiModel::TimeType length;
+ MidiModel::TimeType length = MidiModel::TimeType(1);
if (!xml_note->get_property("length", length)) {
warning << "note information missing length" << endmsg;
- length = MidiModel::TimeType(1);
}
- uint8_t velocity;
+ uint8_t velocity = 127;
if (!xml_note->get_property("velocity", velocity)) {
warning << "note information missing velocity" << endmsg;
- velocity = 127;
}
NotePtr note_ptr(new Evoral::Note<TimeType>(channel, time, length, note, velocity));
diff --git a/libs/ardour/midi_ring_buffer.cc b/libs/ardour/midi_ring_buffer.cc
index dfe7d89f1b..3b811dfa58 100644
--- a/libs/ardour/midi_ring_buffer.cc
+++ b/libs/ardour/midi_ring_buffer.cc
@@ -147,7 +147,8 @@ MidiRingBuffer<T>::skip_to(samplepos_t start)
while (this->read_space() >= prefix_size) {
uint8_t peekbuf[prefix_size];
- this->peek (peekbuf, prefix_size);
+ bool r = this->peek (peekbuf, prefix_size);
+ assert (r);
ev_time = *(reinterpret_cast<T*>((uintptr_t)peekbuf));
ev_size = *(reinterpret_cast<uint32_t*>((uintptr_t)(peekbuf + sizeof(T) + sizeof (Evoral::EventType))));
@@ -163,7 +164,7 @@ MidiRingBuffer<T>::skip_to(samplepos_t start)
this->increment_read_ptr (prefix_size);
uint8_t status;
- bool r = this->peek (&status, sizeof(uint8_t));
+ r = this->peek (&status, sizeof(uint8_t));
assert (r); // If this failed, buffer is corrupt, all hope is lost
++count;
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index 77f7265717..68081d6707 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -3407,11 +3407,12 @@ TempoMap::gui_stretch_tempo (TempoSection* ts, const samplepos_t sample, const s
if (ts_copy->clamped()) {
TempoSection* next_t = next_tempo_section_locked (future_map, ts_copy);
TempoSection* prev_to_ts_copy = previous_tempo_section_locked (future_map, ts_copy);
+ assert (prev_to_ts_copy);
/* the change in samples is the result of changing the slope of at most 2 previous tempo sections.
* constant to constant is straightforward, as the tempo prev to ts_copy has constant slope.
*/
double contribution = 0.0;
- if (next_t && prev_to_ts_copy && prev_to_ts_copy->type() == TempoSection::Ramp) {
+ if (next_t && prev_to_ts_copy->type() == TempoSection::Ramp) {
contribution = (ts_copy->pulse() - prev_to_ts_copy->pulse()) / (double) (next_t->pulse() - prev_to_ts_copy->pulse());
}
samplepos_t const fr_off = end_sample - sample;
diff --git a/libs/vamp-plugins/TruePeak.cpp b/libs/vamp-plugins/TruePeak.cpp
index 3d6c12ee2a..9a9f6f93d8 100644
--- a/libs/vamp-plugins/TruePeak.cpp
+++ b/libs/vamp-plugins/TruePeak.cpp
@@ -18,6 +18,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -392,6 +393,7 @@ TruePeakdsp::process (float const *d, int n)
float x = 0;
float v;
+ assert (_buf);
float *b = _buf;
while (n--) {
v = fabsf(*b++);