summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-08-29 07:38:45 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-10-12 18:20:07 +0900
commitdd1ce5d53efa9a00cd9bdc7a7771bc6489da4469 (patch)
tree1354054dcdf4f621c5adcbb8b5208fb079774957
parent7eaaee5405f71c598893e9a022c755f61f11e9ec (diff)
downloadmruby-dd1ce5d53efa9a00cd9bdc7a7771bc6489da4469.tar.gz
mruby-dd1ce5d53efa9a00cd9bdc7a7771bc6489da4469.zip
Silence warnings from implicit integer conversions.
Caused from combination of `mrb_int`, `int` and `size_t`..
-rw-r--r--include/mruby.h8
-rw-r--r--mrbgems/mruby-complex/src/complex.c2
-rw-r--r--mrbgems/mruby-print/src/print.c2
-rw-r--r--src/class.c4
-rw-r--r--src/vm.c12
5 files changed, 14 insertions, 14 deletions
diff --git a/include/mruby.h b/include/mruby.h
index dda0fad68..e417dc840 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -1040,8 +1040,8 @@ MRB_API mrb_value mrb_get_arg1(mrb_state *mrb);
* @param ... Variadic values(not type safe!).
* @return [mrb_value] mruby function value.
*/
-MRB_API mrb_value mrb_funcall(mrb_state *mrb, mrb_value val, const char *name, mrb_int argc, ...);
-MRB_API mrb_value mrb_funcall_id(mrb_state *mrb, mrb_value val, mrb_sym mid, mrb_int argc, ...);
+MRB_API mrb_value mrb_funcall(mrb_state *mrb, mrb_value val, const char *name, int argc, ...);
+MRB_API mrb_value mrb_funcall_id(mrb_state *mrb, mrb_value val, mrb_sym mid, int argc, ...);
/**
* Call existing ruby functions. This is basically the type safe version of mrb_funcall.
*
@@ -1070,11 +1070,11 @@ MRB_API mrb_value mrb_funcall_id(mrb_state *mrb, mrb_value val, mrb_sym mid, mrb
* @return [mrb_value] mrb_value mruby function value.
* @see mrb_funcall
*/
-MRB_API mrb_value mrb_funcall_argv(mrb_state *mrb, mrb_value val, mrb_sym name, mrb_int argc, const mrb_value *argv);
+MRB_API mrb_value mrb_funcall_argv(mrb_state *mrb, mrb_value val, mrb_sym name, int argc, const mrb_value *argv);
/**
* Call existing ruby functions with a block.
*/
-MRB_API mrb_value mrb_funcall_with_block(mrb_state *mrb, mrb_value val, mrb_sym name, mrb_int argc, const mrb_value *argv, mrb_value block);
+MRB_API mrb_value mrb_funcall_with_block(mrb_state *mrb, mrb_value val, mrb_sym name, int argc, const mrb_value *argv, mrb_value block);
/**
* Create a symbol from C string. But usually it's better to use MRB_SYM(sym) and MRB_QSYM(qsym).
*
diff --git a/mrbgems/mruby-complex/src/complex.c b/mrbgems/mruby-complex/src/complex.c
index 85735b704..6b7486ab0 100644
--- a/mrbgems/mruby-complex/src/complex.c
+++ b/mrbgems/mruby-complex/src/complex.c
@@ -122,7 +122,7 @@ complex_to_i(mrb_state *mrb, mrb_value self)
if (p->imaginary != 0) {
mrb_raisef(mrb, E_RANGE_ERROR, "can't convert %v into Float", self);
}
- return mrb_int_value(mrb, p->real);
+ return mrb_int_value(mrb, (mrb_int)p->real);
}
static mrb_value
diff --git a/mrbgems/mruby-print/src/print.c b/mrbgems/mruby-print/src/print.c
index df153d920..74d736397 100644
--- a/mrbgems/mruby-print/src/print.c
+++ b/mrbgems/mruby-print/src/print.c
@@ -22,7 +22,7 @@ printstr(mrb_state *mrb, const char *p, size_t len)
#if defined(_WIN32)
if (isatty(fileno(stdout))) {
DWORD written;
- int wlen = MultiByteToWideChar(CP_UTF8, 0, p, len, NULL, 0);
+ size_t wlen = MultiByteToWideChar(CP_UTF8, 0, p, 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;
diff --git a/src/class.c b/src/class.c
index ac5652e9a..668f9a6ce 100644
--- a/src/class.c
+++ b/src/class.c
@@ -50,7 +50,7 @@ mt_new(mrb_state *mrb)
return t;
}
-static struct mt_elem *mt_put(mrb_state *mrb, mt_tbl *t, mrb_sym sym, int func_p, union mt_ptr ptr);
+static struct mt_elem *mt_put(mrb_state *mrb, mt_tbl *t, mrb_sym sym, size_t func_p, union mt_ptr ptr);
static void
mt_rehash(mrb_state *mrb, mt_tbl *t)
@@ -81,7 +81,7 @@ mt_rehash(mrb_state *mrb, mt_tbl *t)
/* Set the value for the symbol in the method table. */
static struct mt_elem*
-mt_put(mrb_state *mrb, mt_tbl *t, mrb_sym sym, int func_p, union mt_ptr ptr)
+mt_put(mrb_state *mrb, mt_tbl *t, mrb_sym sym, size_t func_p, union mt_ptr ptr)
{
size_t hash, pos, start;
struct mt_elem *dslot = NULL;
diff --git a/src/vm.c b/src/vm.c
index 7c14b40dd..5f781e8bb 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -333,7 +333,7 @@ static mrb_value mrb_run(mrb_state *mrb, const struct RProc* proc, mrb_value sel
#endif
MRB_API mrb_value
-mrb_funcall(mrb_state *mrb, mrb_value self, const char *name, mrb_int argc, ...)
+mrb_funcall(mrb_state *mrb, mrb_value self, const char *name, int argc, ...)
{
mrb_value argv[MRB_FUNCALL_ARGC_MAX];
va_list ap;
@@ -353,7 +353,7 @@ mrb_funcall(mrb_state *mrb, mrb_value self, const char *name, mrb_int argc, ...)
}
MRB_API mrb_value
-mrb_funcall_id(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc, ...)
+mrb_funcall_id(mrb_state *mrb, mrb_value self, mrb_sym mid, int argc, ...)
{
mrb_value argv[MRB_FUNCALL_ARGC_MAX];
va_list ap;
@@ -396,7 +396,7 @@ ci_nregs(mrb_callinfo *ci)
}
MRB_API mrb_value
-mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc, const mrb_value *argv, mrb_value blk)
+mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, int argc, const mrb_value *argv, mrb_value blk)
{
mrb_value val;
int ai = mrb_gc_arena_save(mrb);
@@ -497,7 +497,7 @@ mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc
}
MRB_API mrb_value
-mrb_funcall_argv(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc, const mrb_value *argv)
+mrb_funcall_argv(mrb_state *mrb, mrb_value self, mrb_sym mid, int argc, const mrb_value *argv)
{
return mrb_funcall_with_block(mrb, self, mid, argc, argv, mrb_nil_value());
}
@@ -849,7 +849,7 @@ argnum_error(mrb_state *mrb, mrb_int num)
{
mrb_value exc;
mrb_value str;
- mrb_int argc = mrb->c->ci->argc;
+ int argc = mrb->c->ci->argc;
if (argc < 0) {
mrb_value args = mrb->c->stack[1];
@@ -1303,7 +1303,7 @@ RETRY_TRY_BLOCK:
struct RBreak *brk = (struct RBreak*)mrb->exc;
mrb_value target = mrb_break_value_get(brk);
mrb_assert(mrb_integer_p(target));
- a = mrb_integer(target);
+ a = (uint32_t)mrb_integer(target);
mrb_assert(a >= 0 && a < irep->ilen);
}
CHECKPOINT_MAIN(RBREAK_TAG_JUMP) {