]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Fixed mismatched bool vs. int/pointer handling
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 5 Jun 2016 12:37:06 +0000 (15:37 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 5 Jun 2016 14:15:01 +0000 (17:15 +0300)
I don't think these fix any actual bugs.

36 files changed:
src/auth/auth-master-connection.c
src/auth/auth-postfix-connection.c
src/auth/auth.c
src/auth/mech-otp-skey-common.c
src/auth/mech-otp-skey-common.h
src/dict/dict-connection.c
src/doveadm/doveadm-cmd.c
src/doveadm/doveadm-dump-index.c
src/doveadm/doveadm-mail-fetch.c
src/lib-dcrypt/dcrypt-openssl.c
src/lib-fs/fs-randomfail.c
src/lib-http/test-http-payload.c
src/lib-http/test-http-response-parser.c
src/lib-imap-urlauth/imap-urlauth-connection.c
src/lib-imap/imap-envelope.c
src/lib-imap/imap-parser.c
src/lib-mail/mbox-from.c
src/lib-mail/message-date.c
src/lib-mail/test-message-header-decode.c
src/lib-ntlm/ntlm-message.c
src/lib-storage/index/cydir/cydir-save.c
src/lib-storage/index/imapc/imapc-mail.c
src/lib-storage/index/index-mail.c
src/lib-storage/index/index-sync.c
src/lib-storage/index/mbox/mbox-sync.c
src/lib-storage/mailbox-list.c
src/lib/file-lock.c
src/lib/strfuncs.c
src/lib/wildcard-match.c
src/master/master-settings.c
src/master/service-listen.c
src/plugins/expire/doveadm-expire.c
src/plugins/fts-squat/squat-test.c
src/plugins/fts/fts-parser-script.c
src/plugins/fts/fts-user.c
src/plugins/imap-acl/imap-acl-plugin.c

index 1b0bedafa149ca9bbdbd0b3abf47eb0b24575103..810f555f0229bd0045a7fa3e3b97383945b48af7 100644 (file)
@@ -132,7 +132,7 @@ master_input_request(struct auth_master_connection *conn, const char *args)
        return TRUE;
 }
 
-static int
+static bool
 master_input_cache_flush(struct auth_master_connection *conn, const char *args)
 {
        const char *const *list;
index 696e1317767dddb445677e811dab66a24815591f..50b61d832219466d60d1180b5a758242680880d2 100644 (file)
@@ -39,7 +39,7 @@ static void auth_postfix_connection_unref(struct auth_postfix_connection **_conn
 
 static struct auth_postfix_connection *auth_postfix_connections;
 
-static int
+static bool
 postfix_input_auth_request(struct auth_postfix_connection *conn,
                           const char *username,
                           struct auth_request **request_r, const char **error_r)
index 3a591b14b42d69b54a8d5fc13f68486e2d9c396b..421f241cf44d8c14ce1494152f5b162afe279668 100644 (file)
@@ -164,7 +164,7 @@ static bool auth_passdb_list_have_lookup_credentials(const struct auth *auth)
        return FALSE;
 }
 
-static int auth_passdb_list_have_set_credentials(const struct auth *auth)
+static bool auth_passdb_list_have_set_credentials(const struct auth *auth)
 {
        const struct auth_passdb *passdb;
 
index 4ebd26eb34368cfebe742c0a2aaded2b96f45d3a..1e20fc07b15529c96b2ba893c83ab6a0cdbbe977 100644 (file)
@@ -24,9 +24,9 @@ void otp_lock_init(void)
                          strcase_hash, strcasecmp);
 }
 
