mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_aset): should raise error if an indexing string
is not found in the receiver. * sprintf.c (rb_f_sprintf): "%d" should convert objects into integers using Integer(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2b5990e921
commit
0adc031e83
6 changed files with 19 additions and 9 deletions
|
@ -17,6 +17,14 @@ Mon Jun 3 07:07:07 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
|||
* parse.y (yylex): should pushback proper char after '**'.
|
||||
(ruby-bugs-ja:PR#240)
|
||||
|
||||
Mon Jun 3 05:56:17 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_aset): should raise error if an indexing string
|
||||
is not found in the receiver.
|
||||
|
||||
* sprintf.c (rb_f_sprintf): "%d" should convert objects into
|
||||
integers using Integer().
|
||||
|
||||
Thu May 30 09:16:36 2002 Wakou Aoyama <wakou@ruby-lang.org>
|
||||
|
||||
* lib/cgi.rb: if StringIO is usable then use it.
|
||||
|
|
|
@ -589,7 +589,7 @@ ip_addrsetup(host, port)
|
|||
portp = 0;
|
||||
}
|
||||
else if (FIXNUM_P(port)) {
|
||||
snprintf(pbuf, sizeof(pbuf), "%ld", FIX2INT(port));
|
||||
snprintf(pbuf, sizeof(pbuf), "%d", FIX2INT(port));
|
||||
portp = pbuf;
|
||||
}
|
||||
else {
|
||||
|
@ -669,7 +669,7 @@ ipaddr(sockaddr)
|
|||
error = getnameinfo(sockaddr, SA_LEN(sockaddr), hbuf, sizeof(hbuf),
|
||||
pbuf, sizeof(pbuf), NI_NUMERICHOST | NI_NUMERICSERV);
|
||||
if (error) {
|
||||
rb_raise(rb_eSocket, "getnameinfo %s", gai_strerror(error));
|
||||
rb_raise(rb_eSocket, "getnameinfo: %s", gai_strerror(error));
|
||||
}
|
||||
addr2 = rb_tainted_str_new2(hbuf);
|
||||
if (do_not_reverse_lookup) {
|
||||
|
|
|
@ -374,9 +374,10 @@ module Math
|
|||
alias sin! sin
|
||||
alias tan! tan
|
||||
alias log! log
|
||||
alias atan! atan
|
||||
alias log10! log10
|
||||
alias atan2! atan2
|
||||
|
||||
|
||||
def sqrt(z)
|
||||
if Complex.generic?(z)
|
||||
if z >= 0
|
||||
|
|
|
@ -646,7 +646,7 @@ static VALUE flo_is_infinite_p(num)
|
|||
double value = RFLOAT(num)->value;
|
||||
|
||||
if (isinf(value)) {
|
||||
return INT2FIX( value < 0 ? -1 : +1 );
|
||||
return INT2FIX( value < 0 ? -1 : 1 );
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
|
|
|
@ -402,8 +402,8 @@ rb_f_sprintf(argc, argv)
|
|||
bignum = 1;
|
||||
break;
|
||||
default:
|
||||
v = NUM2LONG(val);
|
||||
break;
|
||||
val = rb_Integer(val);
|
||||
goto bin_retry;
|
||||
case T_FIXNUM:
|
||||
v = FIX2LONG(val);
|
||||
break;
|
||||
|
|
7
string.c
7
string.c
|
@ -1037,10 +1037,11 @@ rb_str_aset(str, indx, val)
|
|||
|
||||
case T_STRING:
|
||||
beg = rb_str_index(str, indx, 0);
|
||||
if (beg != -1) {
|
||||
if (TYPE(val) != T_STRING) val = rb_str_to_str(val);
|
||||
rb_str_replace(str, beg, RSTRING(indx)->len, val);
|
||||
if (beg < 0) {
|
||||
rb_raise(rb_eIndexError, "string not matched");
|
||||
}
|
||||
if (TYPE(val) != T_STRING) val = rb_str_to_str(val);
|
||||
rb_str_replace(str, beg, RSTRING(indx)->len, val);
|
||||
return val;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue