From 754c696aefafebcb03d80bf807b9a19f4492513b Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 24 Aug 2021 10:36:23 +0200 Subject: [PATCH] rawmidi: Use the standard types for snd_rawmidi_framing_tstamp_t definition Using the kernel-specific types like __u8 breaks the compilation of applications. Also we need the packed attribute. Although we may want to move to an opaque type later, let's put the workaround at first. Fixes: https://github.com/alsa-project/alsa-lib/issues/172 Signed-off-by: Takashi Iwai --- include/rawmidi.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/include/rawmidi.h b/include/rawmidi.h index 83210181..5866d133 100644 --- a/include/rawmidi.h +++ b/include/rawmidi.h @@ -98,19 +98,20 @@ typedef enum _snd_rawmidi_framing { #define SND_RAWMIDI_FRAMING_DATA_LENGTH 16 /** Incoming RawMidi bytes is put inside this container if tstamp type framing is enabled. */ -typedef struct _snd_rawmidi_framing_tstamp { +struct _snd_rawmidi_framing_tstamp { /** * For now, frame_type is always SND_RAWMIDI_FRAME_TYPE_DEFAULT. * Midi 2.0 is expected to add new types here. * Applications are expected to skip unknown frame types. */ - __u8 frame_type; - __u8 length; /* number of valid bytes in data field */ - __u8 reserved[2]; - __u32 tv_nsec; /* nanoseconds */ - __u64 tv_sec; /* seconds */ - __u8 data[SND_RAWMIDI_FRAMING_DATA_LENGTH]; -} snd_rawmidi_framing_tstamp_t; + uint8_t frame_type; + uint8_t length; /* number of valid bytes in data field */ + uint8_t reserved[2]; + uint32_t tv_nsec; /* nanoseconds */ + uint64_t tv_sec; /* seconds */ + uint8_t data[SND_RAWMIDI_FRAMING_DATA_LENGTH]; +} __attribute__((packed)); +typedef struct _snd_rawmidi_framing_tstamp snd_rawmidi_framing_tstamp_t; int snd_rawmidi_open(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi, const char *name, int mode); -- 2.47.3