[alsa-devel] [PATCH - UCM 1/2] control: add hexadecimal parse
Lu, Han
han.lu at intel.com
Tue Jan 13 04:02:02 CET 2015
Hi Takashi,
BR,
Han Lu
> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai at suse.de]
> Sent: Monday, January 12, 2015 3:50 PM
> To: Lu, Han
> Cc: alsa-devel at alsa-project.org
> Subject: Re: [PATCH - UCM 1/2] control: add hexadecimal parse
>
> At Mon, 12 Jan 2015 13:21:16 +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>
> >
> > diff --git a/src/control/ctlparse.c b/src/control/ctlparse.c index
> > 978977d..92e2f95 100644
> > --- a/src/control/ctlparse.c
> > +++ b/src/control/ctlparse.c
> > @@ -59,7 +59,10 @@ static long get_integer(const char **ptr, long min,
> long max)
> > goto out;
> >
> > s = p;
> > - val = strtol(s, &p, 10);
> > + if (*p == '0' && (*(p+1) == 'x' || *(p+1) == 'X'))
> > + val = strtol(s, &p, 16);
> > + else
> > + val = strtol(s, &p, 10);
>
> Just pass 0 to the base of strtol() instead of 10. That'll do everything.
>
Thank you, I have validated it and resend the patch.
>
> Takashi
More information about the Alsa-devel
mailing list