diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-03-23 06:22:17 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-03-23 06:22:17 -0700 |
commit | a8440a58be20cd8bcfa78b74ed39e5cffcbc0f30 (patch) | |
tree | 17c7de237bda356eeff90fe623e51dd1a83adb72 | |
parent | 8f57057a347cd20a3a04156ca1caa810509e6e09 (diff) | |
download | txr-a8440a58be20cd8bcfa78b74ed39e5cffcbc0f30.tar.gz txr-a8440a58be20cd8bcfa78b74ed39e5cffcbc0f30.tar.bz2 txr-a8440a58be20cd8bcfa78b74ed39e5cffcbc0f30.zip |
Fix ctype.h functions misapplied to wide characters.
* arith.c (tofloat): The isdigit here should be iswdigit.
Use '0' to '9' range check.
(toint): Replace accidental isalpha and toupper with
iswalpha and towupper.
-rw-r--r-- | arith.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -2229,7 +2229,7 @@ val tofloat(val obj) case TAG_CHR: { cnum ch = c_num(obj); - if (isdigit(ch)) + if (ch >= '0' && ch <= '9') return flo(ch - '0'); return nil; } @@ -2268,8 +2268,8 @@ val toint(val obj, val base) if (ch >= '0' && ch <= '9') return num(ch - '0'); - if (isalpha(ch)) { - cnum n = 10 + toupper(ch) - 'A'; + if (iswalpha(ch)) { + cnum n = 10 + towupper(ch) - 'A'; cnum b = c_num(default_arg(base, num_fast(10))); if (n < b) |