13
0

Fix some clang warnings (argument with 'nonnull' attribute passed null)

This commit is contained in:
Robin Gareus 2018-01-26 13:56:19 +01:00
parent 76b7345ab6
commit 48c1a24284
3 changed files with 5 additions and 2 deletions

View File

@ -926,7 +926,9 @@ AudioSource::compute_and_write_peaks (Sample* buf, samplecnt_t first_sample, sam
memcpy (buf2.get(), peak_leftovers, peak_leftover_cnt * sizeof (Sample));
/* the new stuff */
memcpy (buf2.get()+peak_leftover_cnt, buf, cnt * sizeof (Sample));
if (buf && cnt > 0) {
memcpy (buf2.get()+peak_leftover_cnt, buf, cnt * sizeof (Sample));
}
/* no more leftovers */
peak_leftover_cnt = 0;

View File

@ -186,7 +186,7 @@ AlsaMidiIn::recv_event (pframes_t &time, uint8_t *data, size_t &size)
if (vector.len[0] > 0) {
memcpy ((uint8_t*)&h, vector.buf[0], vector.len[0]);
}
assert(vector.buf[1] || vector.len[0] == sizeof(MidiEventHeader));
assert(vector.buf[1]);
memcpy (((uint8_t*)&h) + vector.len[0], vector.buf[1], sizeof(MidiEventHeader) - vector.len[0]);
}

View File

@ -326,6 +326,7 @@ SMF::read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf, event_id_t* no
if (*size < (unsigned)event_size) {
*buf = (uint8_t*)realloc(*buf, event_size);
}
assert (*buf);
memcpy(*buf, event->midi_buffer, size_t(event_size));
*size = event_size;
if (((*buf)[0] & 0xF0) == 0x90 && (*buf)[2] == 0) {