]> git.alsa-project.org Git - alsa-lib.git/commitdiff
rawmidi: Use the standard types for snd_rawmidi_framing_tstamp_t definition
authorTakashi Iwai <tiwai@suse.de>
Tue, 24 Aug 2021 08:36:23 +0000 (10:36 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 24 Aug 2021 08:40:14 +0000 (10:40 +0200)
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 <tiwai@suse.de>
include/rawmidi.h

index 83210181a51b6d963f638c8242799dbb007e0846..5866d133b46b0279c7ac3683234300594e6d83a4 100644 (file)
@@ -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);