All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH - UCM 1/2] control: add hexadecimal parse
@ 2015-01-12  5:21 han.lu
  2015-01-12  5:21 ` [PATCH - UCM 2/2] ucm: add binary file parse han.lu
  2015-01-12  7:50 ` [PATCH - UCM 1/2] control: add hexadecimal parse Takashi Iwai
  0 siblings, 2 replies; 6+ messages in thread
From: han.lu @ 2015-01-12  5:21 UTC (permalink / raw)
  To: patch; +Cc: Lu, Han, alsa-devel

From: "Lu, Han" <han.lu@intel.com>

Signed-off-by: Lu, Han <han.lu@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);
 	if (*p == '.') {
 		p++;
 		strtol(p, &p, 10);
@@ -87,7 +90,10 @@ static long long get_integer64(const char **ptr, long long min, long 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);
 	if (*p == '.') {
 		p++;
 		strtol(p, &p, 10);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-13  3:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-12  5:21 [PATCH - UCM 1/2] control: add hexadecimal parse han.lu
2015-01-12  5:21 ` [PATCH - UCM 2/2] ucm: add binary file parse han.lu
2015-01-12 14:50   ` Takashi Iwai
2015-01-13  3:04     ` Lu, Han
2015-01-12  7:50 ` [PATCH - UCM 1/2] control: add hexadecimal parse Takashi Iwai
2015-01-13  3:02   ` Lu, Han

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.