ruby-changes:60696
From: Nobuyoshi <ko1@a...>
Date: Wed, 8 Apr 2020 16:29:39 +0900 (JST)
Subject: [ruby-changes:60696] d8720eb7de (master): Suppress -Wshorten-64-to-32 warnings
https://git.ruby-lang.org/ruby.git/commit/?id=d8720eb7de From d8720eb7de9cd9d874b621f214c27022e17cc941 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 8 Apr 2020 16:06:30 +0900 Subject: Suppress -Wshorten-64-to-32 warnings diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 7ac8837..ecd43fd 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -343,8 +343,8 @@ BigDecimal_prec(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L343 VALUE obj; GUARD_OBJ(p, GetVpValue(self, 1)); - obj = rb_assoc_new(INT2NUM(p->Prec*VpBaseFig()), - INT2NUM(p->MaxPrec*VpBaseFig())); + obj = rb_assoc_new(SIZET2NUM(p->Prec*VpBaseFig()), + SIZET2NUM(p->MaxPrec*VpBaseFig())); return obj; } @@ -2132,7 +2132,7 @@ BigDecimal_split(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2132 rb_ary_push(obj, str); rb_str_resize(str, strlen(psz1)); rb_ary_push(obj, INT2FIX(10)); - rb_ary_push(obj, INT2NUM(e)); + rb_ary_push(obj, SSIZET2NUM(e)); return obj; } @@ -2145,7 +2145,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2145 BigDecimal_exponent(VALUE self) { ssize_t e = VpExponent10(GetVpValue(self, 1)); - return INT2NUM(e); + return SSIZET2NUM(e); } /* Returns a string representation of self. @@ -2765,7 +2765,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2765 BigDecimal_limit(int argc, VALUE *argv, VALUE self) { VALUE nFig; - VALUE nCur = INT2NUM(VpGetPrecLimit()); + VALUE nCur = SIZET2NUM(VpGetPrecLimit()); if (rb_scan_args(argc, argv, "01", &nFig) == 1) { int nf; diff --git a/ext/digest/digest.c b/ext/digest/digest.c index a59f880..cde0dfa 100644 --- a/ext/digest/digest.c +++ b/ext/digest/digest.c @@ -406,7 +406,7 @@ rb_digest_instance_digest_length(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/digest/digest.c#L406 /* never blindly assume that #digest() returns a string */ StringValue(digest); - return INT2NUM(RSTRING_LEN(digest)); + return LONG2NUM(RSTRING_LEN(digest)); } /* @@ -725,7 +725,7 @@ rb_digest_base_digest_length(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/digest/digest.c#L725 algo = get_digest_obj_metadata(self); - return INT2NUM(algo->digest_len); + return SIZET2NUM(algo->digest_len); } /* @@ -740,7 +740,7 @@ rb_digest_base_block_length(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/digest/digest.c#L740 algo = get_digest_obj_metadata(self); - return INT2NUM(algo->block_len); + return SIZET2NUM(algo->block_len); } void diff --git a/ext/etc/etc.c b/ext/etc/etc.c index 3bad435..d57c265 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -142,7 +142,7 @@ setup_passwd(struct passwd *pwd) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L142 safe_setup_filesystem_str(pwd->pw_dir), safe_setup_filesystem_str(pwd->pw_shell), #ifdef HAVE_STRUCT_PASSWD_PW_CHANGE - INT2NUM(pwd->pw_change), + TIMET2NUM(pwd->pw_change), #endif #ifdef HAVE_STRUCT_PASSWD_PW_QUOTA INT2NUM(pwd->pw_quota), @@ -157,7 +157,7 @@ setup_passwd(struct passwd *pwd) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L157 safe_setup_locale_str(pwd->pw_comment), #endif #ifdef HAVE_STRUCT_PASSWD_PW_EXPIRE - INT2NUM(pwd->pw_expire), + TIMET2NUM(pwd->pw_expire), #endif 0 /*dummy*/ ); diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index 34bb636..337ce5d 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -2324,7 +2324,7 @@ ossl_ssl_get_verify_result(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L2324 GetSSL(self, ssl); - return INT2NUM(SSL_get_verify_result(ssl)); + return LONG2NUM(SSL_get_verify_result(ssl)); } /* diff --git a/ext/psych/psych.c b/ext/psych/psych.c index 3bb59bf..0afd731 100644 --- a/ext/psych/psych.c +++ b/ext/psych/psych.c @@ -11,9 +11,9 @@ static VALUE libyaml_version(VALUE module) https://github.com/ruby/ruby/blob/trunk/ext/psych/psych.c#L11 yaml_get_version(&major, &minor, &patch); - list[0] = INT2NUM((long)major); - list[1] = INT2NUM((long)minor); - list[2] = INT2NUM((long)patch); + list[0] = INT2NUM(major); + list[1] = INT2NUM(minor); + list[2] = INT2NUM(patch); return rb_ary_new4((long)3, list); } diff --git a/ext/psych/psych_parser.c b/ext/psych/psych_parser.c index fb1a917..fd550b6 100644 --- a/ext/psych/psych_parser.c +++ b/ext/psych/psych_parser.c @@ -27,7 +27,7 @@ static ID id_event_location; https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_parser.c#L27 static int io_reader(void * data, unsigned char *buf, size_t size, size_t *read) { VALUE io = (VALUE)data; - VALUE string = rb_funcall(io, id_read, 1, INT2NUM(size)); + VALUE string = rb_funcall(io, id_read, 1, SIZET2NUM(size)); *read = 0; @@ -89,9 +89,9 @@ static VALUE make_exception(yaml_parser_t * parser, VALUE path) https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_parser.c#L89 return rb_funcall(ePsychSyntaxError, rb_intern("new"), 6, path, - INT2NUM(line), - INT2NUM(column), - INT2NUM(parser->problem_offset), + SIZET2NUM(line), + SIZET2NUM(column), + SIZET2NUM(parser->problem_offset), parser->problem ? rb_usascii_str_new2(parser->problem) : Qnil, parser->context ? rb_usascii_str_new2(parser->context) : Qnil); } @@ -303,10 +303,10 @@ static VALUE parse(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_parser.c#L303 rb_exc_raise(exception); } - start_line = INT2NUM((long)event.start_mark.line); - start_column = INT2NUM((long)event.start_mark.column); - end_line = INT2NUM((long)event.end_mark.line); - end_column = INT2NUM((long)event.end_mark.column); + start_line = SIZET2NUM(event.start_mark.line); + start_column = SIZET2NUM(event.start_mark.column); + end_line = SIZET2NUM(event.end_mark.line); + end_column = SIZET2NUM(event.end_mark.column); event_args[0] = handler; event_args[1] = start_line; @@ -321,7 +321,7 @@ static VALUE parse(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_parser.c#L321 VALUE args[2]; args[0] = handler; - args[1] = INT2NUM((long)event.data.stream_start.encoding); + args[1] = INT2NUM(event.data.stream_start.encoding); rb_protect(protected_start_stream, (VALUE)args, &state); } break; @@ -334,8 +334,8 @@ static VALUE parse(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_parser.c#L334 VALUE version = event.data.document_start.version_directive ? rb_ary_new3( (long)2, - INT2NUM((long)event.data.document_start.version_directive->major), - INT2NUM((long)event.data.document_start.version_directive->minor) + INT2NUM(event.data.document_start.version_directive->major), + INT2NUM(event.data.document_start.version_directive->minor) ) : rb_ary_new(); if(event.data.document_start.tag_directives.start) { @@ -418,7 +418,7 @@ static VALUE parse(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_parser.c#L418 quoted_implicit = event.data.scalar.quoted_implicit == 0 ? Qfalse : Qtrue; - style = INT2NUM((long)event.data.scalar.style); + style = INT2NUM(event.data.scalar.style); args[0] = handler; args[1] = val; @@ -450,7 +450,7 @@ static VALUE parse(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_parser.c#L450 implicit = event.data.sequence_start.implicit == 0 ? Qfalse : Qtrue; - style = INT2NUM((long)event.data.sequence_start.style); + style = INT2NUM(event.data.sequence_start.style); args[0] = handler; args[1] = anchor; @@ -483,7 +483,7 @@ static VALUE parse(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_parser.c#L483 implicit = event.data.mapping_start.implicit == 0 ? Qfalse : Qtrue; - style = INT2NUM((long)event.data.mapping_start.style); + style = INT2NUM(event.data.mapping_start.style); args[0] = handler; args[1] = anchor; @@ -527,9 +527,9 @@ static VALUE mark(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/psych/psych_parser.c#L527 TypedData_Get_Struct(self, yaml_parser_t, &psych_parser_type, parser); mark_klass = rb_const_get_at(cPsychParser, rb_intern("Mark")); - args[0] = INT2NUM(parser->mark.index); - args[1] = INT2NUM(parser->mark.line); - args[2] = INT2NUM(parser->mark.column); + args[0] = SIZET2NUM(parser->mark.index); + args[1] = SIZET2NUM(parser->mark.line); + args[2] = SIZET2NUM(parser->mark.column); return rb_class_new_instance(3, args, mark_klass); } diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index b6d1799..a484a47 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -447,7 +447,7 @@ strscan_get_charpos(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L447 GET_SCANNER(self, p); - substr = rb_funcall(p->str, id_byteslice, 2, INT2FIX(0), INT2NUM(p->curr)); + substr = rb_funcall(p->str, id_byteslice, 2, INT2FIX(0), LONG2NUM(p->curr)); return rb_str_length(substr); } @@ -473,7 +473,7 @@ strscan_set_pos(VALUE self, VALUE v) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L473 if (i < 0) rb_raise(rb_eRangeError, "index out of range"); if (i > S_LEN(p)) rb_raise(rb_eRangeError, "index out of range"); p->curr = i; - return INT2NUM(i); + return LONG2NUM(i); } static inline UChar * @@ -1107,7 +1107,7 @@ strscan_matched_size(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L1107 GET_SCANNER(self, p); if (! MATCHED_P(p)) return Qnil; - return INT2NUM(p->regs.end[0] - p->regs.beg[0] (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/