From: han.lu@intel.com
To: patch@alsa-project.org
Cc: "Lu, Han" <han.lu@intel.com>, alsa-devel@alsa-project.org
Subject: [PATCH - UCM 1/2] control: add hexadecimal parse
Date: Mon, 12 Jan 2015 13:21:16 +0800 [thread overview]
Message-ID: <1421040077-3494-1-git-send-email-han.lu@intel.com> (raw)
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
next reply other threads:[~2015-01-12 5:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-12 5:21 han.lu [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1421040077-3494-1-git-send-email-han.lu@intel.com \
--to=han.lu@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=patch@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).