1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* pack.c (pack_pack): replace all rb_Float() to rb_to_float().

[ruby-dev:37663]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-12-30 16:10:23 +00:00
parent 84d4ce4bef
commit d5c7938eb4
2 changed files with 8 additions and 5 deletions

View file

@ -3,6 +3,9 @@ Wed Dec 31 00:27:54 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* object.c (rb_to_float): prohibit conversion from nil to float.
[ruby-dev:37663]
* pack.c (pack_pack): replace all rb_Float() to rb_to_float().
[ruby-dev:37663]
Tue Dec 30 21:17:00 2008 Tanaka Akira <akr@fsij.org>
* ext/socket/mkconstants.rb: use sock_define_uconst for INADDR_*

10
pack.c
View file

@ -800,7 +800,7 @@ pack_pack(VALUE ary, VALUE fmt)
FLOAT_CONVWITH(ftmp);
from = NEXTFROM;
f = RFLOAT_VALUE(rb_Float(from));
f = RFLOAT_VALUE(rb_to_float(from));
f = HTOVF(f,ftmp);
rb_str_buf_cat(res, (char*)&f, sizeof(float));
}
@ -812,7 +812,7 @@ pack_pack(VALUE ary, VALUE fmt)
DOUBLE_CONVWITH(dtmp);
from = NEXTFROM;
d = RFLOAT_VALUE(rb_Float(from));
d = RFLOAT_VALUE(rb_to_float(from));
d = HTOVD(d,dtmp);
rb_str_buf_cat(res, (char*)&d, sizeof(double));
}
@ -824,7 +824,7 @@ pack_pack(VALUE ary, VALUE fmt)
double d;
from = NEXTFROM;
d = RFLOAT_VALUE(rb_Float(from));
d = RFLOAT_VALUE(rb_to_float(from));
rb_str_buf_cat(res, (char*)&d, sizeof(double));
}
break;
@ -835,7 +835,7 @@ pack_pack(VALUE ary, VALUE fmt)
FLOAT_CONVWITH(ftmp);
from = NEXTFROM;
f = RFLOAT_VALUE(rb_Float(from));
f = RFLOAT_VALUE(rb_to_float(from));
f = HTONF(f,ftmp);
rb_str_buf_cat(res, (char*)&f, sizeof(float));
}
@ -847,7 +847,7 @@ pack_pack(VALUE ary, VALUE fmt)
DOUBLE_CONVWITH(dtmp);
from = NEXTFROM;
d = RFLOAT_VALUE(rb_Float(from));
d = RFLOAT_VALUE(rb_to_float(from));
d = HTOND(d,dtmp);
rb_str_buf_cat(res, (char*)&d, sizeof(double));
}