coverity.com fixes - initial round

This commit tries to fix a bunch of issues found
by coverity.com.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-11-10 17:56:27 +01:00
parent f0679e5de2
commit 47f4f9b73b
40 changed files with 283 additions and 133 deletions

View file

@ -181,7 +181,7 @@ static int snd_rawmidi_virtual_drain(snd_rawmidi_t *rmidi)
virt->pending = 0;
}
snd_seq_drain_output(virt->handle);
snd_seq_sync_output_queue(virt->handle);
(void)snd_seq_sync_output_queue(virt->handle);
}
return snd_rawmidi_virtual_drop(rmidi);
}

View file

@ -1099,11 +1099,11 @@ int snd_ump_msg_sysex_expand(const uint32_t *ump, uint8_t *buf, size_t maxlen,
*/
int snd_ump_packet_length(unsigned int type)
{
static int packet_length[16] = {
static unsigned char packet_length[16] = {
1, 1, 1, 2, 2, 4, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4
};
if (type > 16)
if (type >= sizeof(packet_length))
return 0;
return packet_length[type];
}