size_t record_size;
end = CONST_PTR_OFFSET(data, size);
- record_size = (sizeof(*rec) + prev_intro.record_size + 3) & ~3;
+ record_size = (sizeof(*rec) + prev_intro.record_size + 3) & ~3U;
while (rec < end) {
printf(" - uid=%u: ", rec->uid);
if (prev_intro.record_size <= (char*)end - (char *)(rec+1))
i_assert(fixed_size == UINT_MAX || fixed_size == data_size);
data_size32 = (uint32_t)data_size;
- full_size = sizeof(field_idx) + ((data_size + 3) & ~3);
+ full_size = sizeof(field_idx) + ((data_size + 3) & ~3U);
if (fixed_size == UINT_MAX)
full_size += sizeof(data_size32);
typedef void mail_index_sync_lost_handler_t(struct mail_index *index);
#define MAIL_INDEX_HEADER_SIZE_ALIGN(size) \
- (((size) + 7) & ~7)
+ (((size) + 7) & ~7U)
struct mail_index_ext {
const char *name;
}
/* the record is padded to 32bits in the transaction log */
- record_size = (sizeof(*rec) + ctx->cur_ext_record_size + 3) & ~3;
+ record_size = (sizeof(*rec) + ctx->cur_ext_record_size + 3) & ~3U;
for (i = 0; i < hdr->size; i += record_size) {
rec = CONST_PTR_OFFSET(data, i);
void mail_index_seq_array_alloc(ARRAY_TYPE(seq_array) *array,
size_t record_size)
{
- size_t aligned_record_size = (record_size + 3) & ~3;
+ size_t aligned_record_size = (record_size + 3) & ~3U;
i_assert(!array_is_created(array));
unsigned int idx, aligned_record_size;
/* records need to be 32bit aligned */
- aligned_record_size = (record_size + 3) & ~3;
+ aligned_record_size = (record_size + 3) & ~3U;
if (!array_is_created(array))
mail_index_seq_array_alloc(array, record_size);
#define HEADER_MATCH_FLAG_FOUND 1
#define HEADER_MATCH_SKIP_COUNT 2
#define HEADER_MATCH_USABLE(mail, num) \
- ((num & ~1) == (mail)->header_match_value)
+ ((num & ~1U) == (mail)->header_match_value)
ARRAY(uint8_t) header_match;
ARRAY(unsigned int) header_match_lines;
uint8_t header_match_value;
bool fcntl_locked;
int i;
- i_assert(mbox->mbox_lock_id == (lock_id & ~1));
+ i_assert(mbox->mbox_lock_id == (lock_id & ~1U));
if ((lock_id & 1) != 0) {
/* dropping exclusive lock */
/* the record is padded to 32bits in the transaction log */
ext = array_idx(&inotify->view->index->extensions,
inotify->cur_ext_id);
- record_size = (sizeof(*rec) + ext->record_size + 3) & ~3;
+ record_size = (sizeof(*rec) + ext->record_size + 3) & ~3U;
for (i = 0; i < hdr->size; i += record_size) {
rec = CONST_PTR_OFFSET(data, i);
unsigned int g, h = 0;
while (*s != '\0') {
- h = (h << 4) + ((*s) & ~0x20);
+ h = (h << 4) + ((*s) & ~0x20U);
if ((g = h & 0xf0000000UL) != 0) {
h = h ^ (g >> 24);
h = h ^ g;
}
if (size >= 64) {
- data = body(ctx, data, size & ~(unsigned long)0x3f);
+ data = body(ctx, data, size & ~0x3fUL);
size &= 0x3f;
}
}
if (size >= 64) {
- data = body(ctx, data, size & ~(unsigned long)0x3f);
+ data = body(ctx, data, size & ~0x3fUL);
size &= 0x3f;
}
test_begin("HAS_..._BITS() macro tests");
test_assert(HAS_NO_BITS(1,0));
- test_assert(HAS_NO_BITS(2,~2));
+ test_assert(HAS_NO_BITS(2,~2U));
test_assert(!HAS_NO_BITS(2,2));
/* OUCH - this vacuously true expression fails. However, if you are
/* test_assert(HAS_ANY_BITS(6,0)); */
test_assert(HAS_ANY_BITS(3,1));
test_assert(HAS_ANY_BITS(2,3));
- test_assert(!HAS_ANY_BITS(7,~(7|128)));
+ test_assert(!HAS_ANY_BITS(7,~(7U|128U)));
test_assert(HAS_ALL_BITS(0,0));
test_assert(HAS_ALL_BITS(30,14));
- test_assert(!HAS_ALL_BITS(~1,~0));
+ test_assert(!HAS_ALL_BITS(~1U,~0U));
/* Trap double-evaluation */
unsigned int v=10,b=2;
#define UIDLIST_LIST_SIZE 31
#define UIDLIST_BLOCK_LIST_COUNT 100
-#define UID_LIST_MASK_RANGE 0x80000000
+#define UID_LIST_MASK_RANGE 0x80000000U
/* set = points to uidlist index number, unset = points to uidlist offset */
-#define UID_LIST_POINTER_MASK_LIST_IDX 0x80000000
+#define UID_LIST_POINTER_MASK_LIST_IDX 0x80000000U
#define UIDLIST_PACKED_FLAG_BITMASK 1
#define UIDLIST_PACKED_FLAG_BEGINS_WITH_POINTER 2