control: enable octal and hexadecimal parse
PATCH 1/2 control: enable octal and hexadecimal parse
From: "Lu, Han" <[email protected]>
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 <[email protected]>
src/control/ctlparse.c +2 -2
@@ -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 );
Signature · 1 line
1.9.1
Takashi Iwai
AppliedAt Wed, 14 Jan 2015 09:08:30 +0800,
Quoted 7 lines · [email protected] wrote:
From: "Lu, Han" <[email protected]>
Use zero-base for
strtol(), soget_integer()andget_integer64()can parse decimal, octal and hexadecimal data from input string.Signed-off-by Lu, Han <[email protected]>
Applied, thanks.
Takashi
Quoted 26 lines
src/control/ctlparse.c +2
-2@@ -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 );Signature · 1 line
1.9.1