>From e769c0397462e857af255b91a13752976a15291a Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Fri, 27 Sep 2024 22:35:57 +0200 Subject: [PATCH] Fix barf calls for out-of-range values for srfi-4 setters Instead of an invalid call to C_OUT_OF_RANGE with not enough arguments, use C_BAD_ARGUMENT_TYPE with just the one argument. This matches the existing implementations of s8vector-set! and f{32,64}vector-set! Reported by puck in #chicken. Signed-off-by: Peter Bex --- manual/Acknowledgements | 2 +- runtime.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manual/Acknowledgements b/manual/Acknowledgements index 8e6ac12b..3e7dd0cd 100644 --- a/manual/Acknowledgements +++ b/manual/Acknowledgements @@ -37,7 +37,7 @@ Fadi Moukayed, Chris Moline, Eric E. Moore, Julian Morrison, Dan Muresan, David N. Murray, Timo Myyrä, "nicktick", Lars Nilsson, Ian Oversby, "o.t.", Gene Pavlovsky, Levi Pearson, Jeronimo Pellegrini, Nicolas Pelletier, Derrell Piper, Carlos Pita, "Pluijzer", -Robin Lee Powell, Alan Post, "Pupeno", Davide Puricelli, "presto", +Robin Lee Powell, Alan Post, "puck", "Pupeno", Davide Puricelli, "presto", Doug Quale, Imran Rafique, Eric Raible, Ivan Raikov, Santosh Rajan, Peder Refnes, Joel Reymont, Kay Rhodes, "rivo", Chris Roberts, Eric Rochester, Paul Romanchenko, diff --git a/runtime.c b/runtime.c index 29dbcb00..53a3250a 100644 --- a/runtime.c +++ b/runtime.c @@ -6112,7 +6112,7 @@ C_regparm C_word C_fcall C_i_u8vector_set(C_word v, C_word i, C_word x) if(x & C_FIXNUM_BIT) { if (!(x & C_INT_SIGN_BIT) && C_ilen(C_unfix(x)) <= 8) n = C_unfix(x); - else barf(C_OUT_OF_RANGE_ERROR, "u8vector-set!", x); + else barf(C_BAD_ARGUMENT_TYPE_ERROR, "u8vector-set!", x); } else barf(C_BAD_ARGUMENT_TYPE_ERROR, "u8vector-set!", x); } @@ -6162,7 +6162,7 @@ C_regparm C_word C_fcall C_i_u16vector_set(C_word v, C_word i, C_word x) if(x & C_FIXNUM_BIT) { if (!(x & C_INT_SIGN_BIT) && C_ilen(C_unfix(x)) <= 16) n = C_unfix(x); - else barf(C_OUT_OF_RANGE_ERROR, "u16vector-set!", x); + else barf(C_BAD_ARGUMENT_TYPE_ERROR, "u16vector-set!", x); } else barf(C_BAD_ARGUMENT_TYPE_ERROR, "u16vector-set!", x); } @@ -6187,7 +6187,7 @@ C_regparm C_word C_fcall C_i_s16vector_set(C_word v, C_word i, C_word x) if(x & C_FIXNUM_BIT) { if (C_unfix(C_i_fixnum_length(x)) <= 16) n = C_unfix(x); - else barf(C_OUT_OF_RANGE_ERROR, "s16vector-set!", x); + else barf(C_BAD_ARGUMENT_TYPE_ERROR, "s16vector-set!", x); } else barf(C_BAD_ARGUMENT_TYPE_ERROR, "s16vector-set!", x); } @@ -6212,7 +6212,7 @@ C_regparm C_word C_fcall C_i_u32vector_set(C_word v, C_word i, C_word x) if(C_truep(C_i_exact_integerp(x))) { if (C_unfix(C_i_integer_length(x)) <= 32) n = C_num_to_unsigned_int(x); - else barf(C_OUT_OF_RANGE_ERROR, "u32vector-set!", x); + else barf(C_BAD_ARGUMENT_TYPE_ERROR, "u32vector-set!", x); } else barf(C_BAD_ARGUMENT_TYPE_ERROR, "u32vector-set!", x); } @@ -6237,7 +6237,7 @@ C_regparm C_word C_fcall C_i_s32vector_set(C_word v, C_word i, C_word x) if(C_truep(C_i_exact_integerp(x))) { if (C_unfix(C_i_integer_length(x)) <= 32) n = C_num_to_int(x); - else barf(C_OUT_OF_RANGE_ERROR, "s32vector-set!", x); + else barf(C_BAD_ARGUMENT_TYPE_ERROR, "s32vector-set!", x); } else barf(C_BAD_ARGUMENT_TYPE_ERROR, "s32vector-set!", x); } @@ -6262,7 +6262,7 @@ C_regparm C_word C_fcall C_i_u64vector_set(C_word v, C_word i, C_word x) if(C_truep(C_i_exact_integerp(x))) { if (C_unfix(C_i_integer_length(x)) <= 64) n = C_num_to_uint64(x); - else barf(C_OUT_OF_RANGE_ERROR, "u64vector-set!", x); + else barf(C_BAD_ARGUMENT_TYPE_ERROR, "u64vector-set!", x); } else barf(C_BAD_ARGUMENT_TYPE_ERROR, "u64vector-set!", x); } @@ -6287,7 +6287,7 @@ C_regparm C_word C_fcall C_i_s64vector_set(C_word v, C_word i, C_word x) if(C_truep(C_i_exact_integerp(x))) { if (C_unfix(C_i_integer_length(x)) <= 64) n = C_num_to_int64(x); - else barf(C_OUT_OF_RANGE_ERROR, "s64vector-set!", x); + else barf(C_BAD_ARGUMENT_TYPE_ERROR, "s64vector-set!", x); } else barf(C_BAD_ARGUMENT_TYPE_ERROR, "s64vector-set!", x); } -- 2.44.1