From a127ded486b173b1b805da2c39d656c77d98c6cc Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 4 Sep 2020 09:30:11 +0900 Subject: Fix warning from VC regarding implicit int conversion. --- mrbgems/mruby-eval/src/eval.c | 2 +- mrbgems/mruby-print/src/print.c | 8 ++++---- mrbgems/mruby-rational/src/rational.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'mrbgems') diff --git a/mrbgems/mruby-eval/src/eval.c b/mrbgems/mruby-eval/src/eval.c index 4271954e5..34a438060 100644 --- a/mrbgems/mruby-eval/src/eval.c +++ b/mrbgems/mruby-eval/src/eval.c @@ -20,7 +20,7 @@ create_proc_from_string(mrb_state *mrb, const char *s, mrb_int len, mrb_value bi struct REnv *e; mrb_callinfo *ci; /* callinfo of eval caller */ struct RClass *target_class = NULL; - int bidx; + mrb_int bidx; if (!mrb_nil_p(binding)) { mrb_raise(mrb, E_ARGUMENT_ERROR, "Binding of eval must be nil."); diff --git a/mrbgems/mruby-print/src/print.c b/mrbgems/mruby-print/src/print.c index 74d736397..665f2a926 100644 --- a/mrbgems/mruby-print/src/print.c +++ b/mrbgems/mruby-print/src/print.c @@ -17,22 +17,22 @@ #endif static void -printstr(mrb_state *mrb, const char *p, size_t len) +printstr(mrb_state *mrb, const char *p, mrb_int len) { #if defined(_WIN32) if (isatty(fileno(stdout))) { DWORD written; - size_t wlen = MultiByteToWideChar(CP_UTF8, 0, p, len, NULL, 0); + int wlen = MultiByteToWideChar(CP_UTF8, 0, p, (int)len, NULL, 0); wchar_t* utf16 = (wchar_t*)mrb_malloc(mrb, (wlen+1) * sizeof(wchar_t)); if (MultiByteToWideChar(CP_UTF8, 0, p, len, utf16, wlen) > 0) { utf16[wlen] = 0; WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), - utf16, wlen, &written, NULL); + utf16, (DWORD)wlen, &written, NULL); } mrb_free(mrb, utf16); } else #endif - fwrite(p, len, 1, stdout); + fwrite(p, (size_t)len, 1, stdout); fflush(stdout); } diff --git a/mrbgems/mruby-rational/src/rational.c b/mrbgems/mruby-rational/src/rational.c index 06f198c98..d5dd7adc4 100644 --- a/mrbgems/mruby-rational/src/rational.c +++ b/mrbgems/mruby-rational/src/rational.c @@ -115,7 +115,7 @@ rational_new_f(mrb_state *mrb, mrb_float f0) if (f < 0) { neg = 1; f = -f; } while (f != floor(f)) { n <<= 1; f *= 2; } - d = f; + d = (mrb_int)f; /* continued fraction and check denominator each step */ for (i = 0; i < 64; i++) { -- cgit v1.2.3