1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 17:20:29 +02:00

Fix bytevector-fill! to accept fill arguments greater than 127.

Fixes <http://bugs.gnu.org/19027>.

* libguile/bytevectors.c (scm_bytevector_fill_x): Accept fill arguments
  between -128 and 255.

* test-suite/tests/bytevectors.test ("2.2 General Operations"): Add
  tests.
This commit is contained in:
Mark H Weaver 2014-11-12 00:40:47 -05:00
parent 81d2c84674
commit ae6f77ddfa
2 changed files with 21 additions and 1 deletions

View file

@ -537,9 +537,14 @@ SCM_DEFINE (scm_bytevector_fill_x, "bytevector-fill!", 2, 0, 0,
{
size_t c_len, i;
scm_t_uint8 *c_bv, c_fill;
int value;
SCM_VALIDATE_BYTEVECTOR (1, bv);
c_fill = scm_to_int8 (fill);
value = scm_to_int (fill);
if (SCM_UNLIKELY ((value < -128) || (value > 255)))
scm_out_of_range (FUNC_NAME, fill);
c_fill = (scm_t_uint8) value;
c_len = SCM_BYTEVECTOR_LENGTH (bv);
c_bv = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bv);