-int otp_try_lock(struct auth_request *auth_request)
+bool otp_try_lock(struct auth_request *auth_request)
 {
-       if (hash_table_lookup(otp_lock_table, auth_request->user))
+       if (hash_table_lookup(otp_lock_table, auth_request->user) != NULL)
                return FALSE;
 
        hash_table_insert(otp_lock_table, auth_request->user, auth_request);
index 5cefc7559edff49274d4c729038e240449d7457c..91f60f4aa8726b466eedbccf69147ab77513a973 100644 (file)
@@ -6,13 +6,13 @@ struct otp_auth_request {
 
        pool_t pool;
 
-       int lock;
+       bool lock;
 
        struct otp_state state;
 };
 
 void otp_lock_init(void);
-int otp_try_lock(struct auth_request *auth_request);
+bool otp_try_lock(struct auth_request *auth_request);
 void otp_unlock(struct auth_request *auth_request);
 
 void otp_set_credentials_callback(bool success,
index 36eac79979cead04311c3621a2a88c2e1d7a0fb6..7ab3f1f0432f37a399f80dbce8e9d226b9134a2d 100644 (file)
@@ -141,7 +141,7 @@ static void dict_connection_input(struct dict_connection *conn)
                        dict_connection_destroy(conn);
                        return;
                }
-               if (dict_connection_dict_init(conn)) {
+               if (dict_connection_dict_init(conn) < 0) {
                        dict_connection_destroy(conn);
                        return;
                }
index 790fc75eb749113ac0171aa37d4b136312476402..5b478543eec441718a476b3a6846733c3b285c01 100644 (file)
@@ -111,11 +111,11 @@ doveadm_cmd_find_multi_word(const char *cmdname, int *_argc,
        unsigned int len;
 
        if (argc < 2)
-               return NULL;
+               return FALSE;
 
        len = strlen(argv[1]);
        if (strncmp(cmdname, argv[1], len) != 0)
-               return NULL;
+               return FALSE;
 
        argc--; argv++;
        if (cmdname[len] == ' ') {
index 21509cefbaaef96fa1b220a5f3c6fbb22de2dcbe..cdf736b30238c32da55851d044568ff0e24fada3 100644 (file)
@@ -734,7 +734,7 @@ static bool test_dump_index(const char *path)
                return FALSE;
 
        ret = mail_index_open(index, MAIL_INDEX_OPEN_FLAG_READONLY) > 0;
-       if (ret > 0)
+       if (ret)
                mail_index_close(index);
        mail_index_free(&index);
        return ret;
index 5baeb457d74a0d52de9dd5c1fa589305f034780f..48fabc3c2c76f9f5ccae0687ccd7ceddc9625e5c 100644 (file)
@@ -127,7 +127,7 @@ static int fetch_hdr(struct fetch_cmd_context *ctx)
                return -1;
 
        input = i_stream_create_limit(input, hdr_size.physical_size);
-       if ((ret = doveadm_print_istream(input) < 0))
+       if ((ret = doveadm_print_istream(input)) < 0)
                fetch_set_istream_error(ctx, input);
        i_stream_unref(&input);
        return ret;
@@ -217,7 +217,7 @@ static int fetch_body_field(struct fetch_cmd_context *ctx)
                imap_msgpart_free(&msgpart);
                return -1;
        }
-       if ((ret = doveadm_print_istream(result.input) < 0))
+       if ((ret = doveadm_print_istream(result.input)) < 0)
                fetch_set_istream_error(ctx, result.input);
        i_stream_unref(&result.input);
        imap_msgpart_free(&msgpart);
@@ -234,7 +234,7 @@ static int fetch_body(struct fetch_cmd_context *ctx)
                return -1;
 
        i_stream_skip(input, hdr_size.physical_size);
-       if ((ret = doveadm_print_istream(input) < 0))
+       if ((ret = doveadm_print_istream(input)) < 0)
                fetch_set_istream_error(ctx, input);
        return ret;
 }
@@ -258,7 +258,7 @@ static int fetch_text(struct fetch_cmd_context *ctx)
 
        if (mail_get_stream(ctx->mail, NULL, NULL, &input) < 0)
                return -1;
-       if ((ret = doveadm_print_istream(input) < 0))
+       if ((ret = doveadm_print_istream(input)) < 0)
                fetch_set_istream_error(ctx, input);
        return ret;
 }
index 797214026f2cf47c44e3fe99bfe7f0c740632a00..8bec673dceca7c8b81ad9f37c5d83098e97e30c3 100644 (file)
@@ -747,7 +747,7 @@ bool dcrypt_openssl_decrypt_point_v1(buffer_t *data, buffer_t *key, BIGNUM **poi
        safe_memset(buffer_get_modifiable_data(tmp, NULL), 0,tmp->used);
        buffer_set_used_size(key, 0);
 
-       if (*point_r == FALSE)
+       if (*point_r == NULL)
                return dcrypt_openssl_error(error_r);
 
        return TRUE;
index 4cff6671f1c1df768453cdf1ae59438e6a92d021..eee278c7ff67df05b83d66088bffc5336a6c0ebf 100644 (file)
@@ -59,7 +59,7 @@ static bool fs_op_find(const char *str, enum fs_op *op_r)
        return FALSE;
 }
 
-static bool
+static int
 fs_randomfail_add_probability(struct randomfail_fs *fs,
                              const char *key, const char *value,
                              const char **error_r)
index 82546a97937459f62ab9ca56a5d2838e8d1dfb1a..6401376a797729cd279b0fb753716b59fac8ae95 100644 (file)
@@ -1214,7 +1214,7 @@ static void test_run_client_server(
                if (debug)
                        i_debug("server: PID=%s", my_pid);
                /* child: server */
-               ioloop_nested = FALSE;
+               ioloop_nested = NULL;
                ioloop = io_loop_create();
                test_server_init(server_set);
                io_loop_run(ioloop);
@@ -1226,7 +1226,7 @@ static void test_run_client_server(
                        i_debug("client: PID=%s", my_pid);
                i_close_fd(&fd_listen);
                /* parent: client */
-               ioloop_nested = FALSE;
+               ioloop_nested = NULL;
                ioloop = io_loop_create();
                client_init(client_set);
                io_loop_run(ioloop);
index 5105bfc9b2c7b77c08d0269e6f5b9867c7cf2c1a..1bb5a521e335ffb0ae632ca8ac3126233e784404 100644 (file)
@@ -116,7 +116,7 @@ static void test_http_response_parse_valid(void)
                payload = NULL;
                for (pos = 0; pos < response_text_len && ret == 0; pos++) {
                        test_istream_set_size(input, pos);
-                       ret = http_response_parse_next(parser, FALSE, &response, &error);
+                       ret = http_response_parse_next(parser, HTTP_RESPONSE_PAYLOAD_TYPE_ALLOWED, &response, &error);
                }
                test_istream_set_size(input, response_text_len);
                i_stream_unref(&input);
@@ -132,7 +132,7 @@ static void test_http_response_parse_valid(void)
                        } else {
                                payload = NULL;
                        }
-                       ret = http_response_parse_next(parser, FALSE, &response, &error);
+                       ret = http_response_parse_next(parser, HTTP_RESPONSE_PAYLOAD_TYPE_ALLOWED, &response, &error);
                }
 
                test_out("parse success", ret == 0);
@@ -203,7 +203,7 @@ static void test_http_response_parse_invalid(void)
 
                test_begin(t_strdup_printf("http response invalid [%d]", i));
 
-               while ((ret=http_response_parse_next(parser, FALSE, &response, &error)) > 0);
+               while ((ret=http_response_parse_next(parser, HTTP_RESPONSE_PAYLOAD_TYPE_ALLOWED, &response, &error)) > 0);
 
                test_assert(ret < 0);
                test_end();
@@ -235,7 +235,7 @@ static void test_http_response_parse_bad(void)
                                          sizeof(bad_response_with_nuls)-1);
        parser = http_response_parser_init(input, NULL);
        i_stream_unref(&input);
