summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-01-12 16:25:30 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-01-12 16:25:30 +0900
commit1310368b3f78e9304b7231eb1d6408842340c6cf (patch)
tree5edd47ee2149c0528fbfaa5bf2a9c723d8452717
parenta8b8d316ab80b7cf569d6bc9cb8ba993a4e6c8bc (diff)
downloadmruby-1310368b3f78e9304b7231eb1d6408842340c6cf.tar.gz
mruby-1310368b3f78e9304b7231eb1d6408842340c6cf.zip
Silence Windows warnings (cast and `setmode`).
-rw-r--r--mrbgems/mruby-bin-mruby/tools/mruby/mruby.c2
-rw-r--r--mrbgems/mruby-rational/src/rational.c8
-rw-r--r--src/load.c2
3 files changed, 6 insertions, 6 deletions
diff --git a/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c b/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
index 43e0b90f3..dfac48217 100644
--- a/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
+++ b/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
@@ -235,7 +235,7 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
}
#if defined(_WIN32) || defined(_WIN64)
if (args->rfp == stdin) {
- setmode(_fileno(stdin), O_BINARY);
+ _setmode(_fileno(stdin), O_BINARY);
}
#endif
args->argv = (char **)mrb_realloc(mrb, args->argv, sizeof(char*) * (argc + 1));
diff --git a/mrbgems/mruby-rational/src/rational.c b/mrbgems/mruby-rational/src/rational.c
index 173a416e8..5e25bfb99 100644
--- a/mrbgems/mruby-rational/src/rational.c
+++ b/mrbgems/mruby-rational/src/rational.c
@@ -160,8 +160,8 @@ rational_new_i(mrb_state *mrb, mrb_int n, mrb_int d)
static void
float_decode_internal(mrb_state *mrb, mrb_float f, mrb_float *rf, int *n)
{
- f = frexp_rat(f, n);
- f = ldexp_rat(f, RAT_MANT_DIG);
+ f = (mrb_float)frexp_rat(f, n);
+ f = (mrb_float)ldexp_rat(f, RAT_MANT_DIG);
*n -= RAT_MANT_DIG;
*rf = f;
}
@@ -188,7 +188,7 @@ rational_new_f(mrb_state *mrb, mrb_float f0)
else {
n = -n;
}
- return rational_new_i(mrb, f, ((mrb_int)1)<<n);
+ return rational_new_i(mrb, (mrb_int)f, ((mrb_int)1)<<n);
#else
mrb_int pow = 1;
if (n < 0) {
@@ -206,7 +206,7 @@ rational_new_f(mrb_state *mrb, mrb_float f0)
while (n--) {
pow *= FLT_RADIX;
}
- return rational_new(mrb, f*pow, 1);
+ return rational_new(mrb, (mrb_int)f*pow, 1);
}
#endif
}
diff --git a/src/load.c b/src/load.c
index 1ab8c1ad6..0b98fba66 100644
--- a/src/load.c
+++ b/src/load.c
@@ -96,7 +96,7 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flag
src += sizeof(uint16_t);
/* number of child irep */
- irep->rlen = (size_t)bin_to_uint16(src);
+ irep->rlen = (uint8_t)bin_to_uint16(src);
src += sizeof(uint16_t);
/* Binary Data Section */