summaryrefslogtreecommitdiff
path: root/libguile
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2004-04-27 23:16:17 +0000
committerKevin Ryde <user42@zip.com.au>2004-04-27 23:16:17 +0000
commit71df73ac43cc3019da9f232d80487b6fe47f3162 (patch)
tree044a1416647197005030fe09f4e2346d88965e8b /libguile
parent70d31de9007928757cce9d0f2bf15e889957657d (diff)
downloadguile-71df73ac43cc3019da9f232d80487b6fe47f3162.tar.gz
numbers.c (XDIGIT2UINT,
mem2uinteger, mem2decimal_from_point, mem2ureal): Cast char to int for ctype.h tests, to avoid warnings from gcc on HP-UX about char as array subscript. Reported by Andreas Vögele. Also cast through unsigned char to avoid passing negatives to those macros if input contains 8-bit values.
Diffstat (limited to 'libguile')
-rw-r--r--libguile/numbers.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 8b169d3d8..3d7aac307 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -2316,7 +2316,10 @@ enum t_exactness {NO_EXACTNESS, INEXACT, EXACT};
/* R5RS, section 7.1.1, lexical structure of numbers: <uinteger R>. */
/* In non ASCII-style encodings the following macro might not work. */
-#define XDIGIT2UINT(d) (isdigit (d) ? (d) - '0' : tolower (d) - 'a' + 10)
+#define XDIGIT2UINT(d) \
+ (isdigit ((int) (unsigned char) d) \
+ ? (d) - '0' \
+ : tolower ((int) (unsigned char) d) - 'a' + 10)
static SCM
mem2uinteger (const char* mem, size_t len, unsigned int *p_idx,
@@ -2334,7 +2337,7 @@ mem2uinteger (const char* mem, size_t len, unsigned int *p_idx,
return SCM_BOOL_F;
c = mem[idx];
- if (!isxdigit (c))
+ if (!isxdigit ((int) (unsigned char) c))
return SCM_BOOL_F;
digit_value = XDIGIT2UINT (c);
if (digit_value >= radix)
@@ -2345,7 +2348,7 @@ mem2uinteger (const char* mem, size_t len, unsigned int *p_idx,
while (idx != len)
{
char c = mem[idx];
- if (isxdigit (c))
+ if (isxdigit ((int) (unsigned char) c))
{
if (hash_seen)
break;
@@ -2422,7 +2425,7 @@ mem2decimal_from_point (SCM result, const char* mem, size_t len,
while (idx != len)
{
char c = mem[idx];
- if (isdigit (c))
+ if (isdigit ((int) (unsigned char) c))
{
if (x == INEXACT)
return SCM_BOOL_F;
@@ -2503,7 +2506,7 @@ mem2decimal_from_point (SCM result, const char* mem, size_t len,
else
sign = 1;
- if (!isdigit (c))
+ if (!isdigit ((int) (unsigned char) c))
return SCM_BOOL_F;
idx++;
@@ -2511,7 +2514,7 @@ mem2decimal_from_point (SCM result, const char* mem, size_t len,
while (idx != len)
{
char c = mem[idx];
- if (isdigit (c))
+ if (isdigit ((int) (unsigned char) c))
{
idx++;
if (exponent <= SCM_MAXEXP)
@@ -2589,7 +2592,7 @@ mem2ureal (const char* mem, size_t len, unsigned int *p_idx,
return SCM_BOOL_F;
else if (idx + 1 == len)
return SCM_BOOL_F;
- else if (!isdigit (mem[idx + 1]))
+ else if (!isdigit ((int) (unsigned char) mem[idx + 1]))
return SCM_BOOL_F;
else
result = mem2decimal_from_point (SCM_MAKINUM (0), mem, len,