summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-08-07 16:22:20 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2013-08-07 16:22:20 -0700
commitd2be15423a7fc54f143c517ef6f5a2b1a6e17163 (patch)
treea3169c85ed1fcb76963fbedfda0f88cf96a555f0 /src
parent1f5c91d68dfca9a7000f2b194efceed9b96ffdf6 (diff)
parent123c88759cea8561126a156524355e29e0a439f7 (diff)
downloadmruby-d2be15423a7fc54f143c517ef6f5a2b1a6e17163.tar.gz
mruby-d2be15423a7fc54f143c517ef6f5a2b1a6e17163.zip
Merge pull request #1446 from cremno/casts
MSVC: fix warnings
Diffstat (limited to 'src')
-rw-r--r--src/class.c2
-rw-r--r--src/numeric.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/class.c b/src/class.c
index bd55c1f71..7fc8fabbb 100644
--- a/src/class.c
+++ b/src/class.c
@@ -494,7 +494,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
if (i < argc) {
ss = to_str(mrb, *sp++);
s = mrb_str_ptr(ss);
- if (strlen(s->ptr) < s->len) {
+ if ((mrb_int)strlen(s->ptr) < s->len) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "String contains NUL");
}
*ps = s->ptr;
diff --git a/src/numeric.c b/src/numeric.c
index 4d794f8d8..c309abf89 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -200,7 +200,7 @@ mrb_flo_to_str(mrb_state *mrb, mrb_value flo, int max_digit)
*(c++) = '-';
}
- exp = log10(n);
+ exp = (int)log10(n);
if ((exp < 0 ? -exp : exp) > max_digit) {
/* exponent representation */
@@ -223,7 +223,7 @@ mrb_flo_to_str(mrb_state *mrb, mrb_value flo, int max_digit)
/* puts digits */
while (max_digit >= 0) {
mrb_float weight = pow(10.0, m);
- digit = floor(n / weight + FLT_EPSILON);
+ digit = (int)floor(n / weight + FLT_EPSILON);
*(c++) = '0' + digit;
n -= (digit * weight);
max_digit--;