summaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-02 23:21:40 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-02 23:21:40 +0000
commitb1bebd295585a016ee63a1e763005aee1c40bce9 (patch)
treeaa88e00458e0f3ba2f9681b0f8dc843a2d39d6aa /libc/stdlib
parentd666e2a91191f6c18b11fea585d09e0ebc6f2e2f (diff)
fix bug 1577: '`' is not an acceptable digit for strto[u]l().
Code size is not changed on i386.
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/stdlib.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index 87eaee66c..498522a50 100644
--- a/libc/stdlib/stdlib.c
+++ b/libc/stdlib/stdlib.c
@@ -509,7 +509,7 @@ libc_hidden_proto(__ctype_b)
unsigned long attribute_hidden __XL_NPP(_stdlib_strto_l)(register const Wchar * __restrict str,
Wchar ** __restrict endptr, int base,
- int sflag __LOCALE_PARAM )
+ int sflag __LOCALE_PARAM)
{
unsigned long number, cutoff;
#if _STRTO_ENDPTR
@@ -530,7 +530,7 @@ unsigned long attribute_hidden __XL_NPP(_stdlib_strto_l)(register const Wchar *
/* Handle optional sign. */
negative = 0;
- switch(*str) {
+ switch (*str) {
case '-': negative = 1; /* Fall through to increment str. */
case '+': ++str;
}
@@ -557,11 +557,11 @@ unsigned long attribute_hidden __XL_NPP(_stdlib_strto_l)(register const Wchar *
cutoff_digit = ULONG_MAX % base;
cutoff = ULONG_MAX / base;
do {
- digit = (((Wuchar)(*str - '0')) <= 9)
- ? (*str - '0')
- : ((*str >= 'A')
- ? (((0x20|(*str)) - 'a' + 10)) /* WARNING: assumes ascii. */
- : 40);
+ digit = ((Wuchar)(*str - '0') <= 9)
+ ? /* 0..9 */ (*str - '0')
+ : /* else */ (((Wuchar)(0x20 | *str) >= 'a') /* WARNING: assumes ascii. */
+ ? /* >= A/a */ ((Wuchar)(0x20 | *str) - ('a' - 10))
+ : /* else */ 40 /* bad value */);
if (digit >= base) {
break;
@@ -683,7 +683,7 @@ unsigned long long attribute_hidden __XL_NPP(_stdlib_strto_ll)(register const Wc
/* Handle optional sign. */
negative = 0;
- switch(*str) {
+ switch (*str) {
case '-': negative = 1; /* Fall through to increment str. */
case '+': ++str;
}
@@ -708,11 +708,11 @@ unsigned long long attribute_hidden __XL_NPP(_stdlib_strto_ll)(register const Wc
if (((unsigned)(base - 2)) < 35) { /* Legal base. */
do {
- digit = (((Wuchar)(*str - '0')) <= 9)
- ? (*str - '0')
- : ((*str >= 'A')
- ? (((0x20|(*str)) - 'a' + 10)) /* WARNING: assumes ascii. */
- : 40);
+ digit = ((Wuchar)(*str - '0') <= 9)
+ ? /* 0..9 */ (*str - '0')
+ : /* else */ (((Wuchar)(0x20 | *str) >= 'a') /* WARNING: assumes ascii. */
+ ? /* >= A/a */ ((Wuchar)(0x20 | *str) - ('a' - 10))
+ : /* else */ 40 /* bad value */);
if (digit >= base) {
break;