mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Fix type-punning
Fixed compile warnings on the latest gcc about type-punning. Removed unnecessary casts.
This commit is contained in:
parent
477325ddfb
commit
2f71b8753b
6 changed files with 71 additions and 74 deletions
|
|
@ -73,6 +73,14 @@
|
|||
#define _snd_seq_remove_events sndrv_seq_remove_events
|
||||
#define _snd_instr_header sndrv_seq_instr_header
|
||||
|
||||
#define sndrv_seq_addr snd_seq_addr
|
||||
#define sndrv_seq_tick_time_t snd_seq_tick_time_t
|
||||
#define sndrv_seq_real_time snd_seq_real_time
|
||||
#define sndrv_seq_timestamp snd_seq_timestamp
|
||||
#define sndrv_seq_instr snd_seq_instr
|
||||
#define sndrv_seq_event snd_seq_event
|
||||
#define sndrv_seq_instr_cluster_t snd_seq_instr_cluster_t
|
||||
|
||||
#if 0
|
||||
typedef struct sndrv_seq_addr snd_seq_addr_t;
|
||||
#define snd_seq_tick_time_t sndrv_seq_tick_time_t
|
||||
|
|
@ -96,7 +104,6 @@ typedef struct sndrv_seq_event snd_seq_event_t;
|
|||
|
||||
#include <sound/asound.h>
|
||||
#include <sound/asoundef.h>
|
||||
#include <sound/asequencer.h>
|
||||
#include "alsa-symbols.h"
|
||||
#include "version.h"
|
||||
#include "global.h"
|
||||
|
|
@ -113,6 +120,7 @@ typedef struct sndrv_seq_event snd_seq_event_t;
|
|||
#include "mixer.h"
|
||||
#include "seq_event.h"
|
||||
#include "seq.h"
|
||||
#include <sound/asequencer.h>
|
||||
#include "seqmid.h"
|
||||
#include "seq_midi_event.h"
|
||||
#include "conv.h"
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
/** version of the sequencer */
|
||||
#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
|
||||
|
||||
#ifdef __KERNEL__
|
||||
/**
|
||||
* definition of sequencer event types
|
||||
*/
|
||||
|
|
@ -474,6 +475,8 @@ struct sndrv_seq_event_bounce {
|
|||
/* queue sync port */
|
||||
#define sndrv_seq_queue_sync_port(q) ((q) + 16)
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
/* system information */
|
||||
struct sndrv_seq_system_info {
|
||||
int queues; /* maximum queues count */
|
||||
|
|
|
|||
|
|
@ -745,9 +745,9 @@ int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
return -EBADFD;
|
||||
memset(params, 0, snd_pcm_hw_params_sizeof());
|
||||
params->flags = pcm->hw_flags;
|
||||
snd_mask_copy(¶ms->masks[SND_PCM_HW_PARAM_ACCESS - SND_PCM_HW_PARAM_FIRST_MASK], (snd_mask_t *)&pcm->access);
|
||||
snd_mask_copy(¶ms->masks[SND_PCM_HW_PARAM_FORMAT - SND_PCM_HW_PARAM_FIRST_MASK], (snd_mask_t *)&pcm->format);
|
||||
snd_mask_copy(¶ms->masks[SND_PCM_HW_PARAM_SUBFORMAT - SND_PCM_HW_PARAM_FIRST_MASK], (snd_mask_t *)&pcm->subformat);
|
||||
snd_mask_set(¶ms->masks[SND_PCM_HW_PARAM_ACCESS - SND_PCM_HW_PARAM_FIRST_MASK], pcm->access);
|
||||
snd_mask_set(¶ms->masks[SND_PCM_HW_PARAM_FORMAT - SND_PCM_HW_PARAM_FIRST_MASK], pcm->format);
|
||||
snd_mask_set(¶ms->masks[SND_PCM_HW_PARAM_SUBFORMAT - SND_PCM_HW_PARAM_FIRST_MASK], pcm->subformat);
|
||||
frame_bits = snd_pcm_format_physical_width(pcm->format) * pcm->channels;
|
||||
snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_FRAME_BITS - SND_PCM_HW_PARAM_FIRST_INTERVAL], frame_bits);
|
||||
snd_interval_set_value(¶ms->intervals[SND_PCM_HW_PARAM_CHANNELS - SND_PCM_HW_PARAM_FIRST_INTERVAL], pcm->channels);
|
||||
|
|
|
|||
|
|
@ -623,38 +623,24 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int linear_formats[4*2*2] = {
|
||||
SNDRV_PCM_FORMAT_S8,
|
||||
SNDRV_PCM_FORMAT_S8,
|
||||
SNDRV_PCM_FORMAT_U8,
|
||||
SNDRV_PCM_FORMAT_U8,
|
||||
SNDRV_PCM_FORMAT_S16_LE,
|
||||
SNDRV_PCM_FORMAT_S16_BE,
|
||||
SNDRV_PCM_FORMAT_U16_LE,
|
||||
SNDRV_PCM_FORMAT_U16_BE,
|
||||
SNDRV_PCM_FORMAT_S24_LE,
|
||||
SNDRV_PCM_FORMAT_S24_BE,
|
||||
SNDRV_PCM_FORMAT_U24_LE,
|
||||
SNDRV_PCM_FORMAT_U24_BE,
|
||||
SNDRV_PCM_FORMAT_S32_LE,
|
||||
SNDRV_PCM_FORMAT_S32_BE,
|
||||
SNDRV_PCM_FORMAT_U32_LE,
|
||||
SNDRV_PCM_FORMAT_U32_BE
|
||||
static int linear_formats[4][2][2] = {
|
||||
{ { SNDRV_PCM_FORMAT_S8, SNDRV_PCM_FORMAT_S8 },
|
||||
{ SNDRV_PCM_FORMAT_U8, SNDRV_PCM_FORMAT_U8 } },
|
||||
{ { SNDRV_PCM_FORMAT_S16_LE, SNDRV_PCM_FORMAT_S16_BE },
|
||||
{ SNDRV_PCM_FORMAT_U16_LE, SNDRV_PCM_FORMAT_U16_BE } },
|
||||
{ { SNDRV_PCM_FORMAT_S24_LE, SNDRV_PCM_FORMAT_S24_BE },
|
||||
{ SNDRV_PCM_FORMAT_U24_LE, SNDRV_PCM_FORMAT_U24_BE } },
|
||||
{ { SNDRV_PCM_FORMAT_S32_LE, SNDRV_PCM_FORMAT_S32_BE },
|
||||
{ SNDRV_PCM_FORMAT_U32_LE, SNDRV_PCM_FORMAT_U32_BE } }
|
||||
};
|
||||
|
||||
static int linear24_formats[3*2*2] = {
|
||||
SNDRV_PCM_FORMAT_S24_3LE,
|
||||
SNDRV_PCM_FORMAT_S24_3BE,
|
||||
SNDRV_PCM_FORMAT_U24_3LE,
|
||||
SNDRV_PCM_FORMAT_U24_3BE,
|
||||
SNDRV_PCM_FORMAT_S20_3LE,
|
||||
SNDRV_PCM_FORMAT_S20_3BE,
|
||||
SNDRV_PCM_FORMAT_U20_3LE,
|
||||
SNDRV_PCM_FORMAT_U20_3BE,
|
||||
SNDRV_PCM_FORMAT_S18_3LE,
|
||||
SNDRV_PCM_FORMAT_S18_3BE,
|
||||
SNDRV_PCM_FORMAT_U18_3LE,
|
||||
SNDRV_PCM_FORMAT_U18_3BE,
|
||||
static int linear24_formats[3][2][2] = {
|
||||
{ { SNDRV_PCM_FORMAT_S24_3LE, SNDRV_PCM_FORMAT_S24_3BE },
|
||||
{ SNDRV_PCM_FORMAT_U24_3LE, SNDRV_PCM_FORMAT_U24_3BE } },
|
||||
{ { SNDRV_PCM_FORMAT_S20_3LE, SNDRV_PCM_FORMAT_S20_3BE },
|
||||
{ SNDRV_PCM_FORMAT_U20_3LE, SNDRV_PCM_FORMAT_U20_3BE } },
|
||||
{ { SNDRV_PCM_FORMAT_S18_3LE, SNDRV_PCM_FORMAT_S18_3BE },
|
||||
{ SNDRV_PCM_FORMAT_U18_3LE, SNDRV_PCM_FORMAT_U18_3BE } },
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -681,7 +667,7 @@ snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd,
|
|||
default:
|
||||
return SND_PCM_FORMAT_UNKNOWN;
|
||||
}
|
||||
return ((int(*)[2][2])linear24_formats)[width][!!unsignd][!!big_endian];
|
||||
return linear24_formats[width][!!unsignd][!!big_endian];
|
||||
} else {
|
||||
switch (width) {
|
||||
case 8:
|
||||
|
|
@ -699,7 +685,7 @@ snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd,
|
|||
default:
|
||||
return SND_PCM_FORMAT_UNKNOWN;
|
||||
}
|
||||
return ((int(*)[2][2])linear_formats)[width][!!unsignd][!!big_endian];
|
||||
return linear_formats[width][!!unsignd][!!big_endian];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1790,7 +1790,7 @@ int snd_seq_port_info_get_port(const snd_seq_port_info_t *info)
|
|||
const snd_seq_addr_t *snd_seq_port_info_get_addr(const snd_seq_port_info_t *info)
|
||||
{
|
||||
assert(info);
|
||||
return (snd_seq_addr_t *)&info->addr;
|
||||
return &info->addr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1985,7 +1985,7 @@ void snd_seq_port_info_set_port(snd_seq_port_info_t *info, int port)
|
|||
void snd_seq_port_info_set_addr(snd_seq_port_info_t *info, const snd_seq_addr_t *addr)
|
||||
{
|
||||
assert(info);
|
||||
info->addr = *(struct sndrv_seq_addr *)addr;
|
||||
info->addr = *addr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2333,7 +2333,7 @@ void snd_seq_port_subscribe_copy(snd_seq_port_subscribe_t *dst, const snd_seq_po
|
|||
const snd_seq_addr_t *snd_seq_port_subscribe_get_sender(const snd_seq_port_subscribe_t *info)
|
||||
{
|
||||
assert(info);
|
||||
return (snd_seq_addr_t *)&info->sender;
|
||||
return &info->sender;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2345,7 +2345,7 @@ const snd_seq_addr_t *snd_seq_port_subscribe_get_sender(const snd_seq_port_subsc
|
|||
const snd_seq_addr_t *snd_seq_port_subscribe_get_dest(const snd_seq_port_subscribe_t *info)
|
||||
{
|
||||
assert(info);
|
||||
return (snd_seq_addr_t *)&info->dest;
|
||||
return &info->dest;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2618,7 +2618,7 @@ int snd_seq_query_subscribe_get_port(const snd_seq_query_subscribe_t *info)
|
|||
const snd_seq_addr_t *snd_seq_query_subscribe_get_root(const snd_seq_query_subscribe_t *info)
|
||||
{
|
||||
assert(info);
|
||||
return (snd_seq_addr_t *)&info->root;
|
||||
return &info->root;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2670,7 +2670,7 @@ int snd_seq_query_subscribe_get_num_subs(const snd_seq_query_subscribe_t *info)
|
|||
const snd_seq_addr_t *snd_seq_query_subscribe_get_addr(const snd_seq_query_subscribe_t *info)
|
||||
{
|
||||
assert(info);
|
||||
return (snd_seq_addr_t *)&info->addr;
|
||||
return &info->addr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2761,7 +2761,7 @@ void snd_seq_query_subscribe_set_port(snd_seq_query_subscribe_t *info, int port)
|
|||
void snd_seq_query_subscribe_set_root(snd_seq_query_subscribe_t *info, const snd_seq_addr_t *addr)
|
||||
{
|
||||
assert(info);
|
||||
info->root = *(struct sndrv_seq_addr *)addr;
|
||||
info->root = *addr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -3240,7 +3240,7 @@ snd_seq_tick_time_t snd_seq_queue_status_get_tick_time(const snd_seq_queue_statu
|
|||
const snd_seq_real_time_t *snd_seq_queue_status_get_real_time(const snd_seq_queue_status_t *info)
|
||||
{
|
||||
assert(info);
|
||||
return (snd_seq_real_time_t *)&info->time;
|
||||
return &info->time;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -3687,7 +3687,7 @@ ssize_t snd_seq_event_length(snd_seq_event_t *ev)
|
|||
{
|
||||
ssize_t len = sizeof(snd_seq_event_t);
|
||||
assert(ev);
|
||||
if (sndrv_seq_ev_is_variable(ev))
|
||||
if (snd_seq_ev_is_variable(ev))
|
||||
len += ev->data.ext.len;
|
||||
return len;
|
||||
}
|
||||
|
|
@ -3753,7 +3753,7 @@ int snd_seq_event_output_buffer(snd_seq_t *seq, snd_seq_event_t *ev)
|
|||
return -EAGAIN;
|
||||
memcpy(seq->obuf + seq->obufused, ev, sizeof(snd_seq_event_t));
|
||||
seq->obufused += sizeof(snd_seq_event_t);
|
||||
if (sndrv_seq_ev_is_variable(ev)) {
|
||||
if (snd_seq_ev_is_variable(ev)) {
|
||||
memcpy(seq->obuf + seq->obufused, ev->data.ext.ptr, ev->data.ext.len);
|
||||
seq->obufused += ev->data.ext.len;
|
||||
}
|
||||
|
|
@ -3882,7 +3882,7 @@ int snd_seq_extract_output(snd_seq_t *seq, snd_seq_event_t **ev_res)
|
|||
*ev_res = NULL;
|
||||
if ((olen = seq->obufused) < sizeof(snd_seq_event_t))
|
||||
return -ENOENT;
|
||||
memcpy(&ev, (snd_seq_event_t*)seq->obuf, sizeof(snd_seq_event_t));
|
||||
memcpy(&ev, seq->obuf, sizeof(snd_seq_event_t));
|
||||
len = snd_seq_event_length(&ev);
|
||||
if (ev_res) {
|
||||
/* extract the event */
|
||||
|
|
@ -3924,7 +3924,7 @@ static int snd_seq_event_retrieve_buffer(snd_seq_t *seq, snd_seq_event_t **retp)
|
|||
*retp = ev = &seq->ibuf[seq->ibufptr];
|
||||
seq->ibufptr++;
|
||||
seq->ibuflen--;
|
||||
if (! sndrv_seq_ev_is_variable(ev))
|
||||
if (! snd_seq_ev_is_variable(ev))
|
||||
return 1;
|
||||
ncells = (ev->data.ext.len + sizeof(snd_seq_event_t) - 1) / sizeof(snd_seq_event_t);
|
||||
if (seq->ibuflen < ncells) {
|
||||
|
|
@ -4178,7 +4178,7 @@ int snd_seq_remove_events_get_queue(const snd_seq_remove_events_t *info)
|
|||
const snd_seq_timestamp_t *snd_seq_remove_events_get_time(const snd_seq_remove_events_t *info)
|
||||
{
|
||||
assert(info);
|
||||
return (snd_seq_timestamp_t *)&info->time;
|
||||
return &info->time;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4191,7 +4191,7 @@ const snd_seq_timestamp_t *snd_seq_remove_events_get_time(const snd_seq_remove_e
|
|||
const snd_seq_addr_t *snd_seq_remove_events_get_dest(const snd_seq_remove_events_t *info)
|
||||
{
|
||||
assert(info);
|
||||
return (snd_seq_addr_t *)&info->dest;
|
||||
return &info->dest;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4269,7 +4269,7 @@ void snd_seq_remove_events_set_queue(snd_seq_remove_events_t *info, int queue)
|
|||
void snd_seq_remove_events_set_time(snd_seq_remove_events_t *info, const snd_seq_timestamp_t *time)
|
||||
{
|
||||
assert(info);
|
||||
info->time = *(union sndrv_seq_timestamp *)time;
|
||||
info->time = *time;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4282,7 +4282,7 @@ void snd_seq_remove_events_set_time(snd_seq_remove_events_t *info, const snd_seq
|
|||
void snd_seq_remove_events_set_dest(snd_seq_remove_events_t *info, const snd_seq_addr_t *addr)
|
||||
{
|
||||
assert(info);
|
||||
info->dest = *(struct sndrv_seq_addr *)addr;
|
||||
info->dest = *addr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4354,7 +4354,7 @@ static int remove_match(snd_seq_remove_events_t *info, snd_seq_event_t *ev)
|
|||
return 0;
|
||||
}
|
||||
if (info->remove_mode & SNDRV_SEQ_REMOVE_DEST_CHANNEL) {
|
||||
if (! sndrv_seq_ev_is_channel_type(ev))
|
||||
if (! snd_seq_ev_is_channel_type(ev))
|
||||
return 0;
|
||||
/* data.note.channel and data.control.channel are identical */
|
||||
if (ev->data.note.channel != info->channel)
|
||||
|
|
@ -4362,17 +4362,17 @@ static int remove_match(snd_seq_remove_events_t *info, snd_seq_event_t *ev)
|
|||
}
|
||||
if (info->remove_mode & SNDRV_SEQ_REMOVE_TIME_AFTER) {
|
||||
if (info->remove_mode & SNDRV_SEQ_REMOVE_TIME_TICK)
|
||||
res = snd_seq_compare_tick_time(&ev->time.tick, (snd_seq_tick_time_t *)&info->time.tick);
|
||||
res = snd_seq_compare_tick_time(&ev->time.tick, &info->time.tick);
|
||||
else
|
||||
res = snd_seq_compare_real_time(&ev->time.time, (snd_seq_real_time_t *)&info->time.time);
|
||||
res = snd_seq_compare_real_time(&ev->time.time, &info->time.time);
|
||||
if (!res)
|
||||
return 0;
|
||||
}
|
||||
if (info->remove_mode & SNDRV_SEQ_REMOVE_TIME_BEFORE) {
|
||||
if (info->remove_mode & SNDRV_SEQ_REMOVE_TIME_TICK)
|
||||
res = snd_seq_compare_tick_time(&ev->time.tick, (snd_seq_tick_time_t *)&info->time.tick);
|
||||
res = snd_seq_compare_tick_time(&ev->time.tick, &info->time.tick);
|
||||
else
|
||||
res = snd_seq_compare_real_time(&ev->time.time, (snd_seq_real_time_t *)&info->time.time);
|
||||
res = snd_seq_compare_real_time(&ev->time.time, &info->time.time);
|
||||
if (res)
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -4383,8 +4383,8 @@ static int remove_match(snd_seq_remove_events_t *info, snd_seq_event_t *ev)
|
|||
if (info->remove_mode & SNDRV_SEQ_REMOVE_IGNORE_OFF) {
|
||||
/* Do not remove off events */
|
||||
switch (ev->type) {
|
||||
case SNDRV_SEQ_EVENT_NOTEOFF:
|
||||
/* case SNDRV_SEQ_EVENT_SAMPLE_STOP: */
|
||||
case SND_SEQ_EVENT_NOTEOFF:
|
||||
/* case SND_SEQ_EVENT_SAMPLE_STOP: */
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -4435,7 +4435,7 @@ int snd_seq_remove_events(snd_seq_t *seq, snd_seq_remove_events_t *rmp)
|
|||
ep = seq->obuf;
|
||||
while (ep - seq->obuf < (ssize_t)seq->obufused) {
|
||||
|
||||
ev = (snd_seq_event_t *) ep;
|
||||
ev = ep;
|
||||
len = snd_seq_event_length(ev);
|
||||
|
||||
if (remove_match(rmp, ev)) {
|
||||
|
|
@ -4721,7 +4721,7 @@ void snd_instr_header_copy(snd_instr_header_t *dst, const snd_instr_header_t *sr
|
|||
const snd_seq_instr_t *snd_instr_header_get_id(const snd_instr_header_t *info)
|
||||
{
|
||||
assert(info);
|
||||
return (snd_seq_instr_t *)&info->id.instr;
|
||||
return &info->id.instr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4798,7 +4798,7 @@ const char *snd_instr_header_get_format(const snd_instr_header_t *info)
|
|||
const snd_seq_instr_t *snd_instr_header_get_alias(const snd_instr_header_t *info)
|
||||
{
|
||||
assert(info);
|
||||
return (snd_seq_instr_t *)&info->data.data.alias;
|
||||
return &info->data.data.alias;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4831,7 +4831,7 @@ int snd_instr_header_get_follow_alias(const snd_instr_header_t *info)
|
|||
void snd_instr_header_set_id(snd_instr_header_t *info, const snd_seq_instr_t *id)
|
||||
{
|
||||
assert(info && id);
|
||||
info->id.instr = *(struct sndrv_seq_instr *)id;
|
||||
info->id.instr = *id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4908,7 +4908,7 @@ void snd_instr_header_set_format(snd_instr_header_t *info, const char *format)
|
|||
void snd_instr_header_set_alias(snd_instr_header_t *info, const snd_seq_instr_t *instr)
|
||||
{
|
||||
assert(info && instr);
|
||||
info->data.data.alias = *(struct sndrv_seq_instr *)instr;
|
||||
info->data.data.alias = *instr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -307,8 +307,8 @@ int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev
|
|||
if (c >= MIDI_CMD_COMMON_CLOCK) {
|
||||
/* real-time event */
|
||||
ev->type = status_event[ST_SPECIAL + c - 0xf0].event;
|
||||
ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK;
|
||||
ev->flags |= SNDRV_SEQ_EVENT_LENGTH_FIXED;
|
||||
ev->flags &= ~SND_SEQ_EVENT_LENGTH_MASK;
|
||||
ev->flags |= SND_SEQ_EVENT_LENGTH_FIXED;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -335,17 +335,17 @@ int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev
|
|||
}
|
||||
if (dev->qlen == 0) {
|
||||
ev->type = status_event[dev->type].event;
|
||||
ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK;
|
||||
ev->flags |= SNDRV_SEQ_EVENT_LENGTH_FIXED;
|
||||
ev->flags &= ~SND_SEQ_EVENT_LENGTH_MASK;
|
||||
ev->flags |= SND_SEQ_EVENT_LENGTH_FIXED;
|
||||
if (status_event[dev->type].encode) /* set data values */
|
||||
status_event[dev->type].encode(dev, ev);
|
||||
rc = 1;
|
||||
} else if (dev->type == ST_SYSEX) {
|
||||
if (c == MIDI_CMD_COMMON_SYSEX_END ||
|
||||
dev->read >= dev->bufsize) {
|
||||
ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK;
|
||||
ev->flags |= SNDRV_SEQ_EVENT_LENGTH_VARIABLE;
|
||||
ev->type = SNDRV_SEQ_EVENT_SYSEX;
|
||||
ev->flags &= ~SND_SEQ_EVENT_LENGTH_MASK;
|
||||
ev->flags |= SND_SEQ_EVENT_LENGTH_VARIABLE;
|
||||
ev->type = SND_SEQ_EVENT_SYSEX;
|
||||
ev->data.ext.len = dev->read;
|
||||
ev->data.ext.ptr = dev->buf;
|
||||
if (c != MIDI_CMD_COMMON_SYSEX_END)
|
||||
|
|
@ -417,7 +417,7 @@ long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count
|
|||
long qlen;
|
||||
unsigned int type;
|
||||
|
||||
if (ev->type == SNDRV_SEQ_EVENT_NONE)
|
||||
if (ev->type == SND_SEQ_EVENT_NONE)
|
||||
return -ENOENT;
|
||||
|
||||
for (type = 0; type < numberof(status_event); type++) {
|
||||
|
|
@ -442,8 +442,8 @@ long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count
|
|||
qlen = ev->data.ext.len;
|
||||
if (count < qlen)
|
||||
return -ENOMEM;
|
||||
switch (ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) {
|
||||
case SNDRV_SEQ_EVENT_LENGTH_FIXED:
|
||||
switch (ev->flags & SND_SEQ_EVENT_LENGTH_MASK) {
|
||||
case SND_SEQ_EVENT_LENGTH_FIXED:
|
||||
return -EINVAL; /* invalid event */
|
||||
}
|
||||
memcpy(buf, ev->data.ext.ptr, qlen);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue