Squash implicit conversion complains from sanitizer.
tmp[0] <<= 8;
tmp[0] |= (unsigned char)*ptr; /* correct */
tmp[1] <<= 8;
- tmp[1] |= (BF_word_signed)(signed char)*ptr; /* bug */
+ tmp[1] |= (BF_word)(signed char)*ptr; /* bug */
/*
* Sign extension in the first char has no effect - nothing to overwrite yet,
* and those extra 24 bits will be fully shifted out of the 32-bit word. For
}
break;
case MODIFY_REMOVE:
- data_mask = ~data_mask;
+ data_mask = (unsigned char)~data_mask;
for (; seq1 <= seq2; seq1++) {
rec = MAIL_INDEX_REC_AT_SEQ(view->map, seq1);
data = PTR_OFFSET(rec, data_offset);
(view->index->flags & MAIL_INDEX_OPEN_FLAG_NO_DIRTY) == 0)
view->map->hdr.flags |= MAIL_INDEX_HDR_FLAG_HAVE_DIRTY;
- flag_mask = ~u->remove_flags;
+ flag_mask = (unsigned char)~u->remove_flags;
if (((u->add_flags | u->remove_flags) &
(MAIL_SEEN | MAIL_DELETED)) == 0) {
lua_Integer value = luaL_checkinteger(script->L, 1);
lua_Integer flag = luaL_checkinteger(script->L, 2);
- lua_pushinteger(script->L, value & (~flag));
+ lua_pushinteger(script->L, value & (lua_Integer)~flag);
return 1;
}
ret = write(MASTER_STATUS_FD, &service->master_status,
sizeof(service->master_status));
- if (ret == sizeof(service->master_status)) {
+ if (ret == (ssize_t)sizeof(service->master_status)) {
/* success */
io_remove(&service->io_status_write);
service->last_sent_status_time = ioloop_time;
if (pwrite_full(sync_ctx->write_fd,
str_data(ctx->header) + ctx->header_first_change,
str_len(ctx->header) - ctx->header_first_change,
- ctx->hdr_offset + ctx->header_first_change +
+ (off_t)ctx->hdr_offset + (off_t)ctx->header_first_change +
move_diff) < 0) {
mbox_set_syscall_error(sync_ctx->mbox, "pwrite_full()");
return -1;
(ctx->imapbase_updated || ctx->sync_ctx->base_uid_last != 0)) {
/* the position might have moved as a result of moving
whitespace */
- mbox_sync_first_mail_written(ctx, ctx->hdr_offset + move_diff);
+ mbox_sync_first_mail_written(ctx, (off_t)ctx->hdr_offset + move_diff);
}
mbox_sync_file_updated(sync_ctx, FALSE);
/* give the rest of the extra space to first mail.
we might also have to move the mail backwards to
fill the expunged space */
- padding_per_mail = move_diff + expunged_space +
- mails[idx].space;
+ padding_per_mail = move_diff + (off_t)expunged_space +
+ (off_t)mails[idx].space;
}
next_end_offset = mails[idx].offset;
for (i = 0; i < MBOX_HDR_COUNT; i++) {
if (ctx->hdr_pos[i] > pos &&
ctx->hdr_pos[i] != SIZE_MAX)
- ctx->hdr_pos[i] += diff;
+ ctx->hdr_pos[i] = (ssize_t)ctx->hdr_pos[i] + diff;
}
if (ctx->mail.space > 0) {
ctx->mail.offset > ctx->hdr_offset + pos + have);
if (ctx->mail.offset > ctx->hdr_offset + pos) {
/* free space offset moves */
- ctx->mail.offset += diff;
+ ctx->mail.offset = (ssize_t)ctx->mail.offset + diff;
}
}
/* read the From-line before rewriting overwrites it */
if (mbox_read_from_line(mail_ctx) < 0)
return -1;
- i_assert(mail_ctx->mail.from_offset + move_diff != 1 &&
- mail_ctx->mail.from_offset + move_diff != 2);
+ i_assert((off_t)mail_ctx->mail.from_offset + move_diff != 1 &&
+ (off_t)mail_ctx->mail.from_offset + move_diff != 2);
mbox_sync_update_header(mail_ctx);
ret = mbox_sync_try_rewrite(mail_ctx, move_diff);
new location */
i_assert((off_t)mail_ctx->mail.from_offset >=
-move_diff);
- mail_ctx->mail.from_offset += move_diff;
- mail_ctx->mail.offset += move_diff;
+ mail_ctx->mail.from_offset = (off_t)mail_ctx->mail.from_offset + move_diff;
+ mail_ctx->mail.offset = (off_t)mail_ctx->mail.offset + move_diff;
if (mbox_write_from_line(mail_ctx) < 0)
return -1;
} else {
char buf[12];
const char *bufp = buf;
memcpy(buf, ostr, olen+1);
- buf[rc] = i_rand_limit(CHAR_MAX + 1 - CHAR_MIN) + CHAR_MIN;
+ buf[rc] = (int32_t)i_rand_limit(CHAR_MAX + 1 - CHAR_MIN) + CHAR_MIN;
if(rc == olen)
buf[rc+1] = '\0';
array_idx_set(&arr2, j, &bufp);
if (line[0] != '\001')
return FALSE;
- uint8_t type = line[1];
+ uint8_t type = (uint8_t)line[1];
if (type != ((LOG_TYPE_DEBUG+1) | 0x80))
return FALSE;
line += 2;
test_assert(chr2 == chr);
if ((chr & 0x63) == 0) {
- unsigned int utf8len = uni_utf8_char_bytes(*str_c(str));
+ unsigned int utf8len = uni_utf8_char_bytes((unsigned char)*str_c(str));
/* virtually truncate the byte string */
while (--utf8len > 0)
test_assert(uni_utf8_get_char_n(str_c(str), utf8len, &chr2) == 0);
- utf8len = uni_utf8_char_bytes(*str_c(str));
+ utf8len = uni_utf8_char_bytes((unsigned char)*str_c(str));
/* actually truncate the byte stream */
while (--utf8len > 0) {