-       while ((ret=http_response_parse_next(parser, FALSE, &response, &error)) > 0);
+       while ((ret=http_response_parse_next(parser, HTTP_RESPONSE_PAYLOAD_TYPE_ALLOWED, &response, &error)) > 0);
        test_out("parse success", ret == 0);
        header = http_response_header_get(&response, "server");
        test_out("header present", header != NULL);
index 863500b808c66e8fd26da282c6a3173c4f2bfc5b..f94ee8d64a69a8c7ca460f140e996b75723d6fb6 100644 (file)
@@ -42,7 +42,7 @@ struct imap_urlauth_request {
        imap_urlauth_request_callback_t *callback;
        void *context;
 
-       unsigned int binary_has_nuls;
+       bool binary_has_nuls;
 };
 
 struct imap_urlauth_target {
index 51b04fb11a61ac3d4811e93d942f43a37d373b5d..0ea347d0e6fda32ad19f64b6f47664d5d83d1cfd 100644 (file)
@@ -390,7 +390,8 @@ bool imap_envelope_parse(const char *envelope, enum imap_envelope_field field,
        struct istream *input;
        struct imap_parser *parser;
        const struct imap_arg *args;
-       int ret;
+       int args_count;
+       bool ret;
 
        i_assert(field < IMAP_ENVELOPE_FIELDS);
 
@@ -398,8 +399,8 @@ bool imap_envelope_parse(const char *envelope, enum imap_envelope_field field,
        parser = imap_parser_create(input, NULL, (size_t)-1);
 
        (void)i_stream_read(input);
-       ret = imap_parser_read_args(parser, field+1, 0, &args);
-       if (ret > (int)field) {
+       args_count = imap_parser_read_args(parser, field+1, 0, &args);
+       if (args_count > (int)field) {
                ret = imap_envelope_parse_arg(&args[field], field,
                                              envelope, result_type, result);
        } else {
index e3cad19e08de2da346cfce5db169b1ddfada992e..a901cb2fb92c973cce8d9ebc37191905169aba5d 100644 (file)
@@ -152,9 +152,9 @@ const char *imap_parser_get_error(struct imap_parser *parser,
 }
 
 /* skip over everything parsed so far, plus the following whitespace */
-static int imap_parser_skip_to_next(struct imap_parser *parser,
-                                   const unsigned char **data,
-                                   size_t *data_size)
+static bool imap_parser_skip_to_next(struct imap_parser *parser,
+                                    const unsigned char **data,
+                                    size_t *data_size)
 {
        size_t i;
 
@@ -192,7 +192,7 @@ static void imap_parser_open_list(struct imap_parser *parser)
        parser->cur_type = ARG_PARSE_NONE;
 }
 
-static int imap_parser_close_list(struct imap_parser *parser)
+static bool imap_parser_close_list(struct imap_parser *parser)
 {
        struct imap_arg *arg;
 
@@ -299,7 +299,7 @@ static void imap_parser_save_arg(struct imap_parser *parser,
        parser->cur_type = ARG_PARSE_NONE;
 }
 
-static int is_valid_atom_char(struct imap_parser *parser, char chr)
+static bool is_valid_atom_char(struct imap_parser *parser, char chr)
 {
        const char *error_msg;
 
@@ -317,8 +317,8 @@ static int is_valid_atom_char(struct imap_parser *parser, char chr)
        return FALSE;
 }
 
-static int imap_parser_read_atom(struct imap_parser *parser,
-                                const unsigned char *data, size_t data_size)
+static bool imap_parser_read_atom(struct imap_parser *parser,
+                                 const unsigned char *data, size_t data_size)
 {
        size_t i;
 
@@ -347,8 +347,8 @@ static int imap_parser_read_atom(struct imap_parser *parser,
        return parser->cur_type == ARG_PARSE_NONE;
 }
 
-static int imap_parser_read_string(struct imap_parser *parser,
-                                  const unsigned char *data, size_t data_size)
+static bool imap_parser_read_string(struct imap_parser *parser,
+                                   const unsigned char *data, size_t data_size)
 {
        size_t i;
 
@@ -391,7 +391,7 @@ static int imap_parser_read_string(struct imap_parser *parser,
        return parser->cur_type == ARG_PARSE_NONE;
 }
 
-static int imap_parser_literal_end(struct imap_parser *parser)
+static bool imap_parser_literal_end(struct imap_parser *parser)
 {
        if (parser->literal_minus && parser->literal_nonsync &&
                parser->literal_size > 4096) {
@@ -423,9 +423,9 @@ static int imap_parser_literal_end(struct imap_parser *parser)
        return TRUE;
 }
 
-static int imap_parser_read_literal(struct imap_parser *parser,
-                                   const unsigned char *data,
-                                   size_t data_size)
+static bool imap_parser_read_literal(struct imap_parser *parser,
+                                    const unsigned char *data,
+                                    size_t data_size)
 {
        size_t i, prev_size;
 
@@ -469,9 +469,9 @@ static int imap_parser_read_literal(struct imap_parser *parser,
        return FALSE;
 }
 
-static int imap_parser_read_literal_data(struct imap_parser *parser,
-                                        const unsigned char *data,
-                                        size_t data_size)
+static bool imap_parser_read_literal_data(struct imap_parser *parser,
+                                         const unsigned char *data,
+                                         size_t data_size)
 {
        if (parser->literal_skip_crlf) {
                /* skip \r\n or \n, anything else gives an error */
@@ -573,7 +573,7 @@ static bool imap_parser_read_text(struct imap_parser *parser,
 
 /* Returns TRUE if argument was fully processed. Also returns TRUE if
    an argument inside a list was processed. */
-static int imap_parser_read_arg(struct imap_parser *parser)
+static bool imap_parser_read_arg(struct imap_parser *parser)
 {
        const unsigned char *data;
        size_t data_size;
index 6ce85f62d852e9af1f09d3139551700fa0a535e7..3eb97458161e25d0f3efc597621919a43c7aa579 100644 (file)
@@ -56,7 +56,8 @@ int mbox_from_parse(const unsigned char *msg, size_t size,
 {
        const unsigned char *msg_start, *sender_end, *msg_end;
        struct tm tm;
-       int esc, alt_stamp, timezone_secs = 0, seen_timezone = FALSE;
+       bool esc, alt_stamp, seen_timezone = FALSE;
+       int timezone_secs = 0;
        time_t t;
 
        *time_r = (time_t)-1;
index ab52e783277c61c45f24aa62c9d418a56b59c84f..ae11d6a045439ce83e12190a88218df2d686edda 100644 (file)
@@ -37,7 +37,7 @@ static int parse_timezone(const unsigned char *str, size_t len)
                /* numeric offset */
                if (!i_isdigit(str[1]) || !i_isdigit(str[2]) ||
                    !i_isdigit(str[3]) || !i_isdigit(str[4]))
-                       return FALSE;
+                       return 0;
 
                offset = ((str[1]-'0') * 10 + (str[2]-'0')) * 60  +
                        (str[3]-'0') * 10 + (str[4]-'0');
index 4d142981c4b5289668323a25ec4d51d32e290d04..a39bbe23be7478572963f82dffa6a02a9fc65934 100644 (file)
@@ -44,7 +44,7 @@ static void test_message_header_decode(void)
        for (i = 0; i < N_ELEMENTS(data); i += 2) {
                str_truncate(dest, 0);
                message_header_decode_utf8((const unsigned char *)data[i],
-                                          strlen(data[i]), dest, FALSE);
+                                          strlen(data[i]), dest, NULL);
                test_assert(strcmp(str_c(dest), data[i+1]) == 0);
        }
        test_end();
index 6c18fd1e9d71fbc35e2257b8867271a4128de33d..53cfb45a26cf4d05e0cbcda104b08e66e52f1b66 100644 (file)
@@ -56,7 +56,7 @@ static unsigned int append_string(buffer_t *buf, const char *str,
 }
 
 static void ntlmssp_append_string(buffer_t *buf, size_t buffer_offset,
-                                 const char *str, int unicode)
+                                 const char *str, bool unicode)
 {
        struct ntlmssp_buffer buffer;
        unsigned int length;
@@ -146,7 +146,7 @@ ntlmssp_create_challenge(pool_t pool, const struct ntlmssp_request *request,
 {
        buffer_t *buf;
        uint32_t flags = ntlmssp_flags(read_le32(&request->flags));
-       int unicode = flags & NTLMSSP_NEGOTIATE_UNICODE;
+       bool unicode = (flags & NTLMSSP_NEGOTIATE_UNICODE) != 0;
        struct ntlmssp_challenge c;
 
        buf = buffer_create_dynamic(pool, sizeof(struct ntlmssp_challenge));
index f2a7e9b4d94e2f19e2710c443deeaf3c679d97bb..67aaa06bc5b083aeca24a9d86382b75b678c3db1 100644 (file)
@@ -264,7 +264,7 @@ int cydir_transaction_save_commit_pre(struct mail_save_context *_ctx)
        dest_prefixlen = str_len(dest_path);
 
        seq_range_array_iter_init(&iter, &_t->changes->saved_uids); n = 0;
-       while (seq_range_array_iter_nth(&iter, n++, &uid) > 0) {
+       while (seq_range_array_iter_nth(&iter, n++, &uid)) {
                str_truncate(src_path, src_prefixlen);
                str_truncate(dest_path, dest_prefixlen);
                str_printfa(src_path, "%u", n-1);
index 86068222f25dee1a27e27e2bcbd85edfa0330a50..6e7e686209d8534652badb2f37fc4fb61f6a535b 100644 (file)
@@ -310,7 +310,7 @@ imapc_mail_get_stream(struct mail *_mail, bool get_body,
                        return -1;
 
                if (data->stream == NULL) {
-                       if (imapc_mail_failed(_mail, "BODY[]"))
+                       if (imapc_mail_failed(_mail, "BODY[]") < 0)
                                return -1;
                        i_assert(data->stream == NULL);
 
index 856822e71f3c11dd250d05c58552bd8fe95a11f3..0a488216fac11f009ae1f55bc332bfa88c2869ac 100644 (file)
@@ -168,7 +168,7 @@ static bool index_mail_get_fixed_field(struct index_mail *mail,
 {
        const unsigned int field_idx = mail->ibox->cache_fields[field].idx;
        buffer_t buf;
-       int ret;
+       bool ret;
 
        buffer_create_from_data(&buf, data, data_size);
        if (index_mail_cache_lookup_field(mail, &buf, field_idx) <= 0)
index 8b47937ae5edb5a3a3e197bb6493b8627d17021b..6721d162ad9d59d8fa80ad5406379b5fb71ecd57 100644 (file)
@@ -313,7 +313,7 @@ int index_mailbox_sync_deinit(struct mailbox_sync_context *_ctx,
 
        /* finish handling expunges, so we don't break when updating
           recent flags */
-       while (index_mailbox_sync_next_expunge(ctx, &sync_rec) > 0) ;
+       while (index_mailbox_sync_next_expunge(ctx, &sync_rec)) ;
 
        /* convert sequences to uids before syncing view */
        index_sync_search_results_uidify(ctx);
index 27b9383448af05e1cd7fa50f862b5779222d3e9a..452dcfe09346fcfd6415c4cf52f79ddddbb33b79 100644 (file)
@@ -1599,7 +1599,8 @@ static int mbox_sync_do(struct mbox_sync_context *sync_ctx,
        struct mbox_sync_mail_context mail_ctx;
        const struct stat *st;
        unsigned int i;
-       int ret, partial;
+       bool partial;
+       int ret;
 
        if (i_stream_stat(sync_ctx->file_input, FALSE, &st) < 0) {
                mbox_set_syscall_error(sync_ctx->mbox, "i_stream_stat()");
@@ -1806,8 +1807,8 @@ static int mbox_sync_int(struct mbox_mailbox *mbox, enum mbox_sync_flags flags,
        struct mail_index_transaction *trans;
        struct mbox_sync_context sync_ctx;
        enum mail_index_sync_flags sync_flags;
-       int ret, changed;
-       bool delay_writes, readonly;
+       int ret;
+       bool changed, delay_writes, readonly;
 
        readonly = mbox_is_backend_readonly(mbox) ||
                (flags & MBOX_SYNC_READONLY) != 0;
@@ -1828,11 +1829,12 @@ static int mbox_sync_int(struct mbox_mailbox *mbox, enum mbox_sync_flags flags,
            (flags & MBOX_SYNC_FORCE_SYNC) != 0) {
                if (mbox_sync_header_refresh(mbox) < 0)
                        return -1;
-               changed = 1;
+               changed = TRUE;
        } else {
                bool leave_dirty = (flags & MBOX_SYNC_UNDIRTY) == 0;
-               if ((changed = mbox_sync_has_changed(mbox, leave_dirty)) < 0)
+               if ((ret = mbox_sync_has_changed(mbox, leave_dirty)) < 0)
                        return -1;
+               changed = ret > 0;
        }
 
        if ((flags & MBOX_SYNC_LOCK_READING) != 0) {
@@ -1886,7 +1888,7 @@ again:
                /* see if we need to drop recent flags */
                sync_ctx.hdr = mail_index_get_header(sync_view);
                if (sync_ctx.hdr->first_recent_uid < sync_ctx.hdr->next_uid)
-                       changed = 1;
+                       changed = TRUE;
        }
 
        if (!changed && !mail_index_sync_have_more(index_sync_ctx)) {
@@ -1952,7 +1954,7 @@ again:
                /* ok, we have something to do but no locks. we'll have to
                   restart syncing to avoid deadlocking. */
                mbox_sync_context_free(&sync_ctx);
-               changed = 1;
+               changed = TRUE;
                goto again;
        }
 
index 38fa559db70b2df6c0fe913ec4ca5987dfc2a608..1ce5c1a6176f2a25ef2af8f2c959c9215898c03f 100644 (file)
@@ -402,7 +402,7 @@ const char *mailbox_list_get_unexpanded_path(struct mailbox_list *list,
        if (mailbox_list_settings_parse_full(user, p + 1, FALSE,
                                             &set, &error) < 0)
                return "";
-       if (mailbox_list_set_get_root_path(&set, type, &path) <= 0)
+       if (!mailbox_list_set_get_root_path(&set, type, &path))
                return "";
        return path;
 }
@@ -433,7 +433,7 @@ mailbox_list_escape_name_params(const char *vname, const char *ns_prefix,
 {
        unsigned int ns_prefix_len = strlen(ns_prefix);
        string_t *escaped_name = t_str_new(64);
-       char dirstart = TRUE;
+       bool dirstart = TRUE;
 
        /* no escaping of namespace prefix */
        if (strncmp(ns_prefix, vname, ns_prefix_len) == 0) {
@@ -1554,20 +1554,17 @@ static bool mailbox_list_init_changelog(struct mailbox_list *list)
 int mailbox_list_mkdir_missing_index_root(struct mailbox_list *list)
 {
        const char *root_dir, *index_dir;
-       int ret;
 
        if (list->index_root_dir_created)
                return 1;
 
        /* if index root dir hasn't been created yet, do it now */
-       ret = mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_INDEX,
-                                        &index_dir);
-       if (ret <= 0)
-               return ret;
-       ret = mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_MAILBOX,
-                                        &root_dir);
-       if (ret <= 0)
-               return ret;
+       if (!mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_INDEX,
+                                       &index_dir))
+               return 0;
+       if (!mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_MAILBOX,
+                                       &root_dir))
+               return 0;
 
        if (strcmp(root_dir, index_dir) != 0) {
                if (mailbox_list_mkdir_root(list, index_dir,
index a1e9595637f2be40b1193a1e9973aaaba5dc93c3..dab0d898a699a31f5dd5a36ec619288ff26fef27 100644 (file)
@@ -92,7 +92,7 @@ file_lock_find_proc_locks(int lock_fd ATTR_UNUSED)
        int fd;
 
        if (!have_proc_locks)
-               return FALSE;
+               return NULL;
 
        if (fstat(lock_fd, &st) < 0)
                return "";
index 2139591c48bfc5e4edd6cf757a7959c7c23cc797..79b4e1875828531fc895445113c9c6840ecf6860 100644 (file)
@@ -510,7 +510,7 @@ int i_strcasecmp_p(const char *const *p1, const char *const *p2)
 }
 
 static char **
-split_str(pool_t pool, const char *data, const char *separators, int spaces)
+split_str(pool_t pool, const char *data, const char *separators, bool spaces)
 {
         char **array;
        char *str;
index d6d57f496254c229793792cffab606941a12dd6a..925052b7be648c9cdc98d8ed3f3293ceae309a22 100644 (file)
@@ -23,7 +23,7 @@
 #define NOMATCH 0
 #define MATCH (match+sofar)
 
-static int wildcard_match_int(const char *data, const char *mask, int icase)
+static int wildcard_match_int(const char *data, const char *mask, bool icase)
 {
   const char *ma = mask, *na = data, *lsm = NULL, *lsn = NULL;
   int match = 1;
index da81dd075d30cb5bddef68c46cf6ccb12f4f855b..47817c174870c4821fb9d173f8320e4186403a1f 100644 (file)
@@ -416,7 +416,7 @@ service_get_client_limit(struct master_settings *set, const char *name)
 static bool
 master_settings_verify(void *_set, pool_t pool, const char **error_r)
 {
-       static int warned_auth = FALSE, warned_anvil = FALSE;
+       static bool warned_auth = FALSE, warned_anvil = FALSE;
        struct master_settings *set = _set;
        struct service_settings *const *services;
        const char *const *strings;
index 06da1f184bae568a1105d8098a813e3a24a3c263..ca5525312f4414d4c183b97a183c9a682843fe01 100644 (file)
@@ -355,8 +355,8 @@ int services_listen(struct service_list *service_list)
        return ret;
 }
 
-static int listener_equals(const struct service_listener *l1,
-                          const struct service_listener *l2)
+static bool listener_equals(const struct service_listener *l1,
+                           const struct service_listener *l2)
 {
        if (l1->type != l2->type)
                return FALSE;
index 6ce0d4d56388d17a5c727e2dae7489acada740fc..121be91475dc417f26fb50d9c44723650281d0b3 100644 (file)
@@ -151,7 +151,7 @@ doveadm_expire_mail_cmd_get_next_user(struct doveadm_mail_cmd_context *ctx,
                                                       username_r);
                } T_END;
                if (ret > 0)
-                       return TRUE;
+                       return 1;
                if (ret < 0 && ectx->delete_nonexistent_users) {
                        /* user has been deleted */
                        dict_unset(ectx->trans, key);
@@ -283,7 +283,7 @@ doveadm_expire_analyze_and_query(struct doveadm_mail_cmd_context *ctx,
        return FALSE;
 }
 
-static time_t
+static bool
 doveadm_expire_analyze_or_query(struct doveadm_mail_cmd_context *ctx,
                                const struct mail_search_arg *args)
 {
index 661acbaa22a836ef9555bfff09b9f4f186c8dcb8..ca45c33d4d8e651a1bb96bfed19544f70613f732 100644 (file)
@@ -56,7 +56,7 @@ int main(int argc ATTR_UNUSED, char *argv[])
        i_unlink_if_exists(trie_path);
        i_unlink_if_exists(uidlist_path);
        trie = squat_trie_init(trie_path, time(NULL),
-                              FILE_LOCK_METHOD_FCNTL, FALSE, 0600, (gid_t)-1);
+                              FILE_LOCK_METHOD_FCNTL, 0, 0600, (gid_t)-1);
 
        clock_start = clock();
        gettimeofday(&tv_start, NULL);
index 4259454e5684191d027e9d79a1d834f06db2f3b0..1525b7bbae34d7bc34a7ef27fe1735da0ba3bdf2 100644 (file)
@@ -203,7 +203,7 @@ fts_parser_script_try_init(struct mail_user *user,
        int fd;
 
        parse_content_disposition(content_disposition, &filename);
-       if (script_support_content(user, &content_type, filename) <= 0)
+       if (!script_support_content(user, &content_type, filename))
                return NULL;
 
        fd = script_connect(user, &path);
index 583d439bf5ccb4a4960ab0c053a6f38f56e5d286..b99f7eed6a69e5eae0ced01ae44ea37f766e7825 100644 (file)
@@ -368,7 +368,7 @@ int fts_mail_user_init(struct mail_user *user, const char **error_r)
        p_array_init(&fuser->languages, user->pool, 4);
 
        if (fts_user_init_languages(user, fuser, error_r) < 0 ||
-           fts_user_init_data_language(user, fuser, error_r)) {
+           fts_user_init_data_language(user, fuser, error_r) < 0) {
                fts_user_free(fuser);
                return -1;
        }
index afe1a10cd92729c94e0bd6086e1da77a703a99a9..d99ce5cf664d43ec419349f374cc2acf16324417 100644 (file)
@@ -190,7 +190,7 @@ static bool have_positive_owner_rights(struct acl_backend *backend,
        bool ret = FALSE;
 
        iter = acl_object_list_init(aclobj);
-       while ((ret = acl_object_list_next(iter, &rights)) > 0) {
+       while (acl_object_list_next(iter, &rights) > 0) {
                if (acl_rights_is_owner(backend, &rights)) {
                        if (rights.rights != NULL) {
                                ret = TRUE;