Silence warnings from implicit integer conversions.

Caused from combination of `mrb_int`, `int` and `size_t`..
parent 7eaaee54
......@@ -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).
*
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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) {
......
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