[alsa-devel] [PATCH - UCM 1/2] control: enable octal and hexadecimal parse

Lu, Han han.lu at intel.com
Wed Jan 14 02:28:00 CET 2015


> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai at suse.de]
> Sent: Wednesday, January 14, 2015 4:02 AM
> To: Takashi Iwai
> Cc: Lu, Han; Liam Girdwood; alsa-devel at alsa-project.org
> Subject: Re: [PATCH - UCM 1/2] control: enable octal and hexadecimal parse
> 
> At Tue, 13 Jan 2015 17:53:14 +0100,
> Takashi Iwai wrote:
> >
> > At Tue, 13 Jan 2015 11:00:38 +0800,
> > han.lu at intel.com wrote:
> > >
> > > From: "Lu, Han" <han.lu at intel.com>
> > >
> > > Signed-off-by: Lu, Han <han.lu at intel.com>
> >
> > Looks good to me.  Liam, any objection for this extension?
> 
> Erm, sorry, I correct my statement: this is buggy.  Look at the code:
> 
> > > -	val = strtol(s, &p, 10);
> > > +	val = strtol(s, &p, 0);
> > >  	if (*p == '.') {
> > >  		p++;
> > > -		strtol(p, &p, 10);
> > > +		strtol(p, &p, 0);
> 
> The second strtol() is for skipping the decimals.  So this has to be 10-based.
> That is, use zero-base only for the first strtol().
> 
Yes. I thought of skipping hexadecimal, but string begin with ".0x" looks not reasonable, and string begin with ".0" will not be skipped as expected with this patch.
I have removed the second change and resend the patch. Please review, Thanks.

BR,
Han Lu
> 
> Takashi


More information about the Alsa-devel mailing list