oss/alsa: Do not invoke UB described in 7.15.1.1 (this time for ADC)
Signed-off-by: malc <av1474@comtv.ru>
This commit is contained in:
		
							parent
							
								
									cbc18261ea
								
							
						
					
					
						commit
						a628b869be
					
				@ -1078,17 +1078,19 @@ static int alsa_read (SWVoiceIn *sw, void *buf, int size)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int alsa_ctl_in (HWVoiceIn *hw, int cmd, ...)
 | 
			
		||||
{
 | 
			
		||||
    ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;
 | 
			
		||||
 | 
			
		||||
    switch (cmd) {
 | 
			
		||||
    case VOICE_ENABLE:
 | 
			
		||||
        {
 | 
			
		||||
            va_list ap;
 | 
			
		||||
            int poll_mode;
 | 
			
		||||
    ALSAVoiceIn *alsa = (ALSAVoiceIn *) 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_in (hw)) {
 | 
			
		||||
                poll_mode = 0;
 | 
			
		||||
@ -1096,6 +1098,7 @@ static int alsa_ctl_in (HWVoiceIn *hw, int cmd, ...)
 | 
			
		||||
            hw->poll_mode = poll_mode;
 | 
			
		||||
 | 
			
		||||
            return alsa_voice_ctl (alsa->handle, "capture", 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    case VOICE_DISABLE:
 | 
			
		||||
        ldebug ("disabling voice\n");
 | 
			
		||||
 | 
			
		||||
@ -780,21 +780,24 @@ static int oss_read (SWVoiceIn *sw, void *buf, int size)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int oss_ctl_in (HWVoiceIn *hw, int cmd, ...)
 | 
			
		||||
{
 | 
			
		||||
    OSSVoiceIn *oss = (OSSVoiceIn *) hw;
 | 
			
		||||
 | 
			
		||||
    switch (cmd) {
 | 
			
		||||
    case VOICE_ENABLE:
 | 
			
		||||
        {
 | 
			
		||||
            va_list ap;
 | 
			
		||||
            int poll_mode;
 | 
			
		||||
    OSSVoiceIn *oss = (OSSVoiceIn *) hw;
 | 
			
		||||
 | 
			
		||||
            va_start (ap, cmd);
 | 
			
		||||
            poll_mode = va_arg (ap, int);
 | 
			
		||||
            va_end (ap);
 | 
			
		||||
 | 
			
		||||
    switch (cmd) {
 | 
			
		||||
    case VOICE_ENABLE:
 | 
			
		||||
            if (poll_mode && oss_poll_in (hw)) {
 | 
			
		||||
                poll_mode = 0;
 | 
			
		||||
            }
 | 
			
		||||
            hw->poll_mode = poll_mode;
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case VOICE_DISABLE:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user