mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-10 12:02:53 +02:00
Make getPrivateDataCheck less strict
This commit is contained in:
parent
97f51ec7fe
commit
bc1b84de4b
1 changed files with 6 additions and 4 deletions
|
@ -195,10 +195,6 @@ getPrivateDataCheck(VALUE self, const char *type)
|
|||
#if RAPI_FULL <= 187
|
||||
rb_check_type(self, T_DATA);
|
||||
VALUE otherObj = rb_const_get(rb_cObject, rb_intern(type));
|
||||
#else
|
||||
Check_TypedStruct(self, &type);
|
||||
VALUE otherObj = rb_const_get(rb_cObject, rb_intern(type.wrap_struct_name));
|
||||
#endif
|
||||
const char *ownname, *othername;
|
||||
if (!rb_obj_is_kind_of(self, otherObj)) {
|
||||
ownname = rb_obj_classname(self);
|
||||
|
@ -206,7 +202,13 @@ getPrivateDataCheck(VALUE self, const char *type)
|
|||
rb_raise(rb_eTypeError, "Can't convert %s into %s", othername, ownname);
|
||||
}
|
||||
void *obj = DATA_PTR(self);
|
||||
#endif
|
||||
const char *ownname = rb_obj_classname(self);
|
||||
if (!rb_typeddata_is_kind_of(self, &type))
|
||||
rb_raise(rb_eTypeError, "Can't convert %s into %s", ownname,
|
||||
type.wrap_struct_name);
|
||||
|
||||
void *obj = RTYPEDDATA_DATA(self);
|
||||
return static_cast<C *>(obj);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue