diff options
author | Ludovic Courtès <ludo@gnu.org> | 2006-12-12 14:01:40 +0000 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2006-12-12 14:01:40 +0000 |
commit | f30e1bdf97ae8b2b2918da585f887a4d3a23a347 (patch) | |
tree | 5a6612e2fdbfe5fb49caec0fbb36dbc12403345a /libguile/unif.c | |
parent | 22be72d35f90fa94f5dd09444cd891e2bb963cc8 (diff) | |
download | guile-f30e1bdf97ae8b2b2918da585f887a4d3a23a347.tar.gz |
Changes from arch/CVS synchronization
Diffstat (limited to 'libguile/unif.c')
-rw-r--r-- | libguile/unif.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libguile/unif.c b/libguile/unif.c index 7f01f62dd..d61532bb0 100644 --- a/libguile/unif.c +++ b/libguile/unif.c @@ -1150,10 +1150,10 @@ SCM_DEFINE (scm_array_in_bounds_p, "array-in-bounds?", 1, 0, 1, if (SCM_I_ARRAYP (v) || SCM_I_ENCLOSED_ARRAYP (v)) { - size_t k = SCM_I_ARRAY_NDIM (v); + size_t k, ndim = SCM_I_ARRAY_NDIM (v); scm_t_array_dim *s = SCM_I_ARRAY_DIMS (v); - while (k > 0) + for (k = 0; k < ndim; k++) { long ind; @@ -1161,9 +1161,8 @@ SCM_DEFINE (scm_array_in_bounds_p, "array-in-bounds?", 1, 0, 1, SCM_WRONG_NUM_ARGS (); ind = scm_to_long (SCM_CAR (args)); args = SCM_CDR (args); - k -= 1; - if (ind < s->lbnd || ind > s->ubnd) + if (ind < s[k].lbnd || ind > s[k].ubnd) { res = SCM_BOOL_F; /* We do not stop the checking after finding a violation @@ -2669,7 +2668,7 @@ read_decimal_integer (SCM port, int c, ssize_t *resp) } if (got_it) - *resp = res; + *resp = sign * res; return c; } @@ -2753,6 +2752,11 @@ scm_i_read_array (SCM port, int c) { c = scm_getc (port); c = read_decimal_integer (port, c, &len); + if (len < 0) + scm_i_input_error (NULL, port, + "array length must be non-negative", + SCM_EOL); + s = scm_list_2 (s, scm_from_ssize_t (lbnd+len-1)); } |