diff options
author | cbdev <cb@cbcdn.com> | 2019-08-10 20:30:07 +0200 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2019-08-10 20:30:07 +0200 |
commit | 48bf96602023b2ead855f13477b6f5e26b663b45 (patch) | |
tree | dbdcb002c0211b566487c174834a408ba881958c /backends/midi.c | |
parent | cf93d280af47aea1bf8bdafa30eabb2c2de005b8 (diff) | |
download | midimonster-48bf96602023b2ead855f13477b6f5e26b663b45.tar.gz midimonster-48bf96602023b2ead855f13477b6f5e26b663b45.tar.bz2 midimonster-48bf96602023b2ead855f13477b6f5e26b663b45.zip |
Clean up & check unions
Diffstat (limited to 'backends/midi.c')
-rw-r--r-- | backends/midi.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/backends/midi.c b/backends/midi.c index 9c6ba80..5b8e561 100644 --- a/backends/midi.c +++ b/backends/midi.c @@ -4,15 +4,6 @@ #define BACKEND_NAME "midi" static snd_seq_t* sequencer = NULL; -typedef union { - struct { - uint8_t pad[5]; - uint8_t type; - uint8_t channel; - uint8_t control; - } fields; - uint64_t label; -} midi_channel_ident; enum /*_midi_channel_type*/ { none = 0, @@ -44,6 +35,11 @@ int init(){ .shutdown = midi_shutdown }; + if(sizeof(midi_channel_ident) != sizeof(uint64_t)){ + fprintf(stderr, "MIDI channel identification union out of bounds\n"); + return 1; + } + if(snd_seq_open(&sequencer, "default", SND_SEQ_OPEN_DUPLEX, 0) < 0){ fprintf(stderr, "Failed to open ALSA sequencer\n"); return 1; |