Add proper casts to silence VC warnings.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-06-05 16:04:30 +09:00
parent f1523d2404
commit 106f4c4e9d
4 changed files with 10 additions and 10 deletions
+4 -4
View File
@@ -160,7 +160,7 @@ fmt_fp(struct fmt_args *f, long double y, ptrdiff_t w, ptrdiff_t p, uint32_t fl,
out(f, prefix, pl);
out(f, ss, 3);
pad(f, ' ', w, 3+pl, fl^LEFT_ADJ);
return MAX(w, 3+(int)pl);
return (int)MAX(w, 3+pl);
}
y = frexp((double)y, &e2) * 2;
@@ -215,7 +215,7 @@ fmt_fp(struct fmt_args *f, long double y, ptrdiff_t w, ptrdiff_t p, uint32_t fl,
pad(f, '0', l-(ebuf-estr)-(s-buf), 0, 0);
out(f, estr, ebuf-estr);
pad(f, ' ', w, pl+l, fl^LEFT_ADJ);
return MAX(w, (int)pl+(int)l);
return (int)MAX(w, pl+l);
}
if (p<0) p=6;
@@ -366,7 +366,7 @@ fmt_fp(struct fmt_args *f, long double y, ptrdiff_t w, ptrdiff_t p, uint32_t fl,
pad(f, ' ', w, pl+l, fl^LEFT_ADJ);
return MAX(w, (int)pl+(int)l);
return (int)MAX(w, pl+l);
}
static int
@@ -440,7 +440,7 @@ mrb_float_to_cstr(mrb_state *mrb, char *buf, size_t len, const char *fmt, mrb_fl
mrb_raise(mrb, E_ARGUMENT_ERROR, "invalid format string");
}
*cstr.buf = '\0';
return cstr.buf - buf;
return (int)cstr.buf - buf;
}
#else /* MRB_DISABLE_STDIO || _WIN32 || _WIN64 */
#include <mruby.h>
+2 -2
View File
@@ -365,7 +365,7 @@ ht_put(mrb_state *mrb, htable *t, mrb_value key, mrb_value val)
if (!seg->next && i >= t->last_len) {
seg->e[i].key = key;
seg->e[i].val = val;
t->last_len = i+1;
t->last_len = (uint16_t)i+1;
t->size++;
return;
}
@@ -407,7 +407,7 @@ ht_put(mrb_state *mrb, htable *t, mrb_value key, mrb_value val)
}
seg->e[i].key = key;
seg->e[i].val = val;
t->last_len = i+1;
t->last_len = (uint16_t)i+1;
if (t->index == NULL && t->size > MRB_HT_INIT_SIZE*4) {
ht_index(mrb, t);
}