Commit 123c8875 authored by Cremno's avatar Cremno

class.c and numeric.c: fixed MSVC warnings

parent 1f5c91d6
...@@ -494,7 +494,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...) ...@@ -494,7 +494,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
if (i < argc) { if (i < argc) {
ss = to_str(mrb, *sp++); ss = to_str(mrb, *sp++);
s = mrb_str_ptr(ss); 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"); mrb_raise(mrb, E_ARGUMENT_ERROR, "String contains NUL");
} }
*ps = s->ptr; *ps = s->ptr;
......
...@@ -200,7 +200,7 @@ mrb_flo_to_str(mrb_state *mrb, mrb_value flo, int max_digit) ...@@ -200,7 +200,7 @@ mrb_flo_to_str(mrb_state *mrb, mrb_value flo, int max_digit)
*(c++) = '-'; *(c++) = '-';
} }
exp = log10(n); exp = (int)log10(n);
if ((exp < 0 ? -exp : exp) > max_digit) { if ((exp < 0 ? -exp : exp) > max_digit) {
/* exponent representation */ /* exponent representation */
...@@ -223,7 +223,7 @@ mrb_flo_to_str(mrb_state *mrb, mrb_value flo, int max_digit) ...@@ -223,7 +223,7 @@ mrb_flo_to_str(mrb_state *mrb, mrb_value flo, int max_digit)
/* puts digits */ /* puts digits */
while (max_digit >= 0) { while (max_digit >= 0) {
mrb_float weight = pow(10.0, m); mrb_float weight = pow(10.0, m);
digit = floor(n / weight + FLT_EPSILON); digit = (int)floor(n / weight + FLT_EPSILON);
*(c++) = '0' + digit; *(c++) = '0' + digit;
n -= (digit * weight); n -= (digit * weight);
max_digit--; max_digit--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment