Unwrap shape id as unsigned int
Shape IDs are unsigned. This commit unwraps the shape id as an unsigned int, which will automatically raise an argument error and also eliminate a compilation warning.
This commit is contained in:
parent
b55e3b842a
commit
107531583c
Notes:
git
2022-10-13 01:56:33 +09:00
4
shape.c
4
shape.c
@ -514,8 +514,8 @@ rb_shape_flags_mask(void)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_shape_find_by_id(VALUE mod, VALUE id)
|
rb_shape_find_by_id(VALUE mod, VALUE id)
|
||||||
{
|
{
|
||||||
shape_id_t shape_id = NUM2INT(id);
|
shape_id_t shape_id = NUM2UINT(id);
|
||||||
if (shape_id < 0 || shape_id >= GET_VM()->next_shape_id) {
|
if (shape_id >= GET_VM()->next_shape_id) {
|
||||||
rb_raise(rb_eArgError, "Shape ID %d is out of bounds\n", shape_id);
|
rb_raise(rb_eArgError, "Shape ID %d is out of bounds\n", shape_id);
|
||||||
}
|
}
|
||||||
return rb_shape_t_to_rb_cShape(rb_shape_get_shape_by_id(shape_id));
|
return rb_shape_t_to_rb_cShape(rb_shape_get_shape_by_id(shape_id));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user