1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

fix array->list

* libguile/generalized-arrays.c (array_to_list): Fix buggy
  implementation. Thanks to Daniel Llorens del Río for the bug repor.
This commit is contained in:
Andy Wingo 2010-01-07 16:40:13 +01:00
parent 8ffcf6e725
commit cf9a806dbd
2 changed files with 6 additions and 6 deletions

1
THANKS
View file

@ -70,6 +70,7 @@ For fixes or providing information which led to a fix:
Matt Kraai Matt Kraai
Daniel Kraft Daniel Kraft
Miroslav Lichvar Miroslav Lichvar
Daniel Llorens del Río
Jeff Long Jeff Long
Marco Maggi Marco Maggi
Gregory Marton Gregory Marton

View file

@ -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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -243,14 +243,13 @@ array_to_list (scm_t_array_handle *h, size_t dim, unsigned long pos)
{ {
SCM res = SCM_EOL; SCM res = SCM_EOL;
long inc; long inc;
size_t i, lbnd; size_t i;
i = h->dims[dim].ubnd; i = h->dims[dim].ubnd - h->dims[dim].lbnd + 1;
lbnd = h->dims[dim].lbnd;
inc = h->dims[dim].inc; inc = h->dims[dim].inc;
pos += (i - h->dims[dim].ubnd) * inc; pos += (i - 1) * inc;
for (; i >= lbnd; i--, pos -= inc) for (; i > 0; i--, pos -= inc)
res = scm_cons (array_to_list (h, dim + 1, pos), res); res = scm_cons (array_to_list (h, dim + 1, pos), res);
return res; return res;
} }