diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-04-26 14:16:25 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-04-26 16:10:53 +0200 |
commit | d5dd183f3622002fbc4ae175045a3ebce4eeeb05 (patch) | |
tree | 4ae8cd1a084b937fa7bc5919c42fd5f67889c1ff | |
parent | 28825acae8ee95543d4dc4f2c38e9711d4d4a420 (diff) |
treewide: address various sign-compare warnings
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | lib.c | 4 | ||||
-rw-r--r-- | types.c | 4 | ||||
-rw-r--r-- | value.c | 8 | ||||
-rw-r--r-- | vm.c | 2 |
4 files changed, 9 insertions, 9 deletions
@@ -888,7 +888,7 @@ uc_splice(uc_vm *vm, size_t nargs) if (remlen < 0) remlen = 0; } - else if ((uint64_t)remlen > arrlen - ofs) { + else if ((uint64_t)remlen > arrlen - (uint64_t)ofs) { remlen = arrlen - ofs; } @@ -1025,7 +1025,7 @@ uc_substr(uc_vm *vm, size_t nargs) if (sublen < 0) sublen = 0; } - else if ((uint64_t)sublen > len - ofs) { + else if ((uint64_t)sublen > len - (uint64_t)ofs) { sublen = len - ofs; } @@ -356,7 +356,7 @@ ucv_stringbuf_new(void) } }; - printbuf_memappend_fast(sb, (char *)&ustr, sizeof(ustr)); + printbuf_memappend_fast(sb, (char *)&ustr, (int)sizeof(ustr)); return sb; } @@ -1397,7 +1397,7 @@ ucv_call_tostring(uc_vm *vm, uc_stringbuf_t *pb, uc_value_t *uv, bool json) void _ucv_stringbuf_append(uc_stringbuf_t *pb, const char *str, size_t len) { - printbuf_memappend_fast(pb, str, len); + printbuf_memappend_fast(pb, str, (int)len); } void @@ -348,7 +348,7 @@ add_num(uc_value_list *list, int64_t n) list->index[list->isize++] = (TAG_TYPE)(TAG_NUM | TAG_SET_NV(n)); } else { - if (list->dsize + sz > TAG_MASK) { + if ((TAG_TYPE)list->dsize + sz > TAG_MASK) { fprintf(stderr, "Constant data too large\n"); abort(); } @@ -400,7 +400,7 @@ add_dbl(uc_value_list *list, double d) { size_t sz = TAG_ALIGN(sizeof(d)); - if (list->dsize + sz > TAG_MASK) { + if ((TAG_TYPE)list->dsize + sz > TAG_MASK) { fprintf(stderr, "Constant data too large\n"); abort(); } @@ -450,7 +450,7 @@ add_str(uc_value_list *list, const char *s, size_t slen) sz = TAG_ALIGN(sizeof(uint32_t) + slen); - if (list->dsize + sz > TAG_MASK) { + if ((TAG_TYPE)list->dsize + sz > TAG_MASK) { fprintf(stderr, "Constant data too large\n"); abort(); } @@ -528,7 +528,7 @@ add_ptr(uc_value_list *list, void *ptr) { size_t sz = TAG_ALIGN(sizeof(ptr)); - if (list->dsize + sz > TAG_MASK) { + if ((TAG_TYPE)list->dsize + sz > TAG_MASK) { fprintf(stderr, "Constant data too large\n"); abort(); } @@ -1836,7 +1836,7 @@ uc_vm_insn_next(uc_vm *vm, enum insn_type insn) n = (uintptr_t)iterk->data; if (n < ucv_array_length(v)) { - iterk->data = (void *)(n + 1); + iterk->data = (void *)(uintptr_t)(n + 1); if (insn == I_NEXTKV) uc_vm_stack_push(vm, ucv_uint64_new(n)); |