From: viro@parcelfarce.linux.theplanet.co.uk
To: Deepak Saxena <dsaxena@mvista.com>
Cc: Linus Torvalds <torvalds@osdl.org>,
linux-kernel@vger.kernel.org, marcelo.tosatti@cyclades.com.br
Subject: Re: [PATCH] Fix %x parsing in vsscanf()
Date: Tue, 23 Sep 2003 23:26:32 +0100 [thread overview]
Message-ID: <20030923222632.GO7665@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20030923221611.GA25464@xanadu.az.mvista.com>
On Tue, Sep 23, 2003 at 03:16:11PM -0700, Deepak Saxena wrote:
> {
> unsigned long result = 0,value;
>
> + if ((base == 16) && (cp[0] == '0' && (cp[1] == 'x' || cp[1] == 'X')))
> + cp += 2;
> if (!base) {
> base = 10;
> if (*cp == '0') {
Not quite right.
a) on "0xZ" correct reaction is to eat '0' and stop.
b) while we are at it, might as well fix the case of 0X<...> with
base 0.
The following, AFAICS, would be correct:
if (*cp == '0') {
cp++;
if (unlikely((*cp == 'x' || *cp == 'X') && isxdigit(cp[1]))) {
if (!base || base == 16) {
cp++;
base = 16;
}
} else if (!base)
base = 8;
} else if (!base)
base = 10;
next prev parent reply other threads:[~2003-09-23 22:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-23 21:22 Deepak Saxena
2003-09-23 21:26 ` viro
2003-09-23 21:28 ` Linus Torvalds
2003-09-23 21:35 ` viro
2003-09-23 22:16 ` Deepak Saxena
2003-09-23 22:26 ` viro [this message]
2003-09-24 1:02 ` Deepak Saxena
2003-09-24 0:55 ` viro
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=20030923222632.GO7665@parcelfarce.linux.theplanet.co.uk \
--to=viro@parcelfarce.linux.theplanet.co.uk \
--cc=dsaxena@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com.br \
--cc=torvalds@osdl.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
all inboxes | Powered by JetHome®