1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 04:10:18 +02:00

(scm_array_fill_x): For byvect char fill, force signed char

so as not to depend on signedness of plain char.  For byvect range
check, throw out-of-range rather than wrong-type-arg.
This commit is contained in:
Kevin Ryde 2004-08-06 01:04:05 +00:00
parent bcb88c93fa
commit 4d6ed8fe44

View file

@ -473,10 +473,10 @@ scm_array_fill_int (SCM ra, SCM fill, SCM ignore SCM_UNUSED)
break;
case scm_tc7_byvect:
if (SCM_CHARP (fill))
fill = SCM_I_MAKINUM ((char) SCM_CHAR (fill));
SCM_ASRTGO (SCM_I_INUMP (fill)
&& -128 <= SCM_I_INUM (fill) && SCM_I_INUM (fill) < 128,
badarg2);
fill = SCM_I_MAKINUM ((signed char) SCM_CHAR (fill));
SCM_ASRTGO (SCM_I_INUMP (fill), badarg2);
SCM_ASSERT_RANGE (SCM_ARG2, fill,
-128 <= SCM_I_INUM (fill) && SCM_I_INUM (fill) < 128);
for (i = base; n--; i += inc)
((char *) SCM_UVECTOR_BASE (ra))[i] = SCM_I_INUM (fill);
break;