mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Reduce signed/unsigned warnings in dump.c
This commit is contained in:
+4
-4
@@ -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);
|
||||
|
||||
|
||||
+4
-4
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user