summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-08-19 21:50:36 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-08-19 21:50:36 +0900
commita7d611fb23e26cabf859aadcf5fc476f64054c3d (patch)
tree6b1d7e2d181fe051d66dfa9588db4077400a6ad4 /src
parent5d0fc7e57a02987c15c41c7211b928491227bdc6 (diff)
downloadmruby-a7d611fb23e26cabf859aadcf5fc476f64054c3d.tar.gz
mruby-a7d611fb23e26cabf859aadcf5fc476f64054c3d.zip
Reduce signed/unsigned warnings in dump.c
Diffstat (limited to 'src')
-rw-r--r--src/dump.c8
-rw-r--r--src/fmt_fp.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/dump.c b/src/dump.c
index dcc5ed685..d479a1a4f 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -606,7 +606,7 @@ write_debug_record_1(mrb_state *mrb, mrb_irep *irep, uint8_t *bin, mrb_sym const
ret = cur - bin;
mrb_assert_int_fit(ptrdiff_t, ret, uint32_t, UINT32_MAX);
- uint32_to_bin(ret, bin);
+ uint32_to_bin((uint32_t)ret, bin);
mrb_assert_int_fit(ptrdiff_t, ret, size_t, SIZE_MAX);
return (size_t)ret;
@@ -666,7 +666,7 @@ write_section_debug(mrb_state *mrb, mrb_irep *irep, uint8_t *cur, mrb_sym const
memcpy(header->section_ident, RITE_SECTION_DEBUG_IDENT, sizeof(header->section_ident));
mrb_assert(section_size <= INT32_MAX);
- uint32_to_bin(section_size, header->section_size);
+ uint32_to_bin((uint32_t)section_size, header->section_size);
return MRB_DUMP_OK;
}
@@ -808,7 +808,7 @@ write_section_lv(mrb_state *mrb, mrb_irep *irep, uint8_t *start, mrb_sym const *
diff = cur - start;
mrb_assert_int_fit(ptrdiff_t, diff, size_t, SIZE_MAX);
- uint32_to_bin(diff, header->section_size);
+ uint32_to_bin((uint32_t)diff, header->section_size);
lv_section_exit:
return result;
@@ -843,7 +843,7 @@ write_rite_binary_header(mrb_state *mrb, size_t binary_size, uint8_t *bin, uint8
mrb_assert(binary_size <= UINT32_MAX);
uint32_to_bin((uint32_t)binary_size, header->binary_size);
- offset = (&(header->binary_crc[0]) - bin) + sizeof(uint16_t);
+ offset = (uint32_t)((&(header->binary_crc[0]) - bin) + sizeof(uint16_t));
crc = calc_crc_16_ccitt(bin + offset, binary_size - offset, 0);
uint16_to_bin(crc, header->binary_crc);
diff --git a/src/fmt_fp.c b/src/fmt_fp.c
index ac76cef0e..6966cfef8 100644
--- a/src/fmt_fp.c
+++ b/src/fmt_fp.c
@@ -61,7 +61,7 @@ out(struct fmt_args *f, const char *s, size_t l)
#define PAD_SIZE 256
static void
-pad(struct fmt_args *f, char c, int w, ptrdiff_t l, uint8_t fl)
+pad(struct fmt_args *f, char c, ptrdiff_t w, ptrdiff_t l, uint8_t fl)
{
char pad[PAD_SIZE];
if (fl & (LEFT_ADJ | ZERO_PAD) || l >= w) return;
@@ -120,7 +120,7 @@ fmt_fp(struct fmt_args *f, long double y, ptrdiff_t p, uint8_t fl, int t)
out(f, prefix, pl);
out(f, ss, 3);
pad(f, ' ', 0, 3+pl, fl^LEFT_ADJ);
- return MAX(0, 3+pl);
+ return 3+pl;
}
y = frexp((double)y, &e2) * 2;
@@ -128,7 +128,7 @@ fmt_fp(struct fmt_args *f, long double y, ptrdiff_t p, uint8_t fl, int t)
if ((t|32)=='a') {
long double round = 8.0;
- int re;
+ ptrdiff_t re;
if (t&32) prefix += 9;
pl += 2;
@@ -332,7 +332,7 @@ fmt_fp(struct fmt_args *f, long double y, ptrdiff_t p, uint8_t fl, int t)
static int
fmt_core(struct fmt_args *f, const char *fmt, mrb_float flo)
{
- int p;
+ ptrdiff_t p;
if (*fmt != '%') {
return -1;