[alsa-devel] [PATCH - UCM 1/2] control: enable octal and hexadecimal parse
![](https://secure.gravatar.com/avatar/f734b6c08b77e95c97cd2c950f7b8af8.jpg?s=120&d=mm&r=g)
From: "Lu, Han" han.lu@intel.com
Use zero-base for strtol(), so get_integer() and get_integer64() can parse decimal, octal and hexadecimal data from input string.
Signed-off-by: Lu, Han han.lu@intel.com
diff --git a/src/control/ctlparse.c b/src/control/ctlparse.c index 978977d..8d6c385 100644 --- a/src/control/ctlparse.c +++ b/src/control/ctlparse.c @@ -59,7 +59,7 @@ static long get_integer(const char **ptr, long min, long max) goto out;
s = p; - val = strtol(s, &p, 10); + val = strtol(s, &p, 0); if (*p == '.') { p++; strtol(p, &p, 10); @@ -87,7 +87,7 @@ static long long get_integer64(const char **ptr, long long min, long long max) goto out;
s = p; - val = strtol(s, &p, 10); + val = strtol(s, &p, 0); if (*p == '.') { p++; strtol(p, &p, 10);
![](https://secure.gravatar.com/avatar/5b19e9d0e834ea10ef75803718ad564b.jpg?s=120&d=mm&r=g)
At Wed, 14 Jan 2015 09:08:30 +0800, han.lu@intel.com wrote:
From: "Lu, Han" han.lu@intel.com
Use zero-base for strtol(), so get_integer() and get_integer64() can parse decimal, octal and hexadecimal data from input string.
Signed-off-by: Lu, Han han.lu@intel.com
Applied, thanks.
Takashi
diff --git a/src/control/ctlparse.c b/src/control/ctlparse.c index 978977d..8d6c385 100644 --- a/src/control/ctlparse.c +++ b/src/control/ctlparse.c @@ -59,7 +59,7 @@ static long get_integer(const char **ptr, long min, long max) goto out;
s = p;
- val = strtol(s, &p, 10);
- val = strtol(s, &p, 0); if (*p == '.') { p++; strtol(p, &p, 10);
@@ -87,7 +87,7 @@ static long long get_integer64(const char **ptr, long long min, long long max) goto out;
s = p;
- val = strtol(s, &p, 10);
- val = strtol(s, &p, 0); if (*p == '.') { p++; strtol(p, &p, 10);
-- 1.9.1
participants (2)
-
han.luļ¼ intel.com
-
Takashi Iwai