зеркало из https://github.com/github/ruby.git
Suppress -Wshorten-64-to-32 warnings
This commit is contained in:
Родитель
6163a4e1b3
Коммит
d8720eb7de
|
@ -343,8 +343,8 @@ BigDecimal_prec(VALUE self)
|
|||
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)
|
|||
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
|
|||
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
|
|||
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;
|
||||
|
|
|
@ -406,7 +406,7 @@ rb_digest_instance_digest_length(VALUE self)
|
|||
|
||||
/* 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)
|
|||
|
||||
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)
|
|||
|
||||
algo = get_digest_obj_metadata(self);
|
||||
|
||||
return INT2NUM(algo->block_len);
|
||||
return SIZET2NUM(algo->block_len);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -142,7 +142,7 @@ setup_passwd(struct passwd *pwd)
|
|||
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)
|
|||
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*/
|
||||
);
|
||||
|
|
|
@ -2324,7 +2324,7 @@ ossl_ssl_get_verify_result(VALUE self)
|
|||
|
||||
GetSSL(self, ssl);
|
||||
|
||||
return INT2NUM(SSL_get_verify_result(ssl));
|
||||
return LONG2NUM(SSL_get_verify_result(ssl));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -11,9 +11,9 @@ static VALUE libyaml_version(VALUE module)
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ static ID id_event_location;
|
|||
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)
|
|||
|
||||
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)
|
|||
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)
|
|||
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)
|
|||
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)
|
|||
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)
|
|||
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)
|
|||
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)
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -447,7 +447,7 @@ strscan_get_charpos(VALUE self)
|
|||
|
||||
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)
|
|||
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)
|
|||
|
||||
GET_SCANNER(self, p);
|
||||
if (! MATCHED_P(p)) return Qnil;
|
||||
return INT2NUM(p->regs.end[0] - p->regs.beg[0]);
|
||||
return LONG2NUM(p->regs.end[0] - p->regs.beg[0]);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -54,7 +54,7 @@ static VALUE numeric_spec_NUM2INT(VALUE self, VALUE num) {
|
|||
}
|
||||
|
||||
static VALUE numeric_spec_INT2NUM(VALUE self, VALUE num) {
|
||||
return INT2NUM(NUM2LONG(num));
|
||||
return INT2NUM(NUM2INT(num));
|
||||
}
|
||||
|
||||
static VALUE numeric_spec_NUM2LONG(VALUE self, VALUE num) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче