diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-22 03:05:20 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-22 03:05:20 +0000 |
commit | 9f3b77e43571744e04f2853e5e37671db2a7ddd7 (patch) | |
tree | edd09e0e5530a5ad7300a96b8344dbcd3a7079cd /numeric.c | |
parent | 0f6e6c8bbc4dd37868336019669582059edfda3f (diff) |
* configure.in (mingw): no longer uses snprintf and vsnprintf of
msvcrt.
* win32/win32.c (rb_w32_vsnprintf, rb_w32_snprintf): removed.
* win32/Makefile.sub (config.h): vsnprintf exists in VC7 or later.
* win32/mkexports.rb (Exports#initialize): aliases
rb_w32_vsnprintf and rb_w32_snprintf for binary compatibility.
* sprintf.c (rb_str_format): uses snprintf instead of sprintf.
* numeric.c (flo_to_s, rb_num2long, rb_num2ll): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -530,12 +530,12 @@ flo_to_s(VALUE flt) else if(isnan(value)) return rb_usascii_str_new2("NaN"); - sprintf(buf, "%#.15g", value); /* ensure to print decimal point */ + snprintf(buf, sizeof(buf), "%#.15g", value); /* ensure to print decimal point */ if (!(e = strchr(buf, 'e'))) { e = buf + strlen(buf); } if (!ISDIGIT(e[-1])) { /* reformat if ended with decimal point (ex 111111111111111.) */ - sprintf(buf, "%#.14e", value); + snprintf(buf, sizeof(buf), "%#.14e", value); if (!(e = strchr(buf, 'e'))) { e = buf + strlen(buf); } @@ -1554,7 +1554,7 @@ rb_num2long(VALUE val) char buf[24]; char *s; - sprintf(buf, "%-.10g", RFLOAT_VALUE(val)); + snprintf(buf, sizeof(buf), "%-.10g", RFLOAT_VALUE(val)); if ((s = strchr(buf, ' ')) != 0) *s = '\0'; rb_raise(rb_eRangeError, "float %s out of range of integer", buf); } @@ -1700,7 +1700,7 @@ rb_num2ll(VALUE val) char buf[24]; char *s; - sprintf(buf, "%-.10g", RFLOAT_VALUE(val)); + snprintf(buf, sizeof(buf), "%-.10g", RFLOAT_VALUE(val)); if ((s = strchr(buf, ' ')) != 0) *s = '\0'; rb_raise(rb_eRangeError, "float %s out of range of long long", buf); } |