Don't ever assume that isdigit() is always subset of isxdigit()
This commit is contained in:
parent
7bbd0c8b5b
commit
87c25490c8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=87042
@ -488,7 +488,7 @@ again: c = *fmt++;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!isxdigit(c))
|
||||
if (!isdigit(c) && (base != 16 || !isxdigit(c)))
|
||||
break;
|
||||
n = digittoint(c);
|
||||
if (n >= 16)
|
||||
|
@ -112,7 +112,7 @@ strtoimax(nptr, endptr, base)
|
||||
cutlim = cutoff % base;
|
||||
cutoff /= base;
|
||||
for ( ; ; c = *s++) {
|
||||
if (isxdigit(c))
|
||||
if (isdigit(c) || (base == 16 && isxdigit(c)))
|
||||
c = digittoint(c);
|
||||
else if (isascii(c) && isalpha(c))
|
||||
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
|
||||
|
@ -112,7 +112,7 @@ strtol(nptr, endptr, base)
|
||||
cutlim = cutoff % base;
|
||||
cutoff /= base;
|
||||
for ( ; ; c = *s++) {
|
||||
if (isxdigit(c))
|
||||
if (isdigit(c) || (base == 16 && isxdigit(c)))
|
||||
c = digittoint(c);
|
||||
else if (isascii(c) && isalpha(c))
|
||||
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
|
||||
|
@ -112,7 +112,7 @@ strtoll(nptr, endptr, base)
|
||||
cutlim = cutoff % base;
|
||||
cutoff /= base;
|
||||
for ( ; ; c = *s++) {
|
||||
if (isxdigit(c))
|
||||
if (isdigit(c) || (base == 16 && isxdigit(c)))
|
||||
c = digittoint(c);
|
||||
else if (isascii(c) && isalpha(c))
|
||||
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
|
||||
|
@ -90,7 +90,7 @@ strtoul(nptr, endptr, base)
|
||||
cutoff = ULONG_MAX / base;
|
||||
cutlim = ULONG_MAX % base;
|
||||
for ( ; ; c = *s++) {
|
||||
if (isxdigit(c))
|
||||
if (isdigit(c) || (base == 16 && isxdigit(c)))
|
||||
c = digittoint(c);
|
||||
else if (isascii(c) && isalpha(c))
|
||||
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
|
||||
|
@ -90,7 +90,7 @@ strtoull(nptr, endptr, base)
|
||||
cutoff = ULLONG_MAX / base;
|
||||
cutlim = ULLONG_MAX % base;
|
||||
for ( ; ; c = *s++) {
|
||||
if (isxdigit(c))
|
||||
if (isdigit(c) || (base == 16 && isxdigit(c)))
|
||||
c = digittoint(c);
|
||||
else if (isascii(c) && isalpha(c))
|
||||
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
|
||||
|
@ -90,7 +90,7 @@ strtoumax(nptr, endptr, base)
|
||||
cutoff = UINTMAX_MAX / base;
|
||||
cutlim = UINTMAX_MAX % base;
|
||||
for ( ; ; c = *s++) {
|
||||
if (isxdigit(c))
|
||||
if (isdigit(c) || (base == 16 && isxdigit(c)))
|
||||
c = digittoint(c);
|
||||
else if (isascii(c) && isalpha(c))
|
||||
c -= isupper(c) ? 'A' - 10 : 'a' - 10;
|
||||
|
Loading…
Reference in New Issue
Block a user