diff options
author | Andy Wingo <wingo@pobox.com> | 2010-01-03 12:36:37 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-01-03 12:37:07 +0100 |
commit | 09834e439b685ca3bb4404e40e046b11772fe50d (patch) | |
tree | 80f165a13623986e44f4923cf17087cc89127012 /libguile | |
parent | edb7bb4766773cffa8262b4cd8bb980888913d65 (diff) | |
download | guile-09834e439b685ca3bb4404e40e046b11772fe50d.tar.gz |
fix bug in generalized-vector->list
* libguile/generalized-vectors.c (scm_generalized_vector_to_list): Fix
bug iterating over indices of array. Thanks to Tristan Colgate for the
report.
* test-suite/tests/srfi-4.test: Add tests that uniform-vector->list
works for all kinds of uniform vectors.
Diffstat (limited to 'libguile')
-rw-r--r-- | libguile/generalized-vectors.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libguile/generalized-vectors.c b/libguile/generalized-vectors.c index 4e3b92401..bb53dda15 100644 --- a/libguile/generalized-vectors.c +++ b/libguile/generalized-vectors.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1996,1997,1998,2000,2001,2002,2003,2004, 2005, 2006, 2009 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1997,1998,2000,2001,2002,2003,2004, 2005, 2006, 2009, 2010 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -178,10 +178,9 @@ SCM_DEFINE (scm_generalized_vector_to_list, "generalized-vector->list", 1, 0, 0, ssize_t pos, i = 0; scm_t_array_handle h; scm_generalized_vector_get_handle (v, &h); - /* FIXME CHECKME */ - for (pos = h.dims[0].ubnd, i = (h.dims[0].ubnd - h.dims[0].lbnd + 1); + for (pos = h.dims[0].ubnd, i = (h.dims[0].ubnd - h.dims[0].lbnd); i >= 0; - pos += h.dims[0].inc) + pos -= h.dims[0].inc, i--) ret = scm_cons (h.impl->vref (&h, pos), ret); scm_array_handle_release (&h); return ret; |