[MPlayer-dev-eng] [PATCH] Ability to pass channel name in radio_set_channel command

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Fri Sep 1 20:16:26 CEST 2006


Hello,
On Sat, Sep 02, 2006 at 01:00:41AM +0700, Vladimir Voroshilov wrote:
> If channel parameter for radio_set_channel command converts to nonzero by atoi
> function it will be treated as channel number, otherwise - as channel name.

strtol would provide a more reliable way by checking if the result in
endptr parameter points to the terminating 0.


> +	tmp=priv->radio_channel_list;
> +	if (channel_int==0){
> +	    //channel is not a number, so it contains channel name or '0'
> +            for ( ; tmp; tmp=tmp->next)
> +		if (!strncmp(channel,tmp->name,sizeof(tmp->name)-1))
> +		    break;		    
> +    	    if (!tmp){
> +                mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_WrongChannelName,channel);
> +                return 0;
> +            }

You have a few stray tabs here...

> +	}else
> +            for (i = 1; i < channel_int; i++)
> +                if (tmp->next)
> +                    tmp = tmp->next;
> +                else
> +                    break;
> +            if (tmp->index!=channel_int){
> +                mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_WrongChannelNumberInt,channel_int);
> +                return 0;
> +            }

Changing the indentation of this part is cosmetics and (if desired)
should be done in a separate patch.

Greetings,
Reimar Döffinger



More information about the MPlayer-dev-eng mailing list