vm.c: fix conversion warning in send_method visibility error path

Cast RARRAY_LEN result to int in send_method when handling visibility
errors to resolve C4244 warning about potential data loss from
mrb_ssize to int conversion. The cast is safe since n represents
argument count which should fit in int range.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-08-22 23:46:55 +09:00
parent 2580d69782
commit 2ffe25636b
+1 -1
View File
@@ -1004,7 +1004,7 @@ send_method(mrb_state *mrb, mrb_value self, mrb_bool pub)
if (m.flags & MRB_METHOD_PRIVATE_FL) {
vis_err:;
if (n == 15) {
n = RARRAY_LEN(regs[0]) - 1;
n = (int)(RARRAY_LEN(regs[0]) - 1);
regs = RARRAY_PTR(regs[0]);
}
vis_error(mrb, name, mrb_ary_new_from_values(mrb, n, regs+1), self, priv);