mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Check metadata a bit more
This commit is contained in:
parent
650cd24555
commit
a5b809e994
1 changed files with 12 additions and 0 deletions
|
@ -554,10 +554,22 @@ get_digest_base_metadata(VALUE klass)
|
||||||
if (NIL_P(p))
|
if (NIL_P(p))
|
||||||
rb_raise(rb_eRuntimeError, "Digest::Base cannot be directly inherited in Ruby");
|
rb_raise(rb_eRuntimeError, "Digest::Base cannot be directly inherited in Ruby");
|
||||||
|
|
||||||
|
if (!RB_TYPE_P(obj, T_DATA) || RTYPEDDATA_P(obj)) {
|
||||||
|
wrong:
|
||||||
|
if (p == klass)
|
||||||
|
rb_raise(rb_eTypeError, "%"PRIsVALUE"::metadata is not initialized properly",
|
||||||
|
klass);
|
||||||
|
else
|
||||||
|
rb_raise(rb_eTypeError, "%"PRIsVALUE"(%"PRIsVALUE")::metadata is not initialized properly",
|
||||||
|
klass, p);
|
||||||
|
}
|
||||||
|
|
||||||
#undef RUBY_UNTYPED_DATA_WARNING
|
#undef RUBY_UNTYPED_DATA_WARNING
|
||||||
#define RUBY_UNTYPED_DATA_WARNING 0
|
#define RUBY_UNTYPED_DATA_WARNING 0
|
||||||
Data_Get_Struct(obj, rb_digest_metadata_t, algo);
|
Data_Get_Struct(obj, rb_digest_metadata_t, algo);
|
||||||
|
|
||||||
|
if (!algo) goto wrong;
|
||||||
|
|
||||||
switch (algo->api_version) {
|
switch (algo->api_version) {
|
||||||
case 3:
|
case 3:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue