oss/alsa: Do not invoke UB described in 7.15.1.1
Additional argument (whether to try poll mode) is only passed with VOICE_ENABLE command. Thanks to Markus Armbruster for noticing the potential breakage.
This commit is contained in:
parent
c227f0995e
commit
301901b56c
@ -861,22 +861,25 @@ static int alsa_voice_ctl (snd_pcm_t *handle, const char *typ, int pause)
|
||||
|
||||
static int alsa_ctl_out (HWVoiceOut *hw, int cmd, ...)
|
||||
{
|
||||
ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw;
|
||||
|
||||
switch (cmd) {
|
||||
case VOICE_ENABLE:
|
||||
{
|
||||
va_list ap;
|
||||
int poll_mode;
|
||||
ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw;
|
||||
|
||||
va_start (ap, cmd);
|
||||
poll_mode = va_arg (ap, int);
|
||||
va_end (ap);
|
||||
|
||||
switch (cmd) {
|
||||
case VOICE_ENABLE:
|
||||
ldebug ("enabling voice\n");
|
||||
if (poll_mode && alsa_poll_out (hw)) {
|
||||
poll_mode = 0;
|
||||
}
|
||||
hw->poll_mode = poll_mode;
|
||||
return alsa_voice_ctl (alsa->handle, "playback", 0);
|
||||
}
|
||||
|
||||
case VOICE_DISABLE:
|
||||
ldebug ("disabling voice\n");
|
||||
|
@ -583,16 +583,18 @@ static int oss_init_out (HWVoiceOut *hw, struct audsettings *as)
|
||||
static int oss_ctl_out (HWVoiceOut *hw, int cmd, ...)
|
||||
{
|
||||
int trig;
|
||||
OSSVoiceOut *oss = (OSSVoiceOut *) hw;
|
||||
|
||||
switch (cmd) {
|
||||
case VOICE_ENABLE:
|
||||
{
|
||||
va_list ap;
|
||||
int poll_mode;
|
||||
OSSVoiceOut *oss = (OSSVoiceOut *) hw;
|
||||
|
||||
va_start (ap, cmd);
|
||||
poll_mode = va_arg (ap, int);
|
||||
va_end (ap);
|
||||
|
||||
switch (cmd) {
|
||||
case VOICE_ENABLE:
|
||||
ldebug ("enabling voice\n");
|
||||
if (poll_mode && oss_poll_out (hw)) {
|
||||
poll_mode = 0;
|
||||
@ -612,6 +614,7 @@ static int oss_ctl_out (HWVoiceOut *hw, int cmd, ...)
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case VOICE_DISABLE:
|
||||
|
Loading…
Reference in New Issue
Block a user