]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Fix negation with constants to match target type
authorAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 20 Aug 2020 05:39:26 +0000 (08:39 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 22 Oct 2020 12:16:16 +0000 (12:16 +0000)
13 files changed:
src/doveadm/doveadm-dump-log.c
src/lib-index/mail-cache-transaction.c
src/lib-index/mail-index-private.h
src/lib-index/mail-index-sync-update.c
src/lib-index/mail-index-util.c
src/lib-storage/index/index-mail.h
src/lib-storage/index/mbox/mbox-lock.c
src/lib-storage/list/mailbox-list-index-notify.c
src/lib/hash.c
src/lib/md4.c
src/lib/md5.c
src/lib/test-bits.c
src/plugins/fts-squat/squat-uidlist.c

index 28f92d67aa73b0cef0a8cabcace6b00bc48ad0f6..fcfbfd8f80da0f2fa7e61cbdb824997ad5dc8b71 100644 (file)
@@ -351,7 +351,7 @@ static void log_record_print(const struct mail_transaction_header *hdr,
                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))
index 76e948a327bc88ef3cd861c7a4e3c3641fbe4f2c..ce1fdb673d375f84d7ce79a3fd1145eeef88bc47 100644 (file)
@@ -802,7 +802,7 @@ void mail_cache_add(struct mail_cache_transaction_ctx *ctx, uint32_t seq,
        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);
 
index 860c8c35edcfdfc136465ec6632a9348223dce35..d1be1a4d67fe69816aa87fcd0e715f0a4d4d28ac 100644 (file)
@@ -48,7 +48,7 @@ typedef int mail_index_expunge_handler_t(struct mail_index_sync_map_ctx *ctx,
 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;
index b85b8a8f5e5e6d2c0ff961dfc09e66eca3104af8..007cfb4bb6f7cd925be7a4629205e3f2f6b08bbf 100644 (file)
@@ -725,7 +725,7 @@ mail_index_sync_record_real(struct mail_index_sync_map_ctx *ctx,
                }
 
                /* 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);
index 066d30b97441e08184f1043af5a9701505530f45..2b27ae1e701522305d7eb3e4242cc3f23e562779 100644 (file)
@@ -95,7 +95,7 @@ bool mail_index_seq_array_lookup(const ARRAY_TYPE(seq_array) *array,
 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));
 
@@ -112,7 +112,7 @@ bool mail_index_seq_array_add(ARRAY_TYPE(seq_array) *array, uint32_t seq,
        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);
index 8b54b285c12c9df4abe1b4362c48bae1742300ee..3919ca9ab2d418c1f736a1de4b492a39084744d3 100644 (file)
@@ -149,7 +149,7 @@ struct index_mail {
 #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;
index 9f13bdaaa3a94a3b6e856e0a4a9f8fcdd252c776..cebff48701f68566114fae61fccfa6cac41f2091 100644 (file)
@@ -843,7 +843,7 @@ int mbox_unlock(struct mbox_mailbox *mbox, unsigned int lock_id)
        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 */
index 1bf7a5c3c9166a16287c5184c1246d03151d938f..35ee04e04f4b54bba1edc3a066a9f17c681a2fa7 100644 (file)
@@ -402,7 +402,7 @@ mailbox_list_index_notify_read_next(struct mailbox_list_notify_index *inotify)
                /* 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);
 
index 967921ca80abadd904498e3364816ea215466cde..4b1e6a000cc08d761cd4262b11675d44f94853b8 100644 (file)
@@ -576,7 +576,7 @@ unsigned int strfastcase_hash(const char *p)
        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;
index 9a7c24127a4d82b03dfdf91677a6f41615888140..e23b35d3fae8d014fb532b2459d09b917083eb28 100644 (file)
@@ -201,7 +201,7 @@ void md4_update(struct md4_context *ctx, const void *data, size_t size)
        }
 
        if (size >= 64) {
-               data = body(ctx, data, size & ~(unsigned long)0x3f);
+               data = body(ctx, data, size & ~0x3fUL);
                size &= 0x3f;
        }
 
index ae83860cea8910c2c4dc42e804aac05cab2101a6..bd4134084349af1e82dcaaddc384621e7aabaf96 100644 (file)
@@ -215,7 +215,7 @@ md5_update(struct md5_context *ctx, const void *data, size_t size)
        }
 
        if (size >= 64) {
-               data = body(ctx, data, size & ~(unsigned long)0x3f);
+               data = body(ctx, data, size & ~0x3fUL);
                size &= 0x3f;
        }
 
index e80a0d5d48c6a80b41900aee80cdf33017376bf8..8379c0673d44ac6b70055ce3f8faced1ec49a783 100644 (file)
@@ -195,7 +195,7 @@ static void test_bit_tests(void)
        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
@@ -204,11 +204,11 @@ static void test_bit_tests(void)
        /* 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;
index e380d8fa816972d7368d251d576031d278748eb5..5e1502efabc9e62cc186fe6be9c56ccb6075d9bc 100644 (file)
 
 #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