]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Use SIZE_MAX instead of (size_t)-1
authorAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 23 Sep 2020 11:43:29 +0000 (14:43 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 22 Oct 2020 12:16:16 +0000 (12:16 +0000)
201 files changed:
src/anvil/anvil-connection.c
src/auth/auth-client-connection.c
src/auth/auth-master-connection.c
src/auth/auth-settings.c
src/auth/auth-worker-client.c
src/auth/auth-worker-server.c
src/auth/db-passwd-file.c
src/auth/mech-gssapi.c
src/auth/mech-winbind.c
src/auth/userdb-passwd-file.c
src/config/config-connection.c
src/config/config-parser.c
src/config/config-request.c
src/dict/dict-settings.c
src/director/auth-connection.c
src/director/director-settings.c
src/director/director-test.c
src/director/director.c
src/director/doveadm-connection.c
src/director/login-connection.c
src/dns/dns-client.c
src/doveadm/client-connection-tcp.c
src/doveadm/doveadm-director.c
src/doveadm/doveadm-dsync.c
src/doveadm/doveadm-dump-dbox.c
src/doveadm/doveadm-dump-log.c
src/doveadm/doveadm-log.c
src/doveadm/doveadm-oldstats.c
src/doveadm/doveadm-penalty.c
src/doveadm/doveadm-replicator.c
src/doveadm/doveadm-settings.c
src/doveadm/doveadm-stats.c
src/doveadm/doveadm-who.c
src/doveadm/doveadm-zlib.c
src/doveadm/server-connection.c
src/imap-hibernate/imap-hibernate-client.c
src/imap-hibernate/imap-master-connection.c
src/imap-login/imap-login-settings.c
src/imap-urlauth/imap-urlauth-client.c
src/imap-urlauth/imap-urlauth-login-settings.c
src/imap-urlauth/imap-urlauth-settings.c
src/imap-urlauth/imap-urlauth-worker-settings.c
src/imap-urlauth/imap-urlauth-worker.c
src/imap/cmd-getmetadata.c
src/imap/cmd-urlfetch.c
src/imap/imap-client.c
src/imap/imap-fetch-body.c
src/imap/imap-master-client.c
src/imap/imap-settings.c
src/indexer/indexer-client.c
src/indexer/master-connection.c
src/indexer/worker-connection.c
src/ipc/client.c
src/ipc/ipc-connection.c
src/lib-auth/auth-client-connection.c
src/lib-charset/charset-iconv.c
src/lib-dcrypt/dcrypt-openssl.c
src/lib-dcrypt/ostream-encrypt.c
src/lib-dict/dict-client.c
src/lib-dict/dict-file.c
src/lib-dict/dict-memcached-ascii.c
src/lib-dict/dict-memcached.c
src/lib-dict/dict-redis.c
src/lib-dns/dns-lookup.c
src/lib-dns/dns-util.c
src/lib-fs/fs-test.c
src/lib-http/http-client-connection.c
src/lib-http/http-client-request.c
src/lib-http/http-message-parser.c
src/lib-http/http-server-connection.c
src/lib-http/http-server-response.c
src/lib-http/test-http-client-errors.c
src/lib-http/test-http-payload.c
src/lib-http/test-http-server-errors.c
src/lib-imap-client/imapc-client.h
src/lib-imap-client/imapc-connection.c
src/lib-imap-client/test-imapc-client.c
src/lib-imap-storage/imap-msgpart.c
src/lib-imap-urlauth/imap-urlauth-connection.c
src/lib-imap/imap-bodystructure.c
src/lib-imap/imap-envelope.c
src/lib-imap/imap-id.c
src/lib-index/mail-cache-transaction.c
src/lib-index/mail-index-fsck.c
src/lib-index/mail-index-strmap.c
src/lib-index/mail-index-transaction-update.c
src/lib-index/mail-transaction-log-append.c
src/lib-index/mail-transaction-log-file.c
src/lib-lda/lda-settings.c
src/lib-mail/istream-header-filter.c
src/lib-mail/qp-decoder.c
src/lib-mail/test-istream-dot.c
src/lib-master/anvil-client.c
src/lib-master/ipc-client.c
src/lib-master/ipc-server.c
src/lib-master/master-instance.c
src/lib-master/master-login-auth.c
src/lib-master/master-login.c
src/lib-master/master-service-settings-cache.c
src/lib-master/master-service-settings.c
src/lib-master/master-service-ssl-settings.c
src/lib-master/stats-client.c
src/lib-master/test-event-stats.c
src/lib-master/test-master-service-settings-cache.c
src/lib-oauth2/test-oauth2-jwt.c
src/lib-program-client/program-client.c
src/lib-program-client/test-program-client-net.c
src/lib-program-client/test-program-client-unix.c
src/lib-settings/settings-parser.c
src/lib-settings/settings.c
src/lib-smtp/smtp-client-command.c
src/lib-smtp/smtp-client-connection.c
src/lib-smtp/smtp-client.h
src/lib-smtp/smtp-reply-parser.c
src/lib-smtp/smtp-server-connection.c
src/lib-smtp/smtp-submit-settings.c
src/lib-smtp/test-smtp-client-errors.c
src/lib-smtp/test-smtp-server-errors.c
src/lib-smtp/test-smtp-submit.c
src/lib-sql/sql-api.c
src/lib-ssl-iostream/istream-openssl.c
src/lib-storage/index/dbox-common/dbox-file.c
src/lib-storage/index/dbox-multi/mdbox-purge.c
src/lib-storage/index/dbox-multi/mdbox-settings.c
src/lib-storage/index/imapc/imapc-settings.c
src/lib-storage/index/maildir/maildir-settings.c
src/lib-storage/index/maildir/maildir-uidlist.c
src/lib-storage/index/mbox/istream-raw-mbox.c
src/lib-storage/index/mbox/mbox-settings.c
src/lib-storage/index/mbox/mbox-sync-parse.c
src/lib-storage/index/mbox/mbox-sync-rewrite.c
src/lib-storage/index/mbox/mbox-sync-update.c
src/lib-storage/index/pop3c/pop3c-client.c
src/lib-storage/index/pop3c/pop3c-settings.c
src/lib-storage/mail-storage-settings.c
src/lib-test/test-istream.c
src/lib-test/test-ostream.c
src/lib/array.c
src/lib/array.h
src/lib/buffer.c
src/lib/buffer.h
src/lib/file-cache.c
src/lib/istream-data.c
src/lib/istream-seekable.c
src/lib/istream-tee.c
src/lib/mempool-system.c
src/lib/ostream-buffer.c
src/lib/ostream-wrapper.c
src/lib/strfuncs.c
src/lib/test-buffer-istream.c
src/lib/test-buffer.c
src/lib/test-connection.c
src/lib/test-file-cache.c
src/lib/test-iostream-pump.c
src/lib/test-istream-multiplex.c
src/lib/test-multiplex.c
src/lib/test-ostream-buffer.c
src/lib/test-ostream-multiplex.c
src/lib/unichar.c
src/lib/uri-util.c
src/lmtp/lmtp-settings.c
src/log/doveadm-connection.c
src/login-common/login-proxy.c
src/login-common/login-settings.c
src/master/master-settings.c
src/master/test-auth-client.c
src/master/test-auth-master.c
src/master/test-master-login-auth.c
src/old-stats/client.c
src/old-stats/global-memory.c
src/old-stats/stats-settings.c
src/plugins/acl/acl-backend-vfile-acllist.c
src/plugins/acl/acl-backend-vfile.c
src/plugins/acl/acl-global-file.c
src/plugins/fts-squat/squat-test.c
src/plugins/fts/fts-expunge-log.c
src/plugins/mail-crypt/fs-crypt-common.c
src/plugins/mail-crypt/fs-crypt-settings.c
src/plugins/quota/quota-status-settings.c
src/plugins/quota/quota-status.c
src/plugins/trash/trash-plugin.c
src/plugins/virtual/virtual-config.c
src/pop3-login/pop3-login-settings.c
src/pop3/pop3-client.c
src/pop3/pop3-settings.c
src/replication/aggregator/aggregator-settings.c
src/replication/aggregator/notify-connection.c
src/replication/aggregator/replicator-connection.c
src/replication/replicator/doveadm-connection.c
src/replication/replicator/dsync-client.c
src/replication/replicator/notify-connection.c
src/replication/replicator/replicator-queue.c
src/replication/replicator/replicator-settings.c
src/stats/client-reader.c
src/stats/client-writer.c
src/stats/stats-settings.c
src/stats/test-client-reader.c
src/stats/test-client-writer.c
src/submission-login/submission-login-settings.c
src/submission/submission-settings.c
src/util/rawlog.c

index 86740fb4c98247d76f2a3c75e0aceac394b3aeb9..20e859b5c3365c0ade0b7d3d45770b55d77500fa 100644 (file)
@@ -192,7 +192,7 @@ anvil_connection_create(int fd, bool master, bool fifo)
        conn->fd = fd;
        conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE);
        if (!fifo) {
-               conn->output = o_stream_create_fd(fd, (size_t)-1);
+               conn->output = o_stream_create_fd(fd, SIZE_MAX);
                o_stream_set_no_error_handling(conn->output, TRUE);
        }
        conn->io = io_add(fd, IO_READ, anvil_connection_input, conn);
index 4975ebfe564faad0a82e3e50baf56b2b274f4771..6dc4bf45d793faea14482d47e915de5ddf4ac439 100644 (file)
@@ -341,7 +341,7 @@ void auth_client_connection_create(struct auth *auth, int fd,
 
        conn->fd = fd;
        conn->input = i_stream_create_fd(fd, AUTH_CLIENT_MAX_LINE_LENGTH);
-       conn->output = o_stream_create_fd(fd, (size_t)-1);
+       conn->output = o_stream_create_fd(fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->output, TRUE);
        o_stream_set_flush_callback(conn->output, auth_client_output, conn);
        conn->io = io_add(fd, IO_READ, auth_client_input, conn);
index 0cc14e27457de0ef813500a04029903c11cbced0..967b929967d7f45f5ddb54bffbf4755bcec469d4 100644 (file)
@@ -779,7 +779,7 @@ auth_master_connection_create(struct auth *auth, int fd,
        conn->path = i_strdup(path);
        conn->auth = auth;
        conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE);
-       conn->output = o_stream_create_fd(fd, (size_t)-1);
+       conn->output = o_stream_create_fd(fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->output, TRUE);
        o_stream_set_flush_callback(conn->output, master_output, conn);
        conn->io = io_add(fd, IO_READ, master_input, conn);
index cdda11330a054344e5d8ebf2d1f456bd9f21346e..80f73d55c45be346a1db5968de5f4b7eff71eac7 100644 (file)
@@ -156,7 +156,7 @@ const struct setting_parser_info auth_passdb_setting_parser_info = {
        .type_offset = offsetof(struct auth_passdb_settings, name),
        .struct_size = sizeof(struct auth_passdb_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .parent = &auth_setting_parser_info,
 
        .check_func = auth_passdb_settings_check
@@ -206,7 +206,7 @@ const struct setting_parser_info auth_userdb_setting_parser_info = {
        .type_offset = offsetof(struct auth_userdb_settings, name),
        .struct_size = sizeof(struct auth_userdb_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .parent = &auth_setting_parser_info,
 
        .check_func = auth_userdb_settings_check
@@ -344,10 +344,10 @@ const struct setting_parser_info auth_setting_parser_info = {
        .defines = auth_setting_defines,
        .defaults = &auth_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct auth_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
        .check_func = auth_settings_check
 };
index 38d0ba46fca16021319d8072ac612a5634c80f68..72c1707a5afc53fd8589f4e1bb55321f4e55847d 100644 (file)
@@ -856,8 +856,8 @@ static const struct connection_settings auth_worker_client_set =
        .service_name_out = "auth-worker",
        .major_version = AUTH_WORKER_PROTOCOL_MAJOR_VERSION,
        .minor_version = AUTH_WORKER_PROTOCOL_MINOR_VERSION,
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1, /* we use throttling */
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX, /* we use throttling */
 };
 
 struct auth_worker_client *
index a651b87bf9548d9b034f18e2155d85369ffc77de..a42c936f1376eebfee258696818ddf7abb29f5a5 100644 (file)
@@ -193,7 +193,7 @@ static struct auth_worker_connection *auth_worker_create(void)
        conn = i_new(struct auth_worker_connection, 1);
        conn->fd = fd;
        conn->input = i_stream_create_fd(fd, AUTH_WORKER_MAX_LINE_LENGTH);
-       conn->output = o_stream_create_fd(fd, (size_t)-1);
+       conn->output = o_stream_create_fd(fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->output, TRUE);
        conn->io = io_add(fd, IO_READ, worker_input, conn);
        conn->to = timeout_add(AUTH_WORKER_MAX_IDLE_SECS * 1000,
index d711e0e9cc858ca075d7b5fe756d68cd112ca204..2b42eb32dab55a1b9f77aa0a3551299c1863c1c0 100644 (file)
@@ -200,7 +200,7 @@ static int passwd_file_open(struct passwd_file *pw, bool startup,
        hash_table_create(&pw->users, pw->pool, 0, str_hash, strcmp);
 
        start_time = time(NULL);
-       input = i_stream_create_fd(pw->fd, (size_t)-1);
+       input = i_stream_create_fd(pw->fd, SIZE_MAX);
        i_stream_set_return_partial_line(input, TRUE);
        while ((line = i_stream_read_next_line(input)) != NULL) {
                if (*line == '\0' || *line == ':' || *line == '#')
index 3594b84fd83d2eadfb9821d6f22862ece8d51bcd..33eb8d7946de834ba3d4317c8aca783afd1076b6 100644 (file)
@@ -97,7 +97,7 @@ static void mech_gssapi_log_error(struct auth_request *request,
 
                e_info(request->mech_event,
                       "While %s: %s", description,
-                      str_sanitize(status_string.value, (size_t)-1));
+                      str_sanitize(status_string.value, SIZE_MAX));
 
                (void)gss_release_buffer(&minor_status, &status_string);
        } while (message_context != 0);
index 1710116d7dfada2b06f89f91deee264fce091e34..0b4b5a54036da2e497e032a77164e442a6309e2e 100644 (file)
@@ -145,7 +145,7 @@ winbind_helper_connect(const struct auth_settings *set,
        winbind->in_pipe =
                i_stream_create_fd_autoclose(&infd[0], AUTH_CLIENT_MAX_LINE_LENGTH);
        winbind->out_pipe =
-               o_stream_create_fd_autoclose(&outfd[1], (size_t)-1);
+               o_stream_create_fd_autoclose(&outfd[1], SIZE_MAX);
 
        if (!sigchld_handler_set) {
                sigchld_handler_set = TRUE;
index 466bdb858f42ed01ad73fd836f78c78c9c6e122e..2aa5a7d45595563ed6713f89fc7d17908a78b879 100644 (file)
@@ -129,7 +129,7 @@ passwd_file_iterate_init(struct auth_request *auth_request,
                i_error("open(%s) failed: %m", ctx->path);
                ctx->ctx.failed = TRUE;
        } else {
-               ctx->input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+               ctx->input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
        }
        return &ctx->ctx;
 }
index 206b0637bcf69b1a545eaf030e1e956b615cc795..5f299c81d24f994be4debc6383a64a093e9503bb 100644 (file)
@@ -230,7 +230,7 @@ struct config_connection *config_connection_create(int fd)
        conn = i_new(struct config_connection, 1);
        conn->fd = fd;
        conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE);
-       conn->output = o_stream_create_fd(fd, (size_t)-1);
+       conn->output = o_stream_create_fd(fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->output, TRUE);
        conn->io = io_add(fd, IO_READ, config_connection_input, conn);
        DLLIST_PREPEND(&config_connections, conn);
index 6894123ea34a94bd4365d3c246fceae4fccdfac6..03fb4e35598422c911137f26efd58591f68df142 100644 (file)
@@ -72,7 +72,7 @@ static int config_add_type(struct setting_parser_context *parser,
                /* section inside strlist */
                return -1;
        }
-       if (info->type_offset == (size_t)-1)
+       if (info->type_offset == SIZE_MAX)
                return 0;
 
        str = t_str_new(256);
@@ -515,7 +515,7 @@ static int settings_add_include(struct config_parser_context *ctx, const char *p
        new_input = p_new(ctx->pool, struct input_stack, 1);
        new_input->prev = ctx->cur_input;
        new_input->path = p_strdup(ctx->pool, path);
-       new_input->input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+       new_input->input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
        i_stream_set_return_partial_line(new_input->input, TRUE);
        ctx->cur_input = new_input;
        return 0;
@@ -1019,7 +1019,7 @@ int config_parse_file(const char *path, bool expand_values,
        ctx.str = str_new(ctx.pool, 256);
        full_line = str_new(default_pool, 512);
        ctx.cur_input->input = fd != -1 ?
-               i_stream_create_fd_autoclose(&fd, (size_t)-1) :
+               i_stream_create_fd_autoclose(&fd, SIZE_MAX) :
                i_stream_create_from_data("", 0);
        i_stream_set_return_partial_line(ctx.cur_input->input, TRUE);
        old_settings_init(&ctx);
index b289d023426fa0d42db64c9216cc2e8b757a1bc4..5b62e64f3c32c6533c9b40145c05bc4381752fbb 100644 (file)
@@ -200,7 +200,7 @@ setting_export_section_name(string_t *str, const struct setting_define *def,
                return;
        }
        name_offset = def->list_info->type_offset;
-       i_assert(name_offset != (size_t)-1);
+       i_assert(name_offset != SIZE_MAX);
 
        name = CONST_PTR_OFFSET(set, name_offset);
        if (*name == NULL || **name == '\0') {
index 38a4366823fb1392ffc345d13b3738b4a0b84027..bd4092ad963d9c39c029e3b9e0ed91663c295614 100644 (file)
@@ -107,10 +107,10 @@ const struct setting_parser_info dict_setting_parser_info = {
        .defines = dict_setting_defines,
        .defaults = &dict_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct dict_server_settings),
 
-       .parent_offset = (size_t)-1
+       .parent_offset = SIZE_MAX
 };
 
 const struct dict_server_settings *dict_settings;
index 3e159188a514703a1f6a53db1ff784c473bec698..33e58cebf387ca9a29ce96346f1f264060fd3e20 100644 (file)
@@ -91,7 +91,7 @@ int auth_connection_connect(struct auth_connection *conn)
        }
 
        conn->input = i_stream_create_fd(conn->fd, AUTH_CLIENT_MAX_LINE_LENGTH);
-       conn->output = o_stream_create_fd(conn->fd, (size_t)-1);
+       conn->output = o_stream_create_fd(conn->fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->output, TRUE);
        conn->io = io_add(conn->fd, IO_READ, auth_connection_input, conn);
        return 0;
index e4e2802c09ed08139f9fcc7d162d4a8afc21e51d..db35d0df15dae3f2f2ece344e016546305b3edd1 100644 (file)
@@ -104,10 +104,10 @@ const struct setting_parser_info director_setting_parser_info = {
        .defines = director_setting_defines,
        .defaults = &director_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct director_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
        .check_func = director_settings_verify
 };
index de5ff0c74448a4fdca4b2738d96ef4ec048df119..ab632b4d3f731c4cdb999e2d6ede1b8c78836d0d 100644 (file)
@@ -246,7 +246,7 @@ static void imap_client_create(int fd)
        client = i_new(struct imap_client, 1);
        client->fd = fd;
        client->input = i_stream_create_fd(fd, 4096);
-       client->output = o_stream_create_fd(fd, (size_t)-1);
+       client->output = o_stream_create_fd(fd, SIZE_MAX);
        o_stream_set_no_error_handling(client->output, TRUE);
        client->io = io_add(fd, IO_READ, imap_client_input, client);
        client->parser =
@@ -343,15 +343,15 @@ director_connection_create(int in_fd, const struct ip_addr *local_ip,
 
        conn = i_new(struct director_connection, 1);
        conn->in_fd = in_fd;
-       conn->in_input = i_stream_create_fd(conn->in_fd, (size_t)-1);
-       conn->in_output = o_stream_create_fd(conn->in_fd, (size_t)-1);
+       conn->in_input = i_stream_create_fd(conn->in_fd, SIZE_MAX);
+       conn->in_output = o_stream_create_fd(conn->in_fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->in_output, TRUE);
        conn->in_io = io_add(conn->in_fd, IO_READ,
                             director_connection_in_input, conn);
 
        conn->out_fd = out_fd;
-       conn->out_input = i_stream_create_fd(conn->out_fd, (size_t)-1);
-       conn->out_output = o_stream_create_fd(conn->out_fd, (size_t)-1);
+       conn->out_input = i_stream_create_fd(conn->out_fd, SIZE_MAX);
+       conn->out_output = o_stream_create_fd(conn->out_fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->out_output, TRUE);
        conn->out_io = io_add(conn->out_fd, IO_READ,
                              director_connection_out_input, conn);
@@ -455,7 +455,7 @@ static struct admin_connection *admin_connect(const char *path)
                                            admin_random_action, conn);
 
        net_set_nonblock(conn->fd, FALSE);
-       conn->input = i_stream_create_fd(conn->fd, (size_t)-1);
+       conn->input = i_stream_create_fd(conn->fd, SIZE_MAX);
        admin_send(conn, DIRECTOR_ADMIN_HANDSHAKE);
 
        line = i_stream_read_next_line(conn->input);
index d3cb4f3470aa6dad1932e5aedfddb5b5c6472b0e..d211e8a8423694132d472be4a7a0935ce257aab7 100644 (file)
@@ -797,7 +797,7 @@ director_flush_user_continue(int result, struct director_kill_context *ctx)
                                                  ctx->username_hash);
 
        if (result == 0) {
-               struct istream *is = iostream_temp_finish(&ctx->reply, (size_t)-1);
+               struct istream *is = iostream_temp_finish(&ctx->reply, SIZE_MAX);
                char *data;
                i_stream_set_return_partial_line(is, TRUE);
                data = i_stream_read_next_line(is);
index faac4e28dc32ec11587fd5daaaa7fcf4b6a0cbd6..ea36b5fb9d6d442d44fc6b3fd4b5c004d0116b27 100644 (file)
@@ -1094,7 +1094,7 @@ doveadm_connection_init(struct director *dir, int fd)
        conn->fd = fd;
        conn->dir = dir;
        conn->input = i_stream_create_fd(conn->fd, 1024);
-       conn->output = o_stream_create_fd(conn->fd, (size_t)-1);
+       conn->output = o_stream_create_fd(conn->fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->output, TRUE);
        doveadm_connection_set_io(conn);
        o_stream_nsend_str(conn->output, DOVEADM_HANDSHAKE);
index 63a37c272f1402928238f3a0eaee4cd4b9572dcb..78de3b9372a87cecd87afa2e18bd6bdae3ed4c2e 100644 (file)
@@ -276,7 +276,7 @@ login_connection_init(struct director *dir, int fd,
        conn->refcount = 1;
        conn->fd = fd;
        conn->dir = dir;
-       conn->output = o_stream_create_fd(conn->fd, (size_t)-1);
+       conn->output = o_stream_create_fd(conn->fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->output, TRUE);
        if (type != LOGIN_CONNECTION_TYPE_AUTHREPLY) {
                i_assert(auth != NULL);
index 8903eb39f40ee8d2d1743be2ac32b8f93ca8eb1a..381c2ea975a48ecb6d1fc88e780c9d0ae08909d3 100644 (file)
@@ -123,8 +123,8 @@ static const struct connection_settings dns_client_set = {
        .service_name_out = "dns",
        .major_version = 1,
        .minor_version = 0,
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX
 };
 
 static void client_connected(struct master_service_connection *master_conn)
index dca9d48bd502c87b7509bdc4540723395d6d17d9..96efa1f2bbacf4b77ddc34a7029cecaf53b229e0 100644 (file)
@@ -547,7 +547,7 @@ client_connection_tcp_input(struct client_connection_tcp *conn)
                conn->io_setup = TRUE;
                 if (conn->use_multiplex) {
                         struct ostream *os = conn->output;
-                        conn->output = o_stream_create_multiplex(os, (size_t)-1);
+                        conn->output = o_stream_create_multiplex(os, SIZE_MAX);
                         o_stream_set_name(conn->output, o_stream_get_name(os));
                         o_stream_set_no_error_handling(conn->output, TRUE);
                         o_stream_unref(&os);
@@ -662,7 +662,7 @@ client_connection_tcp_create(int fd, int listen_fd, bool ssl)
        doveadm_print_init(DOVEADM_PRINT_TYPE_SERVER);
 
        conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE);
-       conn->output = o_stream_create_fd(fd, (size_t)-1);
+       conn->output = o_stream_create_fd(fd, SIZE_MAX);
        i_stream_set_name(conn->input, conn->conn.name);
        o_stream_set_name(conn->output, conn->conn.name);
        o_stream_set_no_error_handling(conn->output, TRUE);
index 8f27f065d462350dfaa860e6e6611880f2825165..167b091b4c36f6fe4ad3af8f74a07d28764d0ce4 100644 (file)
@@ -62,7 +62,7 @@ static void director_connect(struct director_context *ctx)
        fd = doveadm_connect(ctx->socket_path);
        net_set_nonblock(fd, FALSE);
 
-       ctx->input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+       ctx->input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
        director_send(ctx, DIRECTOR_HANDSHAKE);
 
        alarm(5);
index a0621196fedca6bb6e9d52eeab46105e7062b99b..f0494bd6f34e194b275cb95e2aa71fa398d7c264 100644 (file)
@@ -506,16 +506,16 @@ cmd_dsync_ibc_stream_init(struct dsync_cmd_context *ctx,
        if (ctx->input == NULL) {
                fd_set_nonblock(ctx->fd_in, TRUE);
                fd_set_nonblock(ctx->fd_out, TRUE);
-               ctx->input = i_stream_create_fd(ctx->fd_in, (size_t)-1);
-               ctx->output = o_stream_create_fd(ctx->fd_out, (size_t)-1);
+               ctx->input = i_stream_create_fd(ctx->fd_in, SIZE_MAX);
+               ctx->output = o_stream_create_fd(ctx->fd_out, SIZE_MAX);
        } else {
                i_assert(ctx->fd_in == -1 && ctx->fd_out == -1);
                ctx->fd_in = i_stream_get_fd(ctx->input);
                ctx->fd_out = o_stream_get_fd(ctx->output);
                ctx->input_orig_bufsize = i_stream_get_max_buffer_size(ctx->input);
                ctx->output_orig_bufsize = o_stream_get_max_buffer_size(ctx->output);
-               i_stream_set_max_buffer_size(ctx->input, (size_t)-1);
-               o_stream_set_max_buffer_size(ctx->output, (size_t)-1);
+               i_stream_set_max_buffer_size(ctx->input, SIZE_MAX);
+               o_stream_set_max_buffer_size(ctx->output, SIZE_MAX);
        }
        if (ctx->rawlog_path != NULL) {
                iostream_rawlog_create_path(ctx->rawlog_path,
index c350471b9436650d0a7886ebe5ffde723584c954..e17fcade392cd7983b81421735140702c5b76ce0 100644 (file)
@@ -200,7 +200,7 @@ static void cmd_dump_dbox(int argc ATTR_UNUSED, char *argv[])
        if (fd < 0)
                i_fatal("open(%s) failed: %m", argv[1]);
 
-       input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+       input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
        i_stream_set_name(input, argv[1]);
        hdr_size = dump_file_hdr(input);
        do {
index 1a109178575b55364fa0ee9c923022e76bcb1ec9..28f92d67aa73b0cef0a8cabcace6b00bc48ad0f6 100644 (file)
@@ -524,7 +524,7 @@ static void cmd_dump_log(int argc ATTR_UNUSED, char *argv[])
        unsigned int version;
        int ret;
 
-       input = i_stream_create_file(argv[1], (size_t)-1);
+       input = i_stream_create_file(argv[1], SIZE_MAX);
        dump_hdr(input, &modseq, &version);
        do {
                T_BEGIN {
index 5bd7aacfcf9871ac6e1a4d9e4dc3a57757745497..839dc6b329f3d8859b95ad522f02d897334abe67 100644 (file)
@@ -353,7 +353,7 @@ static void cmd_log_errors(int argc, char *argv[])
                i_fatal("net_connect_unix(%s) failed: %m", path);
        net_set_nonblock(fd, FALSE);
 
-       input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+       input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
 
        doveadm_print_init(DOVEADM_PRINT_TYPE_FORMATTED);
        doveadm_print_formatted_set_format("%{timestamp} %{type}: %{prefix}: %{text}\n");
index 86e52e31e41522705a3d15710f771b4ae7d4de62..53b1cec5d870d9565cc4dc6018efdbacd7b0bbcd 100644 (file)
@@ -81,7 +81,7 @@ static void stats_dump(const char *path, const char *cmd)
        if (write_full(fd, cmd, strlen(cmd)) < 0)
                i_fatal("write(%s) failed: %m", path);
 
-       input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+       input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
 
        /* read header */
        args = read_next_line(input);
@@ -476,7 +476,7 @@ static void stats_top(const char *path, const char *sort_type)
        hash_table_create(&ctx.sessions, default_pool, 0, str_hash, strcmp);
        net_set_nonblock(ctx.fd, FALSE);
 
-       ctx.input = i_stream_create_fd(ctx.fd, (size_t)-1);
+       ctx.input = i_stream_create_fd(ctx.fd, SIZE_MAX);
 
        if (strstr(sort_type, "cpu") != NULL)
                ctx.lines_sort = sort_cpu;
@@ -503,7 +503,7 @@ static void stats_reset(const char *path, const char **items ATTR_UNUSED)
 
        fd = doveadm_connect(path);
        net_set_nonblock(fd, FALSE);
-       input = i_stream_create_fd(fd, (size_t)-1);
+       input = i_stream_create_fd(fd, SIZE_MAX);
 
        cmd = t_str_new(10);
        str_append(cmd, "RESET");
index 711cd0bc98fdad108aa4bd04486f4498125de946..2f6d2d55832af3beb1f90467fff1ad22037c1853 100644 (file)
@@ -70,7 +70,7 @@ static void penalty_lookup(struct penalty_context *ctx)
        if (write(fd, ANVIL_CMD, strlen(ANVIL_CMD)) < 0)
                i_fatal("write(%s) failed: %m", ctx->anvil_path);
 
-       input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+       input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
        while ((line = i_stream_read_next_line(input)) != NULL) {
                if (*line == '\0')
                        break;
index 61805ccec4924e21b7ab0cdf3130bd6b43b42429..afdf920645f9ac5ed88d849975a34f8d46c30936 100644 (file)
@@ -41,7 +41,7 @@ static void replicator_connect(struct replicator_context *ctx)
        fd = doveadm_connect(ctx->socket_path);
        net_set_nonblock(fd, FALSE);
 
-       ctx->input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+       ctx->input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
        replicator_send(ctx, REPLICATOR_HANDSHAKE);
 
        alarm(5);
index 0178045406926deb619450a5a09d6e2ab097de40..33afd02ebb2560f92e347f0865e5dd190a06a066 100644 (file)
@@ -122,10 +122,10 @@ const struct setting_parser_info doveadm_setting_parser_info = {
        .defines = doveadm_setting_defines,
        .defaults = &doveadm_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct doveadm_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .check_func = doveadm_settings_check,
        .dependencies = doveadm_setting_dependencies
 };
index f727c569be0cd398cfc6b30a574b8a28a736bf77..f389d220a6b86c175cc8550cc8645cfd3d8e85b2 100644 (file)
@@ -72,7 +72,7 @@ static void stats_dump(const char *path, const char *const *fields, bool reset)
        if (write_full(fd, str_data(cmd), str_len(cmd)) < 0)
                i_fatal("write(%s) failed: %m", path);
 
-       input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+       input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
        if ((line = i_stream_read_next_line(input)) == NULL)
                i_fatal("%s: Failed to read VERSION line", path);
        else if (!version_string_verify(line, "stats-reader-server", 2)) {
index 3b9034d3f1dd5a33f99e7ffd21e2a8bed212bc1d..392e6060c4c5a21dbbfe704a9edba608fec221eb 100644 (file)
@@ -185,7 +185,7 @@ void who_lookup(struct who_context *ctx, who_callback_t *callback)
        if (write(fd, ANVIL_CMD, strlen(ANVIL_CMD)) < 0)
                i_fatal("write(%s) failed: %m", ctx->anvil_path);
 
-       input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+       input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
        while ((line = i_stream_read_next_line(input)) != NULL) {
                if (*line == '\0')
                        break;
index e82dc19fece87906772db9af37368c72a5f8fbe9..30cb24c586477e59991daf79821ff1611db4e1b6 100644 (file)
@@ -164,7 +164,7 @@ static void cmd_zlibconnect(int argc ATTR_UNUSED, char *argv[])
 
        i_zero(&client);
        client.fd = fd;
-       client.input = i_stream_create_fd(fd, (size_t)-1);
+       client.input = i_stream_create_fd(fd, SIZE_MAX);
        client.output = o_stream_create_fd(fd, 0);
        o_stream_set_no_error_handling(client.output, TRUE);
        client.io_client = io_add(STDIN_FILENO, IO_READ, client_input, &client);
index 9b13a3d4aa19c94ae0d03df593cd1e47e410048b..e346e9df2c404df88e89e7d1a992ad086b0a73d1 100644 (file)
@@ -124,7 +124,7 @@ static int server_connection_send_cmd_input_more(struct server_connection *conn)
        /* ostream-dot writes only up to max buffer size, so keep it non-zero */
        o_stream_set_max_buffer_size(conn->cmd_output, IO_BLOCK_SIZE);
        res = o_stream_send_istream(conn->cmd_output, conn->cmd_input);
-       o_stream_set_max_buffer_size(conn->cmd_output, (size_t)-1);
+       o_stream_set_max_buffer_size(conn->cmd_output, SIZE_MAX);
 
        switch (res) {
        case OSTREAM_SEND_ISTREAM_RESULT_FINISHED:
@@ -571,7 +571,7 @@ int server_connection_create(struct doveadm_server *server,
                                                     doveadm_settings->doveadm_port);
        net_set_nonblock(conn->fd, TRUE);
        conn->input = i_stream_create_fd(conn->fd, MAX_INBUF_SIZE);
-       conn->output = o_stream_create_fd(conn->fd, (size_t)-1);
+       conn->output = o_stream_create_fd(conn->fd, SIZE_MAX);
        o_stream_set_flush_callback(conn->output, server_connection_output, conn);
        o_stream_set_no_error_handling(conn->output, TRUE);
 
index 0aa5af30a128f3f74699e5abf266c31c6536b1c1..29992b0ca052e38d4358fbf9f3cddccebd89a5d9 100644 (file)
@@ -282,8 +282,8 @@ static struct connection_settings client_set = {
        .major_version = 1,
        .minor_version = 0,
 
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = FALSE
 };
 
index 824fb09a41dd1628d89060d5c93460cf31d9aa78..71fa4dd5cc86cf378d5f8477521be46a99984754 100644 (file)
@@ -119,8 +119,8 @@ static struct connection_settings client_set = {
        .major_version = 1,
        .minor_version = 0,
 
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = TRUE
 };
 
index 354d5eb882c069991931fc5aae48671df7c4687b..b88230b6c572e90e1cd0256e132182bb46a23b87 100644 (file)
@@ -81,10 +81,10 @@ static const struct setting_parser_info imap_login_setting_parser_info = {
        .defines = imap_login_setting_defines,
        .defaults = &imap_login_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct imap_login_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .dependencies = imap_login_setting_dependencies
 };
 
index bb586b36266b7ec8fa185227cbef731598b0544b..25276f9f19859298c603b67ba086786ba9b8e2ad 100644 (file)
@@ -95,7 +95,7 @@ int client_create(const char *service, const char *username,
        client->username = i_strdup(username);
        client->service = i_strdup(service);
 
-       client->output = o_stream_create_fd(fd_out, (size_t)-1);
+       client->output = o_stream_create_fd(fd_out, SIZE_MAX);
 
        imap_urlauth_client_count++;
        DLLIST_PREPEND(&imap_urlauth_clients, client);
@@ -176,7 +176,7 @@ static int client_worker_connect(struct client *client)
                return -1;
        }
 
-       client->ctrl_output = o_stream_create_fd(client->fd_ctrl, (size_t)-1);
+       client->ctrl_output = o_stream_create_fd(client->fd_ctrl, SIZE_MAX);
 
        /* send protocol version handshake */
        if (o_stream_send_str(client->ctrl_output, handshake) < 0) {
index 4442935eb20002e40aadb3f94d6b061280050754..829e2a4133655fda1523626cb2948658e56c9df2 100644 (file)
@@ -62,8 +62,8 @@ const struct setting_parser_info imap_urlauth_login_setting_parser_info = {
        .module_name = "imap-urlauth-login",
        .defines = imap_urlauth_login_setting_defines,
 
-       .type_offset = (size_t)-1,
-       .parent_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
+       .parent_offset = SIZE_MAX,
 
        .dependencies = imap_urlauth_login_setting_dependencies
 };
index e688e2999b2d9e388d0709fae636de4410ecaa57..10fd84cffcf050ac95f5bce1c3cfa5da1334dbdf 100644 (file)
@@ -85,10 +85,10 @@ const struct setting_parser_info imap_urlauth_setting_parser_info = {
        .defines = imap_urlauth_setting_defines,
        .defaults = &imap_urlauth_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct imap_urlauth_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
        .dependencies = imap_urlauth_setting_dependencies
 };
index 4b91ea1360754edda2ba22e5d53bc0ffa7d37cb0..b666395e97a7e2bfb4163ff333994df2706e364c 100644 (file)
@@ -78,10 +78,10 @@ const struct setting_parser_info imap_urlauth_worker_setting_parser_info = {
        .defines = imap_urlauth_worker_setting_defines,
        .defaults = &imap_urlauth_worker_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct imap_urlauth_worker_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
        .dependencies = imap_urlauth_worker_setting_dependencies
 };
index f61a23b770d25dc668b67fed3de31528d0838f9d..a26a439e58bb7c47767e310687a4ff3b0a266cfd 100644 (file)
@@ -194,7 +194,7 @@ client_create_standalone(const char *access_user,
        client->debug = debug;
 
        client->input = i_stream_create_fd(fd_in, MAX_INBUF_SIZE);
-       client->output = o_stream_create_fd(fd_out, (size_t)-1);
+       client->output = o_stream_create_fd(fd_out, SIZE_MAX);
        client->io = io_add(fd_in, IO_READ, client_input, client);
        client->to_idle = timeout_add(CLIENT_IDLE_TIMEOUT_MSECS,
                                      client_idle_timeout, client);
@@ -789,7 +789,7 @@ client_ctrl_read_fds(struct client *client)
 
        client->ctrl_input =
                i_stream_create_fd(client->fd_ctrl, MAX_INBUF_SIZE);
-       client->ctrl_output = o_stream_create_fd(client->fd_ctrl, (size_t)-1);
+       client->ctrl_output = o_stream_create_fd(client->fd_ctrl, SIZE_MAX);
        o_stream_set_no_error_handling(client->ctrl_output, TRUE);
        return 1;
 }
@@ -913,7 +913,7 @@ static void client_ctrl_input(struct client *client)
        }
 
        client->input = i_stream_create_fd(client->fd_in, MAX_INBUF_SIZE);
-       client->output = o_stream_create_fd(client->fd_out, (size_t)-1);
+       client->output = o_stream_create_fd(client->fd_out, SIZE_MAX);
        client->io = io_add(client->fd_in, IO_READ, client_input, client);
        o_stream_set_no_error_handling(client->output, TRUE);
        o_stream_set_flush_callback(client->output, client_output, client);
index 9693fb4f79e45fea69539c2c65da7b2f03f255b1..c6dcd0c688bcc9f863d195bac9bed843abba3fc1 100644 (file)
@@ -248,7 +248,7 @@ cmd_getmetadata_stream_continue(struct imap_getmetadata_context *ctx)
 
        o_stream_set_max_buffer_size(ctx->cmd->client->output, 0);
        res = o_stream_send_istream(ctx->cmd->client->output, ctx->cur_stream);
-       o_stream_set_max_buffer_size(ctx->cmd->client->output, (size_t)-1);
+       o_stream_set_max_buffer_size(ctx->cmd->client->output, SIZE_MAX);
 
        switch (res) {
        case OSTREAM_SEND_ISTREAM_RESULT_FINISHED:
index 60e4accf58fbf8bc765d5c68cd98c43f3f07fc18..6ea5ad5bf5288d0d2c9e7cafd8faab4bbe736700 100644 (file)
@@ -98,7 +98,7 @@ static int cmd_urlfetch_transfer_literal(struct client_command_context *cmd)
        /* transfer literal to client */
        o_stream_set_max_buffer_size(client->output, 0);
        res = o_stream_send_istream(client->output, ctx->input);
-       o_stream_set_max_buffer_size(client->output, (size_t)-1);
+       o_stream_set_max_buffer_size(client->output, SIZE_MAX);
 
        switch (res) {
        case OSTREAM_SEND_ISTREAM_RESULT_FINISHED:
index a065cfad3c31d2e5b5137cd883704b53c2809396..8b1a9fbcd0ad9847a674ad24cecd8dd3eec603dd 100644 (file)
@@ -135,7 +135,7 @@ struct client *client_create(int fd_in, int fd_out,
        client->fd_out = fd_out;
        client->input = i_stream_create_fd(fd_in,
                                           set->imap_max_line_length);
-       client->output = o_stream_create_fd(fd_out, (size_t)-1);
+       client->output = o_stream_create_fd(fd_out, SIZE_MAX);
        o_stream_set_no_error_handling(client->output, TRUE);
        i_stream_set_name(client->input, "<imap client>");
        o_stream_set_name(client->output, "<imap client>");
index d5c06c6bcad281b75b05b9ea3315ebc2c8c60c03..912c8a3cbdea82f0f26501e0d68818fc62f697e7 100644 (file)
@@ -96,7 +96,7 @@ static int fetch_stream_continue(struct imap_fetch_context *ctx)
 
        o_stream_set_max_buffer_size(ctx->client->output, 0);
        res = o_stream_send_istream(ctx->client->output, state->cur_input);
-       o_stream_set_max_buffer_size(ctx->client->output, (size_t)-1);
+       o_stream_set_max_buffer_size(ctx->client->output, SIZE_MAX);
 
        if (ctx->state.cur_stats_sizep != NULL) {
                *ctx->state.cur_stats_sizep +=
index 9b4cd97b6db4b6dbf75c7afcce4d8f297b683f72..0257fb2de892a421ea0ff921d6e41c2011650801 100644 (file)
@@ -395,8 +395,8 @@ static struct connection_settings client_set = {
        .major_version = 1,
        .minor_version = 0,
 
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = FALSE
 };
 
index 69a3950e3048e126d48bb13656649e39bace0b19..248a12989d7e7da2688fec2da3ae750eee425d0d 100644 (file)
@@ -121,10 +121,10 @@ const struct setting_parser_info imap_setting_parser_info = {
        .defines = imap_setting_defines,
        .defaults = &imap_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct imap_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
        .check_func = imap_settings_verify,
        .dependencies = imap_setting_dependencies
index d026f126fbdf39b8b6812b65d883a37caa822e5b..003ffd271c7b4d8dbfe4fe3ffadf237d4a04afe3 100644 (file)
@@ -207,7 +207,7 @@ indexer_client_create(int fd, struct indexer_queue *queue)
        client->queue = queue;
        client->fd = fd;
        client->input = i_stream_create_fd(fd, MAX_INBUF_SIZE);
-       client->output = o_stream_create_fd(fd, (size_t)-1);
+       client->output = o_stream_create_fd(fd, SIZE_MAX);
        o_stream_set_no_error_handling(client->output, TRUE);
        client->io = io_add(fd, IO_READ, indexer_client_input, client);
 
index 039ab34fe053323fd9011b6901364de43366d0da..304c7845349eda8a52e539784df88f830c6513a2 100644 (file)
@@ -303,7 +303,7 @@ master_connection_create(int fd, struct mail_storage_service_ctx *storage_servic
        conn->storage_service = storage_service;
        conn->fd = fd;
        conn->io = io_add(conn->fd, IO_READ, master_connection_input, conn);
-       conn->input = i_stream_create_fd(conn->fd, (size_t)-1);
+       conn->input = i_stream_create_fd(conn->fd, SIZE_MAX);
 
        handshake = t_strdup_printf(INDEXER_WORKER_HANDSHAKE,
                master_service_get_process_limit(master_service));
index 5f42740251fc2971ae951a0b4ab7a74957a8ac4b..b784915ba560cce37bd813c423d7b9f607190472 100644 (file)
@@ -196,8 +196,8 @@ int worker_connection_connect(struct worker_connection *conn)
                return -1;
        }
        conn->io = io_add(conn->fd, IO_READ, worker_connection_input, conn);
-       conn->input = i_stream_create_fd(conn->fd, (size_t)-1);
-       conn->output = o_stream_create_fd(conn->fd, (size_t)-1);
+       conn->input = i_stream_create_fd(conn->fd, SIZE_MAX);
+       conn->output = o_stream_create_fd(conn->fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->output, TRUE);
        o_stream_nsend_str(conn->output, INDEXER_MASTER_HANDSHAKE);
        return 0;
index a58c08d0724dbef194cd11975a25a1520b8a220b..483452e38723f45ff4505e604b54ab4e63e751c1 100644 (file)
@@ -122,8 +122,8 @@ struct client *client_create(int fd)
        client = i_new(struct client, 1);
        client->fd = fd;
        client->io = io_add(fd, IO_READ, client_input, client);
-       client->input = i_stream_create_fd(fd, (size_t)-1);
-       client->output = o_stream_create_fd(fd, (size_t)-1);
+       client->input = i_stream_create_fd(fd, SIZE_MAX);
+       client->output = o_stream_create_fd(fd, SIZE_MAX);
        o_stream_set_no_error_handling(client->output, TRUE);
 
        DLLIST_PREPEND(&clients, client);
index 7453fac98e8afc497741888af78edb29f163e4e4..48fcd089d1e3a29f1c79b7a9f693ad846014c3f5 100644 (file)
@@ -177,8 +177,8 @@ struct ipc_connection *ipc_connection_create(int listen_fd, int fd)
                conn->id = ++connection_id_counter;
        conn->fd = fd;
        conn->io = io_add(fd, IO_READ, ipc_connection_input, conn);
-       conn->input = i_stream_create_fd(fd, (size_t)-1);
-       conn->output = o_stream_create_fd(fd, (size_t)-1);
+       conn->input = i_stream_create_fd(fd, SIZE_MAX);
+       conn->output = o_stream_create_fd(fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->output, TRUE);
        i_array_init(&conn->cmds, 8);
        o_stream_nsend_str(conn->output, IPC_SERVER_HANDSHAKE);
index 472eba68c4d56ddcdfaae4a548c0ad8aac594241..3a1e82c621c3b425e8fd36640da6c7f2c674c97a 100644 (file)
@@ -47,7 +47,7 @@ static const struct connection_settings auth_client_connection_set = {
        .minor_version = AUTH_CLIENT_PROTOCOL_MINOR_VERSION,
        .unix_client_connect_msecs = 1000,
        .input_max_size = AUTH_SERVER_CONN_MAX_LINE_LENGTH,
-       .output_max_size = (size_t)-1,
+       .output_max_size = SIZE_MAX,
        .client = TRUE,
 };
 
index 3cf015a58a2c40759cf15c9a2606f2a7207e68f6..7b2921955fdfb1943b037bf5e8ccc4e1bbcd06c0 100644 (file)
@@ -72,7 +72,7 @@ charset_to_utf8_try(struct charset_translation *t,
        ic_srcbuf = (ICONV_CONST char *) src;
 
        if (iconv(t->cd, &ic_srcbuf, &srcleft,
-                 &ic_destbuf, &destleft) != (size_t)-1) {
+                 &ic_destbuf, &destleft) != SIZE_MAX) {
                i_assert(srcleft == 0);
                *result = CHARSET_RET_OK;
        } else if (errno == E2BIG) {
@@ -106,7 +106,7 @@ iconv_charset_to_utf8(struct charset_translation *t,
 {
        enum charset_result result;
        size_t pos, size;
-       size_t prev_invalid_pos = (size_t)-1;
+       size_t prev_invalid_pos = SIZE_MAX;
        bool ret;
 
        for (pos = 0;;) {
@@ -129,7 +129,7 @@ iconv_charset_to_utf8(struct charset_translation *t,
                }
        }
 
-       if (prev_invalid_pos != (size_t)-1)
+       if (prev_invalid_pos != SIZE_MAX)
                result = CHARSET_RET_INVALID_INPUT;
 
        i_assert(*src_size - pos <= CHARSET_MAX_PENDING_BUF_SIZE);
index 93dbe733452407631605978463e7b9cc2a762d67..18e32d215e0c459ca47b2a3ab47e5f8e23fea610 100644 (file)
@@ -1207,7 +1207,7 @@ dcrypt_openssl_cipher_key_dovecot_v2(const char *cipher,
                res = FALSE;
        } else {
                /* provide result if succeeded */
-               buffer_append_buf(result_r, tmp, 0, (size_t)-1);
+               buffer_append_buf(result_r, tmp, 0, SIZE_MAX);
                res = TRUE;
        }
        /* and ensure no data leaks */
@@ -1920,7 +1920,7 @@ static int bn2base64url(const BIGNUM *bn, string_t *dest)
        unsigned char *data = t_malloc_no0(len);
        if (BN_bn2bin(bn, data) != len)
                return -1;
-       base64url_encode(BASE64_ENCODE_FLAG_NO_PADDING, (size_t)-1, data, len, dest);
+       base64url_encode(BASE64_ENCODE_FLAG_NO_PADDING, SIZE_MAX, data, len, dest);
        return 0;
 }
 
index 3264725ebf5fd8b00ffcf082feeea0a04905cdc6..c6e67f51e5b00b7c95bc8f63da1d49f3b31a57db 100644 (file)
@@ -124,8 +124,8 @@ o_stream_encrypt_send_header_v2(struct encrypt_ostream *stream)
                8 + stream->key_data_len);
        buffer_append(values, &i, 4);
 
-       buffer_append_buf(values, stream->cipher_oid, 0, (size_t)-1);
-       buffer_append_buf(values, stream->mac_oid, 0, (size_t)-1);
+       buffer_append_buf(values, stream->cipher_oid, 0, SIZE_MAX);
+       buffer_append_buf(values, stream->mac_oid, 0, SIZE_MAX);
        i = cpu32_to_be(IO_STREAM_ENCRYPT_ROUNDS);
        buffer_append(values, &i, 4);
        i = cpu32_to_be(stream->key_data_len);
@@ -359,11 +359,11 @@ o_stream_encrypt_key_for_pubkey_v2(struct encrypt_ostream *stream,
        /* store ephemeral key (if present) */
        unsigned int val = cpu32_to_be(ephemeral_key->used);
        buffer_append(res, &val, 4);
-       buffer_append_buf(res, ephemeral_key, 0, (size_t)-1);
+       buffer_append_buf(res, ephemeral_key, 0, SIZE_MAX);
        /* store encrypted key */
        val = cpu32_to_be(encrypted_key->used);
        buffer_append(res, &val, 4);
-       buffer_append_buf(res, encrypted_key, 0, (size_t)-1);
+       buffer_append_buf(res, encrypted_key, 0, SIZE_MAX);
 
        return 0;
 }
index 67505fcf8274536a7a0e2546ab7983e3c2c9bcdd..f432b6c5dabd21b080ae9956a9c68d797f832f32 100644 (file)
@@ -684,8 +684,8 @@ static void dict_conn_destroy(struct connection *_conn)
 }
 
 static const struct connection_settings dict_conn_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .unix_client_connect_msecs = 1000,
        .client = TRUE
 };
index 61e03275cdf72adbf01856903014c1c303a393ad..70db4fbf7d59a303c329849da68dc98033817096 100644 (file)
@@ -178,7 +178,7 @@ static int file_dict_refresh(struct file_dict *dict, const char **error_r)
        p_clear(dict->hash_pool);
 
        if (dict->fd != -1) {
-               input = i_stream_create_fd(dict->fd, (size_t)-1);
+               input = i_stream_create_fd(dict->fd, SIZE_MAX);
 
                while ((key = i_stream_read_next_line(input)) != NULL) {
                        /* strdup() before the second read */
index d42ec443bea9d17c030e4f192670777b43cf168f..c9ba7802009df0282b889b81101da7d8af9f47ee 100644 (file)
@@ -340,8 +340,8 @@ memcached_ascii_conn_connected(struct connection *_conn, bool success)
 }
 
 static const struct connection_settings memcached_ascii_conn_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = TRUE
 };
 
index e863e09c759ed6af66b729934263c483f1b898e1..719d41af339e9b055a1cb8bc3470852d735407c3 100644 (file)
@@ -154,8 +154,8 @@ static void memcached_conn_connected(struct connection *_conn, bool success)
 }
 
 static const struct connection_settings memcached_conn_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = TRUE
 };
 
index c237bf814a413e0143ce1c487fb14132f491158a..9ef6faf43e4da9752787da6ea8414fcca8f5dbac 100644 (file)
@@ -300,8 +300,8 @@ static void redis_conn_connected(struct connection *_conn, bool success)
 }
 
 static const struct connection_settings redis_conn_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = TRUE
 };
 
index 668b61349ff257e69157b966ff5b4349b9c1833e..c37445e96a7dde7cc6b514b03b0f3a50701f91b6 100644 (file)
@@ -287,8 +287,8 @@ static const struct connection_settings dns_client_set = {
        .service_name_out = "dns-client",
        .major_version = 1,
        .minor_version = 0,
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = TRUE,
 };
 
index 51120bc07eb60a3eae55cbed1106577f8206ae6f..a8469ce29a19903aea8f8cf70b2a80a6e4fe3eaa 100644 (file)
@@ -29,7 +29,7 @@ int dns_ncompare(const char *a, const char *b, size_t n)
 
 int dns_compare(const char *a, const char *b)
 {
-       return dns_ncompare(a, b, (size_t)-1);
+       return dns_ncompare(a, b, SIZE_MAX);
 }
 
 int dns_compare_labels(const char *a, const char *b)
index cb1c9c2e0c98c14893ae11547cfaea833079e113..d35271828b7a099ae4b29c3f92a373c4c208e0cf 100644 (file)
@@ -277,7 +277,7 @@ static int fs_test_copy(struct fs_file *_src, struct fs_file *_dest)
                return -1;
        }
        buffer_set_used_size(dest->contents, 0);
-       buffer_append_buf(dest->contents, src->contents, 0, (size_t)-1);
+       buffer_append_buf(dest->contents, src->contents, 0, SIZE_MAX);
        dest->exists = TRUE;
        return 0;
 }
index a60a05d7ed2e708b3ddf12c78a0c4512cb71e2a5..b329bb25c87ef57039cd8430cccf933375ff04f8 100644 (file)
@@ -1582,8 +1582,8 @@ http_client_connection_connected(struct connection *_conn, bool success)
 }
 
 static const struct connection_settings http_client_connection_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = TRUE,
        .delayed_unix_client_connected_callback = TRUE,
        .log_connection_id = TRUE,
index 603af0dc9cfad6c95d4fa0eddb303f2d5cb297f7..4d960cebd67e192cd305aa0309000ef23d36e1a1 100644 (file)
@@ -1242,7 +1242,7 @@ int http_client_request_send_more(struct http_client_request *req,
        offset = req->payload_input->v_offset;
        o_stream_set_max_buffer_size(output, IO_BLOCK_SIZE);
        res = o_stream_send_istream(output, req->payload_input);
-       o_stream_set_max_buffer_size(output, (size_t)-1);
+       o_stream_set_max_buffer_size(output, SIZE_MAX);
 
        i_assert(req->payload_input->v_offset >= offset);
        e_debug(req->event, "Send more (sent %"PRIuUOFF_T", buffered=%zu)",
index 5746595fce57d31a49415b44ba5c31b75301ab0f..e5eb7a76ee5f19c1d6632dee45ee8a3e6a7f9dc8 100644 (file)
@@ -561,7 +561,7 @@ http_message_parse_body_encoded(struct http_message_parser *parser,
                /* FIXME: enforce max payload size (relevant to http-client
                   only) */
                parser->payload =
-                       i_stream_create_limit(parser->input, (size_t)-1);
+                       i_stream_create_limit(parser->input, SIZE_MAX);
        } else {
                /* RFC 7230, Section 3.3.3: Message Body Length
 
@@ -631,7 +631,7 @@ static int http_message_parse_body_closed(struct http_message_parser *parser)
         */
        // FIXME: enforce max payload size (relevant to http-client only)
        // FIXME: handle request case correctly.
-       parser->payload = i_stream_create_limit(parser->input, (size_t)-1);
+       parser->payload = i_stream_create_limit(parser->input, SIZE_MAX);
        return 0;
 }
 
index e5bbad0e9e313bae430347173e03a4fb48e4f44b..4605cd8fefeeccb39c8aca044ec45cd4c85aefaf 100644 (file)
@@ -948,8 +948,8 @@ bool http_server_connection_pending_payload(
 }
 
 static struct connection_settings http_server_connection_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = FALSE,
        .log_connection_id = TRUE,
 };
index 00947d80dbb3d0f917838de98f9125267282e455..f4b7f55bdf379db4a08ed447a7d97cdf3271a7d1 100644 (file)
@@ -519,7 +519,7 @@ int http_server_response_send_more(struct http_server_response *resp)
        /* Chunked ostream needs to write to the parent stream's buffer */
        o_stream_set_max_buffer_size(output, IO_BLOCK_SIZE);
        res = o_stream_send_istream(output, resp->payload_input);
-       o_stream_set_max_buffer_size(output, (size_t)-1);
+       o_stream_set_max_buffer_size(output, SIZE_MAX);
 
        switch (res) {
        case OSTREAM_SEND_ISTREAM_RESULT_FINISHED:
index 82bdaa798b7bdad90e480208c85df2d6da64ee67..462c9c45e79a464122aa9c108d9258e5e6427e1d 100644 (file)
@@ -3718,8 +3718,8 @@ static void server_connection_accept(void *context ATTR_UNUSED)
 /* */
 
 static struct connection_settings server_connection_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = FALSE
 };
 
index 6b40a08e2da747cc5bd4b236dd59a91751a7e2a1..20a60920ba4cef1c1765d5bf552ed3cd47ef7d80 100644 (file)
@@ -366,7 +366,7 @@ static int client_request_echo_send_more(struct client_request *creq)
        offset = creq->data->v_offset;
        o_stream_set_max_buffer_size(output, IO_BLOCK_SIZE);
        res = o_stream_send_istream(output, creq->data);
-       o_stream_set_max_buffer_size(output, (size_t)-1);
+       o_stream_set_max_buffer_size(output, SIZE_MAX);
 
        i_assert(creq->data->v_offset >= offset);
        if (debug) {
@@ -558,7 +558,7 @@ static void client_request_read_echo(struct client_request *creq)
 
        o_stream_set_max_buffer_size(creq->payload_output, IO_BLOCK_SIZE);
        res = o_stream_send_istream(creq->payload_output, creq->payload_input);
-       o_stream_set_max_buffer_size(creq->payload_output, (size_t)-1);
+       o_stream_set_max_buffer_size(creq->payload_output, SIZE_MAX);
 
        switch (res) {
        case OSTREAM_SEND_ISTREAM_RESULT_FINISHED:
@@ -692,7 +692,7 @@ client_handle_echo_request(struct client_request *creq,
                        break;
                case PAYLOAD_HANDLING_FORWARD:
                        http_server_request_forward_payload(req,
-                               payload_output, (size_t)-1,
+                               payload_output, SIZE_MAX,
                                client_request_finish_payload_in, creq);
                        break;
                case PAYLOAD_HANDLING_HANDLER:
index a7d0ac7572cd03bb29d4b5a0a6e1bcec2940bbbf..4a95bde7ad7aec02aa9c175af9b41a0857483dc8 100644 (file)
@@ -637,7 +637,7 @@ test_server_response_ostream_disconnect_output(
 
        o_stream_set_max_buffer_size(output, IO_BLOCK_SIZE);
        res = o_stream_send_istream(output, ctx->payload_input);
-       o_stream_set_max_buffer_size(output, (size_t)-1);
+       o_stream_set_max_buffer_size(output, SIZE_MAX);
 
        switch (res) {
        case OSTREAM_SEND_ISTREAM_RESULT_FINISHED:
@@ -801,8 +801,8 @@ static void client_connection_destroy(struct connection *_conn)
 /* */
 
 static struct connection_settings client_connection_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = TRUE
 };
 
index b619aaa5b4953aefa84574518c22eb3a4dc6717e..430681e85314caf70e94ac3eef5b95a9be55f6a1 100644 (file)
@@ -68,7 +68,7 @@ enum imapc_client_ssl_mode {
 
 #define IMAPC_DEFAULT_CONNECT_TIMEOUT_MSECS (1000*30)
 #define IMAPC_DEFAULT_COMMAND_TIMEOUT_MSECS (1000*60*5)
-#define IMAPC_DEFAULT_MAX_LINE_LENGTH ((size_t)-1)
+#define IMAPC_DEFAULT_MAX_LINE_LENGTH (SIZE_MAX)
 
 struct imapc_throttling_settings {
        unsigned int init_msecs;
index eca81648cabc5901f50d8a4d6d9e746ff9c24aa6..97dbd2558cb3cebcf7d51535f3ca432b4affa804 100644 (file)
@@ -1807,7 +1807,7 @@ static void imapc_connection_connect_next_ip(struct imapc_connection *conn)
        conn->fd = fd;
        conn->input = conn->raw_input =
                i_stream_create_fd(fd, conn->client->set.max_line_length);
-       conn->output = conn->raw_output = o_stream_create_fd(fd, (size_t)-1);
+       conn->output = conn->raw_output = o_stream_create_fd(fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->output, TRUE);
 
        if (*conn->client->set.rawlog_dir != '\0' &&
@@ -2068,7 +2068,7 @@ static int imapc_command_try_send_stream(struct imapc_connection *conn,
        /* we're sending the stream now */
        o_stream_set_max_buffer_size(conn->output, 0);
        res = o_stream_send_istream(conn->output, stream->input);
-       o_stream_set_max_buffer_size(conn->output, (size_t)-1);
+       o_stream_set_max_buffer_size(conn->output, SIZE_MAX);
 
        switch (res) {
        case OSTREAM_SEND_ISTREAM_RESULT_FINISHED:
index e0e1f394c61cbad972765295f3f9a3ca4c0ad54d..637887ee91af3a38099739cd8919b161b526b797 100644 (file)
@@ -160,8 +160,8 @@ test_server_wait_connection(struct test_server *server, bool send_banner)
                i_debug("Client connected");
 
        fd_set_nonblock(server->fd, FALSE);
-       server->input = i_stream_create_fd(server->fd, (size_t)-1);
-       server->output = o_stream_create_fd(server->fd, (size_t)-1);
+       server->input = i_stream_create_fd(server->fd, SIZE_MAX);
+       server->output = o_stream_create_fd(server->fd, SIZE_MAX);
        o_stream_set_no_error_handling(server->output, TRUE);
 
        if (send_banner) {
index 96d8db210df092df3924e5e14ca39b76b3a64e25..9eed0b34cc40cc18d39360438ba54f2b227f4a5c 100644 (file)
@@ -148,7 +148,7 @@ imap_msgpart_get_header_fields(pool_t pool, const char *header_list,
        int result = 0;
 
        input = i_stream_create_from_data(header_list, strlen(header_list));
-       parser = imap_parser_create(input, NULL, (size_t)-1);
+       parser = imap_parser_create(input, NULL, SIZE_MAX);
 
        if (imap_parser_finish_line(parser, 0, 0, &args) > 0 &&
            imap_arg_get_list_full(args, &hdr_list, &list_count) &&
index 6bf00e806ff6733d8b5b5aea01f0a6e745c6b68d..5fce6f73a6a1d0abf39c6e71ff3485dbd514af96 100644 (file)
@@ -606,7 +606,7 @@ imap_urlauth_fetch_reply_set_literal_stream(struct imap_urlauth_connection *conn
 
        if (conn->literal_fd != -1) {
                reply->input = i_stream_create_fd_autoclose(&conn->literal_fd,
-                                                           (size_t)-1);
+                                                           SIZE_MAX);
                if (i_stream_get_size(reply->input, TRUE, &fd_size) < 1 ||
                    fd_size != conn->literal_size) {
                        i_stream_unref(&reply->input);
@@ -908,8 +908,8 @@ imap_urlauth_connection_do_connect(struct imap_urlauth_connection *conn)
        timeout_remove(&conn->to_reconnect);
 
        conn->fd = fd;
-       conn->input = i_stream_create_fd(fd, (size_t)-1);
-       conn->output = o_stream_create_fd(fd, (size_t)-1);
+       conn->input = i_stream_create_fd(fd, SIZE_MAX);
+       conn->output = o_stream_create_fd(fd, SIZE_MAX);
        conn->io = io_add(fd, IO_READ, imap_urlauth_input, conn);
        conn->state = IMAP_URLAUTH_STATE_AUTHENTICATING;
 
index f98b061b5a1dc0fb57905facdc4735da7c8d8339..4e379e56a9e75e8c4bdeba37fa921743eb828f7e 100644 (file)
@@ -633,7 +633,7 @@ int imap_bodystructure_parse_full(const char *bodystructure,
        input = i_stream_create_from_data(bodystructure, strlen(bodystructure));
        (void)i_stream_read(input);
 
-       parser = imap_parser_create(input, NULL, (size_t)-1);
+       parser = imap_parser_create(input, NULL, SIZE_MAX);
        ret = imap_parser_finish_line(parser, 0,
                                      IMAP_PARSE_FLAG_LITERAL_TYPE, &args);
        if (ret < 0) {
@@ -880,7 +880,7 @@ int imap_body_parse_from_bodystructure(const char *bodystructure,
        input = i_stream_create_from_data(bodystructure, strlen(bodystructure));
        (void)i_stream_read(input);
 
-       parser = imap_parser_create(input, NULL, (size_t)-1);
+       parser = imap_parser_create(input, NULL, SIZE_MAX);
        ret = imap_parser_finish_line(parser, 0, IMAP_PARSE_FLAG_NO_UNESCAPE |
                                      IMAP_PARSE_FLAG_LITERAL_TYPE, &args);
        if (ret < 0) {
index a356f4a410d3a59b26c48a510025ff218c33aa1e..d107d66665592df9e26da57645aea6a6a622bf84 100644 (file)
@@ -227,7 +227,7 @@ bool imap_envelope_parse(const char *envelope,
        input = i_stream_create_from_data(envelope, strlen(envelope));
        (void)i_stream_read(input);
 
-       parser = imap_parser_create(input, NULL, (size_t)-1);
+       parser = imap_parser_create(input, NULL, SIZE_MAX);
        ret = imap_parser_finish_line(parser, 0,
                                      IMAP_PARSE_FLAG_LITERAL_TYPE, &args);
        if (ret < 0) {
index 0e8e99e728d6b29ab69024365d48193c584629d4..f873c5780e5332b719d447e58c9a325cf6208892 100644 (file)
@@ -111,7 +111,7 @@ const char *imap_id_reply_generate(const char *settings)
        input = i_stream_create_from_data(settings, strlen(settings));
        (void)i_stream_read(input);
 
-       parser = imap_parser_create(input, NULL, (size_t)-1);
+       parser = imap_parser_create(input, NULL, SIZE_MAX);
        if (imap_parser_finish_line(parser, 0, 0, &args) <= 0)
                ret = "NIL";
        else
index ad9191cbed9d5e0d28b986d39ae9e47487d6cc6f..84c0da56000b30d8c60eeb3b327b2f873e4ab766 100644 (file)
@@ -489,7 +489,7 @@ static void
 mail_cache_transaction_drop_last_flush(struct mail_cache_transaction_ctx *ctx)
 {
        buffer_copy(ctx->cache_data, 0,
-                   ctx->cache_data, ctx->last_rec_pos, (size_t)-1);
+                   ctx->cache_data, ctx->last_rec_pos, SIZE_MAX);
        buffer_set_used_size(ctx->cache_data,
                             ctx->cache_data->used - ctx->last_rec_pos);
        ctx->last_rec_pos = 0;
index 9147eebc2c79f911b526cb7cb2847e23ad2670ee..1c3531959cc8dad970ff7aa3d1cdce4b1ddd0777 100644 (file)
@@ -247,7 +247,7 @@ mail_index_fsck_keywords(struct mail_index *index, struct mail_index_map *map,
 
                diff = dest->used - ext_hdr->hdr_size;
                buffer_copy(map->hdr_copy_buf, hdr_offset + diff,
-                           map->hdr_copy_buf, hdr_offset, (size_t)-1);
+                           map->hdr_copy_buf, hdr_offset, SIZE_MAX);
                map->hdr_base = map->hdr_copy_buf->data;
                hdr->header_size += diff;
                *offset_p += diff;
@@ -319,7 +319,7 @@ mail_index_fsck_extensions(struct mail_index *index, struct mail_index_map *map,
                /* drop the field */
                hdr->header_size -= next_offset - offset;
                buffer_copy(map->hdr_copy_buf, offset,
-                           map->hdr_copy_buf, next_offset, (size_t)-1);
+                           map->hdr_copy_buf, next_offset, SIZE_MAX);
                buffer_set_used_size(map->hdr_copy_buf, hdr->header_size);
                map->hdr_base = map->hdr_copy_buf->data;
        }
index d5cf97b8080efddda874662e4764bde58e190215..b1b3849838e56ba4d4db893348f9348c4a4732d9 100644 (file)
@@ -265,7 +265,7 @@ static int mail_index_strmap_open(struct mail_index_strmap_view *view)
                mail_index_strmap_set_syscall_error(strmap, "open()");
                return -1;
        }
-       strmap->input = i_stream_create_fd(strmap->fd, (size_t)-1);
+       strmap->input = i_stream_create_fd(strmap->fd, SIZE_MAX);
        ret = i_stream_read_bytes(strmap->input, &data, &size, sizeof(hdr));
        if (ret <= 0) {
                if (ret < 0) {
index 04b3d8c025a273d24c01fe7ad2fd1934251b2e2c..53cb6add131875db588943cab778b791c585d960 100644 (file)
@@ -999,7 +999,7 @@ void mail_index_update_header_ext(struct mail_index_transaction *t,
 
        hdr = array_idx_get_space(&t->ext_hdr_updates, ext_id);
        if (hdr->alloc_size < offset || hdr->alloc_size - offset < size) {
-               i_assert(size < (size_t)-1 - offset);
+               i_assert(size < SIZE_MAX - offset);
                new_size = nearest_power(offset + size);
                hdr->mask = i_realloc(hdr->mask, hdr->alloc_size, new_size);
                hdr->data = i_realloc(hdr->data, hdr->alloc_size, new_size);
index 2eddd374b154227f039158703358b33639a71ec7..26cf440ae261560f83305fa4aa4ad78ef4f80dd9 100644 (file)
@@ -54,7 +54,7 @@ log_buffer_move_to_memory(struct mail_transaction_log_append_ctx *ctx)
        i_assert(MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file));
 
        i_assert(file->buffer_offset + file->buffer->used == file->sync_offset);
-       buffer_append_buf(file->buffer, ctx->output, 0, (size_t)-1);
+       buffer_append_buf(file->buffer, ctx->output, 0, SIZE_MAX);
        file->sync_offset = file->buffer_offset + file->buffer->used;
        return 0;
 }
@@ -71,7 +71,7 @@ static int log_buffer_write(struct mail_transaction_log_append_ctx *ctx)
                        file->buffer = buffer_create_dynamic(default_pool, 4096);
                        file->buffer_offset = sizeof(file->hdr);
                }
-               buffer_append_buf(file->buffer, ctx->output, 0, (size_t)-1);
+               buffer_append_buf(file->buffer, ctx->output, 0, SIZE_MAX);
                file->sync_offset = file->buffer_offset + file->buffer->used;
                return 0;
        }
index 42c20b756652cdef321dbfb1d017d606c9aa692c..75bfe14d30a59c899d46b8ec5ea816ae246d248e 100644 (file)
@@ -1548,7 +1548,7 @@ mail_transaction_log_file_insert_read(struct mail_transaction_log_file *file,
        ssize_t ret;
 
        size = file->buffer_offset - offset;
-       buffer_copy(file->buffer, size, file->buffer, 0, (size_t)-1);
+       buffer_copy(file->buffer, size, file->buffer, 0, SIZE_MAX);
 
        data = buffer_get_space_unsafe(file->buffer, 0, size);
        ret = pread_full(file->fd, data, size, offset);
@@ -1559,7 +1559,7 @@ mail_transaction_log_file_insert_read(struct mail_transaction_log_file *file,
        }
 
        /* failure. don't leave ourself to inconsistent state */
-       buffer_copy(file->buffer, 0, file->buffer, size, (size_t)-1);
+       buffer_copy(file->buffer, 0, file->buffer, size, SIZE_MAX);
        buffer_set_used_size(file->buffer, file->buffer->used - size);
 
        if (ret == 0) {
index 5a1dadf701c742f330b313ff6780cedd28819519..da0d95d9c6ccf6e1e5faee8e1fcc9a8145429f17 100644 (file)
@@ -56,10 +56,10 @@ const struct setting_parser_info lda_setting_parser_info = {
        .defines = lda_setting_defines,
        .defaults = &lda_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct lda_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
 #ifndef CONFIG_BINARY
        .check_func = lda_settings_check,
index 479a4bb219c626585ab570f3203db0f1cf9aadd6..87bc769963166b6b59431beb1f61735799d617c1 100644 (file)
@@ -168,7 +168,7 @@ static ssize_t read_header(struct header_filter_istream *mstream)
 
        /* remove skipped data from hdr_buf */
        buffer_copy(mstream->hdr_buf, 0,
-                   mstream->hdr_buf, mstream->istream.skip, (size_t)-1);
+                   mstream->hdr_buf, mstream->istream.skip, SIZE_MAX);
 
         mstream->istream.pos -= mstream->istream.skip;
        mstream->istream.skip = 0;
index ae56f9e8d66b17d11ad363f5b862170f074e951f..768480338a7eadb5d47c849bd521d430e5d3fe05 100644 (file)
@@ -102,19 +102,19 @@ static void qp_decoder_invalid(struct qp_decoder *qp, const char **error_r)
                break;
        case STATE_EQUALS_WHITESPACE:
                buffer_append_c(qp->dest, '=');
-               buffer_append_buf(qp->dest, qp->whitespace, 0, (size_t)-1);
+               buffer_append_buf(qp->dest, qp->whitespace, 0, SIZE_MAX);
                buffer_set_used_size(qp->whitespace, 0);
                *error_r = "'=<whitespace>' not followed by newline";
                break;
        case STATE_CR:
-               buffer_append_buf(qp->dest, qp->whitespace, 0, (size_t)-1);
+               buffer_append_buf(qp->dest, qp->whitespace, 0, SIZE_MAX);
                buffer_set_used_size(qp->whitespace, 0);
                buffer_append_c(qp->dest, '\r');
                *error_r = "CR not followed by LF";
                break;
        case STATE_SOFTCR:
                buffer_append_c(qp->dest, '=');
-               buffer_append_buf(qp->dest, qp->whitespace, 0, (size_t)-1);
+               buffer_append_buf(qp->dest, qp->whitespace, 0, SIZE_MAX);
                buffer_set_used_size(qp->whitespace, 0);
                buffer_append_c(qp->dest, '\r');
                *error_r = "CR not followed by LF";
@@ -134,7 +134,7 @@ int qp_decoder_more(struct qp_decoder *qp, const unsigned char *src,
        const char *error;
        size_t i;
 
-       *invalid_src_pos_r = (size_t)-1;
+       *invalid_src_pos_r = SIZE_MAX;
        *error_r = NULL;
 
        for (i = 0; i < src_size; ) {
@@ -159,12 +159,12 @@ int qp_decoder_more(struct qp_decoder *qp, const unsigned char *src,
                                /* this wasn't trailing whitespace.
                                   put it back. */
                                buffer_append_buf(qp->dest, qp->whitespace,
-                                                 0, (size_t)-1);
+                                                 0, SIZE_MAX);
                                if (qp->whitespace->used > QP_MAX_WHITESPACE_LEN) {
                                        /* we already truncated some of the
                                           whitespace away, because the line
                                           is too long */
-                                       if (*invalid_src_pos_r == (size_t)-1) {
+                                       if (*invalid_src_pos_r == SIZE_MAX) {
                                                *invalid_src_pos_r = i;
                                                *error_r = "Too much whitespace";
                                        }
@@ -192,7 +192,7 @@ int qp_decoder_more(struct qp_decoder *qp, const unsigned char *src,
                        } else {
                                /* invalid input */
                                qp_decoder_invalid(qp, &error);
-                               if (*invalid_src_pos_r == (size_t)-1) {
+                               if (*invalid_src_pos_r == SIZE_MAX) {
                                        *invalid_src_pos_r = i;
                                        *error_r = error;
                                }
@@ -214,7 +214,7 @@ int qp_decoder_more(struct qp_decoder *qp, const unsigned char *src,
                        } else {
                                /* invalid input */
                                qp_decoder_invalid(qp, &error);
-                               if (*invalid_src_pos_r == (size_t)-1) {
+                               if (*invalid_src_pos_r == SIZE_MAX) {
                                        *invalid_src_pos_r = i;
                                        *error_r = error;
                                }
@@ -238,7 +238,7 @@ int qp_decoder_more(struct qp_decoder *qp, const unsigned char *src,
                                /* =<whitespace> not followed by [CR]LF
                                   is invalid. */
                                qp_decoder_invalid(qp, &error);
-                               if (*invalid_src_pos_r == (size_t)-1) {
+                               if (*invalid_src_pos_r == SIZE_MAX) {
                                        *invalid_src_pos_r = i;
                                        *error_r = error;
                                }
@@ -254,7 +254,7 @@ int qp_decoder_more(struct qp_decoder *qp, const unsigned char *src,
                                qp->state = STATE_TEXT;
                        } else {
                                qp_decoder_invalid(qp, &error);
-                               if (*invalid_src_pos_r == (size_t)-1) {
+                               if (*invalid_src_pos_r == SIZE_MAX) {
                                        *invalid_src_pos_r = i;
                                        *error_r = error;
                                }
@@ -264,8 +264,8 @@ int qp_decoder_more(struct qp_decoder *qp, const unsigned char *src,
                }
                i++;
        }
-       i_assert((*invalid_src_pos_r == (size_t)-1) == (*error_r == NULL));
-       return *invalid_src_pos_r == (size_t)-1 ? 0 : -1;
+       i_assert((*invalid_src_pos_r == SIZE_MAX) == (*error_r == NULL));
+       return *invalid_src_pos_r == SIZE_MAX ? 0 : -1;
 }
 
 int qp_decoder_finish(struct qp_decoder *qp, const char **error_r)
index ed4e07b5b279ce3379aa2535bad3cc2da8fb5954..b77f3641750e6362777c94909b880072e9535436 100644 (file)
@@ -98,7 +98,7 @@ static void test_istream_dot_one(const struct dot_test *test,
        test_assert(memcmp(str_data(str), test->output, output_len) == 0);
 
        /* read the data after the '.' line and verify it's still there */
-       i_stream_set_max_buffer_size(test_input, (size_t)-1);
+       i_stream_set_max_buffer_size(test_input, SIZE_MAX);
        (void)i_stream_read(test_input);
        data = i_stream_get_data(test_input, &size);
        test_assert(size == strlen(test->parent_input));
index 8e25736937be4d66dc295551a6128d7a5e5a7aa3..0cda77f763d107e510ca45f9e903588cb88cec4f 100644 (file)
@@ -148,7 +148,7 @@ int anvil_client_connect(struct anvil_client *client, bool retry)
 
        client->fd = fd;
        client->input = i_stream_create_fd(fd, ANVIL_INBUF_SIZE);
-       client->output = o_stream_create_fd(fd, (size_t)-1);
+       client->output = o_stream_create_fd(fd, SIZE_MAX);
        client->io = io_add(fd, IO_READ, anvil_input, client);
        if (o_stream_send_str(client->output, ANVIL_HANDSHAKE) < 0) {
                i_error("write(%s) failed: %s", client->path,
index 546a733446b7ca51a8e76f61d1774da48a29d62d..b734c1bbe48f423779f731991efc91944b83c41b 100644 (file)
@@ -106,8 +106,8 @@ static int ipc_client_connect(struct ipc_client *client)
        }
 
        client->io = io_add(client->fd, IO_READ, ipc_client_input, client);
-       client->input = i_stream_create_fd(client->fd, (size_t)-1);
-       client->output = o_stream_create_fd(client->fd, (size_t)-1);
+       client->input = i_stream_create_fd(client->fd, SIZE_MAX);
+       client->output = o_stream_create_fd(client->fd, SIZE_MAX);
        o_stream_set_no_error_handling(client->output, TRUE);
        return 0;
 }
index 749c77ea22e820089972c27bfdddd2dba4827fb0..8bd8c23c3b36e8f96f4d21b1c628def757b7d99f 100644 (file)
@@ -110,8 +110,8 @@ static void ipc_server_connect(struct ipc_server *server)
        }
 
        server->io = io_add(server->fd, IO_READ, ipc_server_input, server);
-       server->input = i_stream_create_fd(server->fd, (size_t)-1);
-       server->output = o_stream_create_fd(server->fd, (size_t)-1);
+       server->input = i_stream_create_fd(server->fd, SIZE_MAX);
+       server->output = o_stream_create_fd(server->fd, SIZE_MAX);
        o_stream_set_no_error_handling(server->output, TRUE);
        o_stream_nsend_str(server->output,
                t_strdup_printf(IPC_SERVER_HANDSHAKE, server->name, my_pid));
index 0dd06cd24edb0f88d917bc51282cd9c0f1e972de..86fb1c142468de1e3e4845ef6eb2dba2de370f0a 100644 (file)
@@ -115,7 +115,7 @@ static int master_instance_list_refresh(struct master_instance_list *list)
                i_error("open(%s) failed: %m", list->path);
                return -1;
        }
-       input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+       input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
        while ((line = i_stream_read_next_line(input)) != NULL) T_BEGIN {
                if (master_instance_list_add_line(list, line) < 0)
                        i_error("Invalid line in %s: %s", list->path, line);
index ad98f1c688259361cfdfcb09c63f313968a9268b..42de091980b35e701db40e19d8124d231fb9ee14 100644 (file)
@@ -90,7 +90,7 @@ static const struct connection_settings master_login_auth_set = {
        .minor_version = AUTH_MASTER_PROTOCOL_MINOR_VERSION,
        .unix_client_connect_msecs = 1000,
        .input_max_size = AUTH_MAX_INBUF_SIZE,
-       .output_max_size = (size_t)-1,
+       .output_max_size = SIZE_MAX,
        .client = TRUE,
 };
 
index dffda0c6491b1ddef56c3933bfe3331c443c6ae7..512db7cf3e042660f21dda4751c27ad621e03204 100644 (file)
@@ -511,7 +511,7 @@ void master_login_add(struct master_login *login, int fd)
        conn->create_time = ioloop_timeval;
        conn->fd = fd;
        conn->io = io_add(conn->fd, IO_READ, master_login_conn_input, conn);
-       conn->output = o_stream_create_fd(fd, (size_t)-1);
+       conn->output = o_stream_create_fd(fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->output, TRUE);
 
        DLLIST_PREPEND(&login->conns, conn);
index f353bf96bb2c50cbf4e07f43cf46c18e4bd94bdd..11dd66bb5a20597926ba3ee6baeb8cf8bace454a 100644 (file)
@@ -79,7 +79,7 @@ master_service_settings_cache_init(struct master_service *service,
        cache->service = service;
        cache->module = p_strdup(pool, module);
        cache->service_name = p_strdup(pool, service_name);
-       cache->max_cache_size = (size_t)-1;
+       cache->max_cache_size = SIZE_MAX;
        return cache;
 }
 
index 0ad8be023d8ba5cd355ea15eb9a0e6f7498823dd..34c49a10d63a8b1f0cf7eab472c114b84a46d8a6 100644 (file)
@@ -100,10 +100,10 @@ const struct setting_parser_info master_service_setting_parser_info = {
        .defines = master_service_setting_defines,
        .defaults = &master_service_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct master_service_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .check_func = master_service_settings_check
 };
 
@@ -493,7 +493,7 @@ int master_service_settings_get_filters(struct master_service *service,
                        retry = FALSE;
                }
                service->config_fd = fd;
-               struct istream *is = i_stream_create_fd(fd, (size_t)-1);
+               struct istream *is = i_stream_create_fd(fd, SIZE_MAX);
                const char *line;
                /* try read response */
                while((line = i_stream_read_next_line(is)) != NULL) {
@@ -581,7 +581,7 @@ int master_service_settings_read(struct master_service *service,
                        SETTINGS_PARSER_FLAG_IGNORE_UNKNOWN_KEYS);
 
        if (fd != -1) {
-               istream = i_stream_create_fd(fd, (size_t)-1);
+               istream = i_stream_create_fd(fd, SIZE_MAX);
                now = time(NULL);
                timeout = now + CONFIG_READ_TIMEOUT_SECS;
                do {
index bf007b8c1c0eabe8629af94da53142f4fface23d..0bdbcc0e5eea7749ee427b900b1f1d824d01dd33 100644 (file)
@@ -79,10 +79,10 @@ const struct setting_parser_info master_service_ssl_setting_parser_info = {
        .defines = master_service_ssl_setting_defines,
        .defaults = &master_service_ssl_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct master_service_ssl_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .check_func = master_service_ssl_settings_check
 };
 
index 9bba3b4a723e0e6ff08f852de257ae1cc814dcbe..8a43f86c5939365120c0b423fd9108c4e615dc27 100644 (file)
@@ -148,8 +148,8 @@ static const struct connection_settings stats_client_set = {
        .major_version = 3,
        .minor_version = 0,
 
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = TRUE
 };
 
index 35425762db1d7feb4b12075cdec9b7bd8307c5d3..ecf7dcd9630ad7905b148c14345e0786afad9d08 100644 (file)
@@ -64,8 +64,8 @@ static void stats_conn_input(struct connection *_conn);
 static bool compare_test_stats_to(const char *format, ...) ATTR_FORMAT(1, 2);
 
 static struct connection_settings stats_conn_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = FALSE
 };
 
@@ -177,7 +177,7 @@ static void stats_conn_input(struct connection *_conn)
                                        i_fatal("failed create stats data file %m");
                                }
 
-                               stats_data_out = o_stream_create_fd_autoclose(&fd, (size_t)-1);
+                               stats_data_out = o_stream_create_fd_autoclose(&fd, SIZE_MAX);
                                o_stream_nsend_str(stats_data_out, line);
                                o_stream_nsend_str(stats_data_out, "\n");
 
@@ -268,7 +268,7 @@ static bool compare_test_stats_to(const char *format, ...)
        /* Wait stats data to be recorded by stats process */
        wait_for_signal(stats_ready);
 
-       input = i_stream_create_file(stats_data_file, (size_t)-1);
+       input = i_stream_create_file(stats_data_file, SIZE_MAX);
        while (i_stream_read(input) > 0) ;
        if (input->stream_errno != 0) {
                i_fatal("stats data file read failed: %s",
index d57f748a005ba1c40840b220fee886ce4c02f2e6..c4899d8aa462a0f823149658a122107abbd76c93 100644 (file)
@@ -38,10 +38,10 @@ static const struct setting_parser_info test_setting_parser_info = {
        .defines = test_setting_defines,
        .defaults = &test_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct test_service_settings),
 
-       .parent_offset = (size_t)-1
+       .parent_offset = SIZE_MAX
 };
 
 int master_service_settings_read(struct master_service *service ATTR_UNUSED,
index 71f1f1399041bbfb0aa18fe1d88fb51376b1d154..105f69f0baf084e337de23a47f57862fe35dc7bf 100644 (file)
@@ -23,7 +23,7 @@
 #include <sys/types.h>
 
 #define base64url_encode_str(str, dest) \
-       base64url_encode(BASE64_ENCODE_FLAG_NO_PADDING, (size_t)-1, (str), \
+       base64url_encode(BASE64_ENCODE_FLAG_NO_PADDING, SIZE_MAX, (str), \
                         strlen((str)), (dest))
 
 /**
@@ -222,7 +222,7 @@ static void sign_jwt_token_hs256(buffer_t *tokenbuf, buffer_t *key)
        buffer_t *sig = t_hmac_buffer(&hash_method_sha256, key->data, key->used,
                                      tokenbuf);
        buffer_append(tokenbuf, ".", 1);
-       base64url_encode(BASE64_ENCODE_FLAG_NO_PADDING, (size_t)-1,
+       base64url_encode(BASE64_ENCODE_FLAG_NO_PADDING, SIZE_MAX,
                         sig->data, sig->used, tokenbuf);
 }
 
@@ -468,12 +468,12 @@ static void test_jwt_key_files(void)
        buffer_t *secret = t_buffer_create(32);
        void *ptr = buffer_append_space_unsafe(secret, 32);
        random_fill(ptr, 32);
-       buffer_t *b64_key = t_base64_encode(0, (size_t)-1, secret->data, secret->used);
+       buffer_t *b64_key = t_base64_encode(0, SIZE_MAX, secret->data, secret->used);
        save_key_to("HS256", "first", str_c(b64_key));
        buffer_t *secret2 = t_buffer_create(32);
        ptr = buffer_append_space_unsafe(secret2, 32);
        random_fill(ptr, 32);
-       b64_key = t_base64_encode(0, (size_t)-1, secret2->data, secret2->used);
+       b64_key = t_base64_encode(0, SIZE_MAX, secret2->data, secret2->used);
        save_key_to("HS256", "second", str_c(b64_key));
 
        /* create and sign token */
@@ -507,7 +507,7 @@ static void test_jwt_kid_escape(void)
         buffer_t *secret = t_buffer_create(32);
         void *ptr = buffer_append_space_unsafe(secret, 32);
         random_fill(ptr, 32);
-        buffer_t *b64_key = t_base64_encode(0, (size_t)-1, secret->data, secret->used);
+        buffer_t *b64_key = t_base64_encode(0, SIZE_MAX, secret->data, secret->used);
         save_key_to("HS256", "hello%2eworld%2f%25", str_c(b64_key));
        /* make a token */
        buffer_t *tokenbuf = create_jwt_token_kid("HS256", "hello.world/%");
@@ -542,7 +542,7 @@ static void test_jwt_rs_token(void)
        dcrypt_key_unref_private(&key);
        /* convert to base64 */
        buffer_append(tokenbuf, ".", 1);
-       base64url_encode(BASE64_ENCODE_FLAG_NO_PADDING, (size_t)-1,
+       base64url_encode(BASE64_ENCODE_FLAG_NO_PADDING, SIZE_MAX,
                         sig->data, sig->used, tokenbuf);
 
        test_jwt_token(str_c(tokenbuf));
@@ -575,7 +575,7 @@ static void test_jwt_ps_token(void)
        dcrypt_key_unref_private(&key);
        /* convert to base64 */
        buffer_append(tokenbuf, ".", 1);
-       base64url_encode(BASE64_ENCODE_FLAG_NO_PADDING, (size_t)-1,
+       base64url_encode(BASE64_ENCODE_FLAG_NO_PADDING, SIZE_MAX,
                         sig->data, sig->used, tokenbuf);
 
        test_jwt_token(str_c(tokenbuf));
@@ -618,7 +618,7 @@ static void test_jwt_ec_token(void)
        dcrypt_keypair_unref(&pair);
        /* convert to base64 */
        buffer_append(tokenbuf, ".", 1);
-       base64url_encode(BASE64_ENCODE_FLAG_NO_PADDING, (size_t)-1,
+       base64url_encode(BASE64_ENCODE_FLAG_NO_PADDING, SIZE_MAX,
                         sig->data, sig->used, tokenbuf);
        test_jwt_token(str_c(tokenbuf));
 
@@ -650,7 +650,7 @@ static void test_do_init(void)
        hs_sign_key =buffer_create_dynamic(default_pool, 32);
        void *ptr = buffer_append_space_unsafe(hs_sign_key, 32);
        random_fill(ptr, 32);
-       buffer_t *b64_key = t_base64_encode(0, (size_t)-1,
+       buffer_t *b64_key = t_base64_encode(0, SIZE_MAX,
                                            hs_sign_key->data, hs_sign_key->used);
        save_key("HS256", str_c(b64_key));
 }
index 289b31b683f126fae93e6ab6200e0d9adb84b0c1..07e391ffb5841fa5e7c5873bf99ee823d3b544cd 100644 (file)
@@ -584,7 +584,7 @@ void program_client_init_streams(struct program_client *pclient)
        if (pclient->fd_in >= 0) {
                struct istream *program_input;
 
-               program_input = i_stream_create_fd(pclient->fd_in, (size_t)-1);
+               program_input = i_stream_create_fd(pclient->fd_in, SIZE_MAX);
                i_stream_set_name(program_input, "program stdout");
                pclient->raw_program_input = program_input;
        }
@@ -598,7 +598,7 @@ void program_client_init_streams(struct program_client *pclient)
                for(i = 0; i < count; i++) {
                        i_assert(efds[i].parent_fd >= 0);
                        efds[i].input = i_stream_create_fd
-                               (efds[i].parent_fd, (size_t)-1);
+                               (efds[i].parent_fd, SIZE_MAX);
                        i_stream_set_name(efds[i].input,
                                t_strdup_printf("program output fd=%d",
                                                efds[i].child_fd));
index 2bc09ae8f7a580f949db68579068a2f1265e0b61..4ec40840f437acec72dfb22af67b56a6d389df90 100644 (file)
@@ -146,7 +146,7 @@ test_program_input_handle(struct test_client *client, const char *line)
                        break;
                case OSTREAM_SEND_ISTREAM_RESULT_FINISHED:
                        client->body =
-                               iostream_temp_finish(&client->os_body, -1);
+                               iostream_temp_finish(&client->os_body, SIZE_MAX);
                        i_stream_unref(&client->is_body);
                        client->state = CLIENT_STATE_FINISH;
                        return 0;
@@ -252,8 +252,8 @@ static void test_program_connected(struct test_server *server)
        client = p_new(pool, struct test_client, 1);
        client->pool = pool;
        client->fd = fd;
-       client->in = i_stream_create_fd(fd, -1);
-       client->out = o_stream_create_fd(fd, -1);
+       client->in = i_stream_create_fd(fd, SIZE_MAX);
+       client->out = o_stream_create_fd(fd, SIZE_MAX);
        client->io = io_add_istream(client->in, test_program_input, client);
        p_array_init(&client->args, client->pool, 2);
        server->client = client;
index 31cf5689cb904b2858cd504d50e96b12e70324da..868ea6efc5bbc98306403b2d59b82b0043a11b81 100644 (file)
@@ -126,7 +126,7 @@ test_program_input_handle(struct test_client *client, const char *line)
                        break;
                case OSTREAM_SEND_ISTREAM_RESULT_FINISHED:
                        client->body =
-                               iostream_temp_finish(&client->os_body, -1);
+                               iostream_temp_finish(&client->os_body, SIZE_MAX);
                        return 1;
                case OSTREAM_SEND_ISTREAM_RESULT_WAIT_OUTPUT:
                        i_panic("Cannot write to ostream-temp");
@@ -214,8 +214,8 @@ static void test_program_connected(struct test_server *server)
        client = p_new(pool, struct test_client, 1);
        client->pool = pool;
        client->fd = fd;
-       client->in = i_stream_create_fd(fd, -1);
-       client->out = o_stream_create_fd(fd, -1);
+       client->in = i_stream_create_fd(fd, SIZE_MAX);
+       client->out = o_stream_create_fd(fd, SIZE_MAX);
        client->io = io_add_istream(client->in, test_program_input, client);
        p_array_init(&client->args, client->pool, 2);
        server->client = client;
index 5131b10dc3dcd390ebe397838a50d26f2af5fc40..6c2b5ffb4b9be6c08a53a65b1e3db6c6716d924e 100644 (file)
@@ -59,10 +59,10 @@ static const struct setting_parser_info strlist_info = {
        .defines = NULL,
        .defaults = NULL,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = 0,
 
-       .parent_offset = (size_t)-1
+       .parent_offset = SIZE_MAX
 };
 
 HASH_TABLE_DEFINE_TYPE(setting_link, struct setting_link *,
@@ -534,7 +534,7 @@ setting_link_init_set_struct(struct setting_parser_context *ctx,
        setting_parser_copy_defaults(ctx, link->info, link);
        array_push_back(link->array, &link->set_struct);
 
-       if (link->info->parent_offset != (size_t)-1 && link->parent != NULL) {
+       if (link->info->parent_offset != SIZE_MAX && link->parent != NULL) {
                ptr = STRUCT_MEMBER_P(link->set_struct,
                                      link->info->parent_offset);
                *((void **)ptr) = link->parent->set_struct;
@@ -1151,7 +1151,7 @@ int settings_parse_exec(struct setting_parser_context *ctx,
        }
        i_close_fd(&fd[1]);
 
-       input = i_stream_create_fd_autoclose(&fd[0], (size_t)-1);
+       input = i_stream_create_fd_autoclose(&fd[0], SIZE_MAX);
        i_stream_set_name(input, bin_path);
        ret = settings_parse_stream_read(ctx, input);
        i_stream_destroy(&input);
@@ -1483,7 +1483,7 @@ static void settings_set_parent(const struct setting_parser_info *info,
 {
        void **ptr;
 
-       if (info->parent_offset == (size_t)-1)
+       if (info->parent_offset == SIZE_MAX)
                return;
 
        ptr = PTR_OFFSET(child, info->parent_offset);
@@ -2055,7 +2055,7 @@ settings_copy_deflist_unique(const struct setting_define *def,
        unsigned int i, j, src_count, dest_count, ccount;
        unsigned int type_offset;
 
-       i_assert(def->list_info->type_offset != (size_t)-1);
+       i_assert(def->list_info->type_offset != SIZE_MAX);
 
        src_arr = CONST_PTR_OFFSET(src_link->set_struct, def->offset);
        src_carr = CONST_PTR_OFFSET(src_link->change_struct, def->offset);
index 731d2a9606fec772b0ad4863d3819658fb57a5de..134c765040f1c6cdd59f87fc915feedbcef84f13 100644 (file)
@@ -119,7 +119,7 @@ static int settings_add_include(const char *path, struct input_stack **inputp,
        new_input = t_new(struct input_stack, 1);
        new_input->prev = *inputp;
        new_input->path = t_strdup(path);
-       new_input->input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+       new_input->input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
        i_stream_set_return_partial_line(new_input->input, TRUE);
        *inputp = new_input;
        return 0;
@@ -201,7 +201,7 @@ bool settings_read_i(const char *path, const char *section,
 
        full_line = t_str_new(512);
        sections = 0; root_section = 0; errormsg = NULL;
-       input->input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+       input->input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
        i_stream_set_return_partial_line(input->input, TRUE);
 prevfile:
        while ((line = i_stream_read_next_line(input->input)) != NULL) {
index 33dedce228d09186aa5b3da37f90b39fd32a5fdc..326e1783627c9d8a669d27ab60c21ceaeab50cd8 100644 (file)
@@ -563,7 +563,7 @@ static int smtp_client_command_send_stream(struct smtp_client_command *cmd)
        /* we're sending the stream now */
        o_stream_set_max_buffer_size(output, IO_BLOCK_SIZE);
        res = o_stream_send_istream(output, stream);
-       o_stream_set_max_buffer_size(output, (size_t)-1);
+       o_stream_set_max_buffer_size(output, SIZE_MAX);
 
        switch (res) {
        case OSTREAM_SEND_ISTREAM_RESULT_FINISHED:
index 7ac106d2ec4da0d61f4235d4509d6809e26e09e8..efbc3dfd758d80a15a48f7f19cbbd2c019b3549c 100644 (file)
@@ -1816,8 +1816,8 @@ void smtp_client_connection_connect(
 }
 
 static const struct connection_settings smtp_client_connection_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = TRUE,
        .delayed_unix_client_connected_callback = TRUE,
        .log_connection_id = TRUE,
index eb68d2f892d3f5f41ad91b5cd8a8d2bbf28abfe1..4b030c71c523572abcfb25627a1144cd93115947 100644 (file)
@@ -11,7 +11,7 @@ struct smtp_client_request;
 
 #define SMTP_DEFAULT_CONNECT_TIMEOUT_MSECS (1000*30)
 #define SMTP_DEFAULT_COMMAND_TIMEOUT_MSECS (1000*60*5)
-#define SMTP_DEFAULT_MAX_REPLY_SIZE ((size_t)-1)
+#define SMTP_DEFAULT_MAX_REPLY_SIZE (SIZE_MAX)
 #define SMTP_DEFAULT_MAX_DATA_CHUNK_SIZE NET_BLOCK_SIZE
 #define SMTP_DEFAULT_MAX_DATA_CHUNK_PIPELINE 4
 
index 025561f47dee792168093a302dbdd54b83479a60..34dc27dbd9aa3b6f6073c0a4e6ae54d25b1443ed 100644 (file)
@@ -162,7 +162,7 @@ smtp_reply_parser_init(struct istream *input, size_t max_reply_size)
 
        parser = i_new(struct smtp_reply_parser, 1);
        parser->max_reply_size =
-               (max_reply_size > 0 ? max_reply_size : (size_t)-1);
+               (max_reply_size > 0 ? max_reply_size : SIZE_MAX);
        parser->input = input;
        i_stream_ref(input);
        parser->strbuf = str_new(default_pool, 128);
index 31bf47b141a8981a49908293e9e625bbe797fd32..6390501bfebbc67948bb2332f3ec48f611d06bee 100644 (file)
@@ -770,8 +770,8 @@ void smtp_server_connection_trigger_output(struct smtp_server_connection *conn)
  */
 
 static struct connection_settings smtp_server_connection_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = FALSE,
        .log_connection_id = TRUE,
 };
index 0bda39482ba3b46383a966972011f313831aef6e..3e55d12e43060f36a6ac6e0da7f3748e049c83c6 100644 (file)
@@ -45,10 +45,10 @@ const struct setting_parser_info smtp_submit_setting_parser_info = {
        .defines = smtp_submit_setting_defines,
        .defaults = &smtp_submit_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct smtp_submit_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
 #ifndef CONFIG_BINARY
        .check_func = smtp_submit_settings_check,
index a9905e84889b296926cb3df47f551301457b87fe..26391a9b42b643fd6a2876d2c17059377db8a07b 100644 (file)
@@ -4004,8 +4004,8 @@ static void server_connection_accept(void *context ATTR_UNUSED)
 /* */
 
 static struct connection_settings server_connection_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = FALSE,
 };
 
index c2fb2983b3ef48c9bc9c94b28b460ed6c0fe97b2..f592a4a5c9aead7496a42e50d8b36a1790c12937 100644 (file)
@@ -612,7 +612,7 @@ test_many_bad_commands_client_connected(struct client_connection *conn)
        struct _many_bad_commands_client *ctx;
 
        ctx = p_new(conn->pool, struct _many_bad_commands_client, 1);
-       ctx->parser = smtp_reply_parser_init(conn->conn.input, (size_t)-1);
+       ctx->parser = smtp_reply_parser_init(conn->conn.input, SIZE_MAX);
        conn->context = ctx;
 
        switch (client_index) {
@@ -1121,7 +1121,7 @@ static void test_bad_mail_client_connected(struct client_connection *conn)
        struct _bad_mail_client *ctx;
 
        ctx = p_new(conn->pool, struct _bad_mail_client, 1);
-       ctx->parser = smtp_reply_parser_init(conn->conn.input, (size_t)-1);
+       ctx->parser = smtp_reply_parser_init(conn->conn.input, SIZE_MAX);
        conn->context = ctx;
 
        switch (client_index) {
@@ -1308,7 +1308,7 @@ static void test_bad_rcpt_client_connected(struct client_connection *conn)
        struct _bad_rcpt_client *ctx;
 
        ctx = p_new(conn->pool, struct _bad_rcpt_client, 1);
-       ctx->parser = smtp_reply_parser_init(conn->conn.input, (size_t)-1);
+       ctx->parser = smtp_reply_parser_init(conn->conn.input, SIZE_MAX);
        conn->context = ctx;
 
        switch (client_index) {
@@ -1489,7 +1489,7 @@ test_bad_vrfy_client_connected(struct client_connection *conn)
        struct _bad_vrfy_client *ctx;
 
        ctx = p_new(conn->pool, struct _bad_vrfy_client, 1);
-       ctx->parser = smtp_reply_parser_init(conn->conn.input, (size_t)-1);
+       ctx->parser = smtp_reply_parser_init(conn->conn.input, SIZE_MAX);
        conn->context = ctx;
 
        switch (client_index) {
@@ -1644,7 +1644,7 @@ test_bad_noop_client_connected(struct client_connection *conn)
        struct _bad_noop_client *ctx;
 
        ctx = p_new(conn->pool, struct _bad_noop_client, 1);
-       ctx->parser = smtp_reply_parser_init(conn->conn.input, (size_t)-1);
+       ctx->parser = smtp_reply_parser_init(conn->conn.input, SIZE_MAX);
        conn->context = ctx;
 
        switch (client_index) {
@@ -1799,7 +1799,7 @@ test_mail_workarounds_client_connected(struct client_connection *conn)
        struct _mail_workarounds_client *ctx;
 
        ctx = p_new(conn->pool, struct _mail_workarounds_client, 1);
-       ctx->parser = smtp_reply_parser_init(conn->conn.input, (size_t)-1);
+       ctx->parser = smtp_reply_parser_init(conn->conn.input, SIZE_MAX);
        conn->context = ctx;
 
        switch (client_index) {
@@ -2002,7 +2002,7 @@ test_rcpt_workarounds_client_connected(struct client_connection *conn)
        struct _rcpt_workarounds_client *ctx;
 
        ctx = p_new(conn->pool, struct _rcpt_workarounds_client, 1);
-       ctx->parser = smtp_reply_parser_init(conn->conn.input, (size_t)-1);
+       ctx->parser = smtp_reply_parser_init(conn->conn.input, SIZE_MAX);
        conn->context = ctx;
 
        switch (client_index) {
@@ -2558,7 +2558,7 @@ test_mail_broken_path_client_connected(struct client_connection *conn)
        struct _mail_broken_path_client *ctx;
 
        ctx = p_new(conn->pool, struct _mail_broken_path_client, 1);
-       ctx->parser = smtp_reply_parser_init(conn->conn.input, (size_t)-1);
+       ctx->parser = smtp_reply_parser_init(conn->conn.input, SIZE_MAX);
        conn->context = ctx;
 
        switch (client_index) {
@@ -2820,8 +2820,8 @@ static void client_connection_destroy(struct connection *_conn)
 /* */
 
 static struct connection_settings client_connection_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = TRUE
 };
 
index b28d25e199c3764a79fe42dbc4ad90c4e00012bf..f82dc4dcf817f9c4f4284b00b0545982ad2906fc 100644 (file)
@@ -1947,8 +1947,8 @@ static void server_connection_accept(void *context ATTR_UNUSED)
 /* */
 
 static struct connection_settings server_connection_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = FALSE
 };
 
@@ -2034,7 +2034,7 @@ static void test_message_delivery(const char *message, const char *file)
 
        msize = strlen(message);
 
-       input = i_stream_create_file(file, (size_t)-1);
+       input = i_stream_create_file(file, SIZE_MAX);
        while ((ret = i_stream_read_more(input, &data, &size)) > 0) {
                const unsigned char *mdata;
 
index 43b2888ed204d83c7222c084f0b7d04ea9233444..0609f2aef8663c24771cfc2f00f0876a2065f218 100644 (file)
@@ -505,7 +505,7 @@ sql_result_build_map(struct sql_result *result,
                        }
                        i_assert(def->offset + field_size <= dest_size);
                } else {
-                       result->map[i].offset = (size_t)-1;
+                       result->map[i].offset = SIZE_MAX;
                }
        }
 }
@@ -529,7 +529,7 @@ static void sql_result_fetch(struct sql_result *result)
        memset(result->fetch_dest, 0, result->fetch_dest_size);
        count = result->map_size;
        for (i = 0; i < count; i++) {
-               if (result->map[i].offset == (size_t)-1)
+               if (result->map[i].offset == SIZE_MAX)
                        continue;
 
                value = sql_result_get_field_value(result, i);
index d23efd0a99fc5c6e63a5a65db629ef42d428aeb0..32ad701e102247a269d72a9ac1a47fc81e4e3073 100644 (file)
@@ -84,7 +84,7 @@ static ssize_t i_stream_ssl_read_real(struct istream_private *stream)
        /* now make sure that we read everything already buffered in OpenSSL
           into the stream (without reading anything more). this makes I/O loop
           behave similarly for ssl-istream as file-istream. */
-       stream->max_buffer_size = (size_t)-1;
+       stream->max_buffer_size = SIZE_MAX;
        while ((ret = SSL_read(ssl_io->ssl, buffer, sizeof(buffer))) > 0) {
                memcpy(i_stream_alloc(stream, ret), buffer, ret);
                stream->pos += ret;
index 410b070bc38879f238ec9a824fc82a45215702c2..883c7e95d6cb194f65109c1a93ea6039bfe15a85 100644 (file)
@@ -419,7 +419,7 @@ dbox_file_seek_next_at_metadata(struct dbox_file *file, uoff_t *offset)
 
        /* skip over the actual metadata */
        buf_size = i_stream_get_max_buffer_size(file->input);
-       i_stream_set_max_buffer_size(file->input, (size_t)-1);
+       i_stream_set_max_buffer_size(file->input, SIZE_MAX);
        while ((line = i_stream_read_next_line(file->input)) != NULL) {
                if (*line == DBOX_METADATA_OLDV1_SPACE || *line == '\0') {
                        /* end of metadata */
@@ -689,7 +689,7 @@ dbox_file_metadata_read_at(struct dbox_file *file, uoff_t metadata_offset)
        ret = 0;
        buf_size = i_stream_get_max_buffer_size(file->input);
        /* use unlimited line length for metadata */
-       i_stream_set_max_buffer_size(file->input, (size_t)-1);
+       i_stream_set_max_buffer_size(file->input, SIZE_MAX);
        while ((line = i_stream_read_next_line(file->input)) != NULL) {
                if (*line == DBOX_METADATA_OLDV1_SPACE || *line == '\0') {
                        /* end of metadata */
index 00536b5c7b1a890835080470cdb414a5803d7479..8461074fb13d73a532c0c0565b77c9ae9194c282 100644 (file)
@@ -107,7 +107,7 @@ mdbox_file_metadata_copy(struct dbox_file *file, struct ostream *output)
        o_stream_nsend(output, &meta_hdr, sizeof(meta_hdr));
        buf_size = i_stream_get_max_buffer_size(file->input);
        /* use unlimited line length for metadata */
-       i_stream_set_max_buffer_size(file->input, (size_t)-1);
+       i_stream_set_max_buffer_size(file->input, SIZE_MAX);
        while ((line = i_stream_read_next_line(file->input)) != NULL) {
                if (*line == '\0') {
                        /* end of metadata */
@@ -141,7 +141,7 @@ mdbox_metadata_get_extrefs(struct dbox_file *file, pool_t ext_refs_pool,
 
        buf_size = i_stream_get_max_buffer_size(file->input);
        /* use unlimited line length for metadata */
-       i_stream_set_max_buffer_size(file->input, (size_t)-1);
+       i_stream_set_max_buffer_size(file->input, SIZE_MAX);
        while ((line = i_stream_read_next_line(file->input)) != NULL) {
                if (*line == '\0') {
                        /* end of metadata */
index a98e55b459b71b28d118059a2b0b8c76251fd16a..19786ce303148071433012e003221ba166e43eb9 100644 (file)
@@ -30,10 +30,10 @@ static const struct setting_parser_info mdbox_setting_parser_info = {
        .defines = mdbox_setting_defines,
        .defaults = &mdbox_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct mdbox_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .parent = &mail_user_setting_parser_info
 };
 
index c62d03c4a2d03327c1e019048bea3fdf9607f8cc..ee99625fc3d68c80358b06550e2a0336e5905ebd 100644 (file)
@@ -68,10 +68,10 @@ static const struct setting_parser_info imapc_setting_parser_info = {
        .defines = imapc_setting_defines,
        .defaults = &imapc_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct imapc_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .parent = &mail_user_setting_parser_info,
 
        .check_func = imapc_settings_check
index 7b1e8009d586bebf563015a749d9946f490e9ee4..948aba37f71a5488e801240488c5cadf78454f26 100644 (file)
@@ -32,10 +32,10 @@ static const struct setting_parser_info maildir_setting_parser_info = {
        .defines = maildir_setting_defines,
        .defaults = &maildir_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct maildir_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .parent = &mail_user_setting_parser_info
 };
 
index 800bcf4a4d29a217d0c4e68441a3e050c7bb5df6..d4fb2ba7249eb704e9c97b3d2d8d8183e85e06e7 100644 (file)
@@ -760,7 +760,7 @@ maildir_uidlist_update_read(struct maildir_uidlist *uidlist,
                                                            st.st_size/8));
        }
 
-       input = i_stream_create_fd(fd, (size_t)-1);
+       input = i_stream_create_fd(fd, SIZE_MAX);
        i_stream_seek(input, last_read_offset);
 
        orig_uid_validity = uidlist->uid_validity;
index 8771a8959900748bb913d5214f08863985b8edf4..eaf639141440d84321e6b2a4a38a2e27fe99fe77 100644 (file)
@@ -276,7 +276,7 @@ static ssize_t i_stream_raw_mbox_read(struct istream_private *stream)
 
        /* See if we have From-line here - note that it works right only
           because all characters are different in mbox_from. */
-        fromp = mbox_from; from_start_pos = from_after_pos = (size_t)-1;
+        fromp = mbox_from; from_start_pos = from_after_pos = SIZE_MAX;
        eoh_char = rstream->body_offset == (uoff_t)-1 ? '\n' : -1;
        for (i = stream->pos; i < pos; i++) {
                if (buf[i] == eoh_char &&
@@ -312,7 +312,7 @@ static ssize_t i_stream_raw_mbox_read(struct istream_private *stream)
                                        }
                                }
                                fromp = mbox_from;
-                       } else if (from_after_pos != (size_t)-1) {
+                       } else if (from_after_pos != SIZE_MAX) {
                                /* we have the whole From-line here now.
                                   See if it's a valid one. */
                        mbox_verify:
@@ -332,7 +332,7 @@ static ssize_t i_stream_raw_mbox_read(struct istream_private *stream)
                                                           from_start_pos);
                                        break;
                                }
-                               from_after_pos = (size_t)-1;
+                               from_after_pos = SIZE_MAX;
                        }
                } else {
                        fromp = mbox_from;
@@ -344,7 +344,7 @@ static ssize_t i_stream_raw_mbox_read(struct istream_private *stream)
        /* we want to go at least one byte further next time */
        rstream->input_peak_offset = stream->istream.v_offset + i;
 
-       if (from_after_pos != (size_t)-1) {
+       if (from_after_pos != SIZE_MAX) {
                /* we're waiting for the \n at the end of From-line */
                new_pos = from_start_pos;
        } else {
index 53aaf8d0e749c627145e19d366d3fda28a17407c..ea051ec6f4acb5bff13704911ea9e0bb009384ab 100644 (file)
@@ -42,10 +42,10 @@ static const struct setting_parser_info mbox_setting_parser_info = {
        .defines = mbox_setting_defines,
        .defaults = &mbox_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct mbox_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .parent = &mail_user_setting_parser_info
 };
 
index 99bf7e66be7a0c5714d51b51c6853057b7e33049..51bbb6da6fab67052b6da950a1200aad59c88444 100644 (file)
@@ -466,11 +466,11 @@ int mbox_sync_parse_next_mail(struct istream *input,
        ctx->hdr_offset = ctx->mail.offset;
        ctx->mail.flags = MAIL_RECENT; /* default to having recent flag */
 
-        ctx->header_first_change = (size_t)-1;
+        ctx->header_first_change = SIZE_MAX;
        ctx->header_last_change = 0;
 
        for (i = 0; i < MBOX_HDR_COUNT; i++)
-               ctx->hdr_pos[i] = (size_t)-1;
+               ctx->hdr_pos[i] = SIZE_MAX;
 
        ctx->content_length = (uoff_t)-1;
        str_truncate(ctx->header, 0);
@@ -505,7 +505,7 @@ int mbox_sync_parse_next_mail(struct istream *input,
                                /* this header is broken, remove it */
                                ctx->need_rewrite = TRUE;
                                str_truncate(ctx->header, line_start_pos);
-                               if (ctx->header_first_change == (size_t)-1) {
+                               if (ctx->header_first_change == SIZE_MAX) {
                                        ctx->header_first_change =
                                                line_start_pos;
                                }
index d6c16e2825189b87a5f6243296addb18fc85b74c..c7f19c5a1eb0735cbab914d780e97bfed6efe11f 100644 (file)
@@ -109,7 +109,7 @@ void mbox_sync_headers_add_space(struct mbox_sync_mail_context *ctx,
        } else {
                /* Append at the end of X-Keywords header,
                   or X-UID if it doesn't exist */
-               start_pos = ctx->hdr_pos[MBOX_HDR_X_KEYWORDS] != (size_t)-1 ?
+               start_pos = ctx->hdr_pos[MBOX_HDR_X_KEYWORDS] != SIZE_MAX ?
                        ctx->hdr_pos[MBOX_HDR_X_KEYWORDS] :
                        ctx->hdr_pos[MBOX_HDR_X_UID];
        }
@@ -138,7 +138,7 @@ void mbox_sync_headers_add_space(struct mbox_sync_mail_context *ctx,
 
        if (ctx->header_first_change > pos)
                ctx->header_first_change = pos;
-       ctx->header_last_change = (size_t)-1;
+       ctx->header_last_change = SIZE_MAX;
 
        ctx->mail.space = (pos - start_pos) + size;
        ctx->mail.offset = ctx->hdr_offset;
@@ -175,7 +175,7 @@ static void mbox_sync_header_remove_space(struct mbox_sync_mail_context *ctx,
        /* and remove what we can */
        if (ctx->header_first_change > start_pos)
                ctx->header_first_change = start_pos;
-       ctx->header_last_change = (size_t)-1;
+       ctx->header_last_change = SIZE_MAX;
 
        if (data_size - start_pos <= *size) {
                /* remove it all */
@@ -220,7 +220,7 @@ static void mbox_sync_headers_remove_space(struct mbox_sync_mail_context *ctx,
 
        for (i = 0; i < 3 && size > 0; i++) {
                pos = space_positions[i];
-               if (ctx->hdr_pos[pos] != (size_t)-1) {
+               if (ctx->hdr_pos[pos] != SIZE_MAX) {
                        mbox_sync_header_remove_space(ctx, ctx->hdr_pos[pos],
                                                      &size);
                }
@@ -235,7 +235,7 @@ static void mbox_sync_first_mail_written(struct mbox_sync_mail_context *ctx,
        /* we wrote the first mail. update last-uid offset so we can find
           it later */
        i_assert(ctx->last_uid_value_start_pos != 0);
-       i_assert(ctx->hdr_pos[MBOX_HDR_X_IMAPBASE] != (size_t)-1);
+       i_assert(ctx->hdr_pos[MBOX_HDR_X_IMAPBASE] != SIZE_MAX);
 
        ctx->sync_ctx->base_uid_last_offset = hdr_offset +
                ctx->hdr_pos[MBOX_HDR_X_IMAPBASE] +
@@ -290,7 +290,7 @@ int mbox_sync_try_rewrite(struct mbox_sync_mail_context *ctx, off_t move_diff)
 
        i_assert(ctx->mail.space >= 0);
 
-       if (ctx->header_first_change == (size_t)-1 && move_diff == 0) {
+       if (ctx->header_first_change == SIZE_MAX && move_diff == 0) {
                /* no changes actually. we get here if index sync record told
                   us to do something that was already there */
                return 1;
@@ -302,7 +302,7 @@ int mbox_sync_try_rewrite(struct mbox_sync_mail_context *ctx, off_t move_diff)
                ctx->header_last_change = 0;
        }
 
-       if (ctx->header_last_change != (size_t)-1 &&
+       if (ctx->header_last_change != SIZE_MAX &&
            ctx->header_last_change != 0)
                str_truncate(ctx->header, ctx->header_last_change);
 
@@ -385,7 +385,7 @@ static int mbox_sync_read_next(struct mbox_sync_context *sync_ctx,
        if (mails[idx].space != 0) {
                if (mails[idx].space < 0) {
                        /* remove all possible spacing before updating */
-                       mbox_sync_headers_remove_space(mail_ctx, (size_t)-1);
+                       mbox_sync_headers_remove_space(mail_ctx, SIZE_MAX);
                }
                mbox_sync_update_header_from(mail_ctx, &mails[idx]);
        } else {
index f7d151dd3fdfbc30d150b4f828bbde529b4e1549..36e7e1e5b102067d92e8ef7ea9d33c6c3d9f0e0b 100644 (file)
@@ -36,17 +36,17 @@ void mbox_sync_move_buffer(struct mbox_sync_mail_context *ctx,
 
        if (diff == 0) {
                if (ctx->header_last_change < pos + have ||
-                   ctx->header_last_change == (size_t)-1)
+                   ctx->header_last_change == SIZE_MAX)
                        ctx->header_last_change = pos + have;
        } else {
                /* FIXME: if (diff < ctx->space && pos < ctx->offset) then
                   move the data only up to space offset and give/take the
                   space from there. update header_last_change accordingly.
                   (except pos and offset can't be compared directly) */
-               ctx->header_last_change = (size_t)-1;
+               ctx->header_last_change = SIZE_MAX;
                for (i = 0; i < MBOX_HDR_COUNT; i++) {
                        if (ctx->hdr_pos[i] > pos &&
-                           ctx->hdr_pos[i] != (size_t)-1)
+                           ctx->hdr_pos[i] != SIZE_MAX)
                                ctx->hdr_pos[i] += diff;
                }
 
@@ -63,9 +63,9 @@ void mbox_sync_move_buffer(struct mbox_sync_mail_context *ctx,
                if (diff < 0)
                        str_delete(ctx->header, pos, -diff);
                else {
-                       ctx->header_last_change = (size_t)-1;
+                       ctx->header_last_change = SIZE_MAX;
                        buffer_copy(ctx->header, pos + diff,
-                                   ctx->header, pos, (size_t)-1);
+                                   ctx->header, pos, SIZE_MAX);
                }
        }
 }
@@ -197,7 +197,7 @@ static void mbox_sync_add_missing_headers(struct mbox_sync_mail_context *ctx)
        }
 
        if (ctx->sync_ctx->dest_first_mail &&
-           ctx->hdr_pos[MBOX_HDR_X_IMAPBASE] == (size_t)-1) {
+           ctx->hdr_pos[MBOX_HDR_X_IMAPBASE] == SIZE_MAX) {
                i_assert(ctx->sync_ctx->base_uid_validity != 0);
 
                str_append(ctx->header, "X-IMAPbase: ");
@@ -218,7 +218,7 @@ static void mbox_sync_add_missing_headers(struct mbox_sync_mail_context *ctx)
                str_append_c(ctx->header, '\n');
        }
 
-       if (ctx->hdr_pos[MBOX_HDR_X_UID] == (size_t)-1 && !ctx->mail.pseudo) {
+       if (ctx->hdr_pos[MBOX_HDR_X_UID] == SIZE_MAX && !ctx->mail.pseudo) {
                str_append(ctx->header, "X-UID: ");
                ctx->hdr_pos[MBOX_HDR_X_UID] = str_len(ctx->header);
                str_printfa(ctx->header, "%u\n", ctx->mail.uid);
@@ -226,7 +226,7 @@ static void mbox_sync_add_missing_headers(struct mbox_sync_mail_context *ctx)
 
        ctx->mail.flags ^= MBOX_NONRECENT_KLUDGE;
 
-       if (ctx->hdr_pos[MBOX_HDR_STATUS] == (size_t)-1 &&
+       if (ctx->hdr_pos[MBOX_HDR_STATUS] == SIZE_MAX &&
            (ctx->mail.flags & STATUS_FLAGS_MASK) != 0) {
                str_append(ctx->header, "Status: ");
                ctx->hdr_pos[MBOX_HDR_STATUS] = str_len(ctx->header);
@@ -234,7 +234,7 @@ static void mbox_sync_add_missing_headers(struct mbox_sync_mail_context *ctx)
                str_append_c(ctx->header, '\n');
        }
 
-       if (ctx->hdr_pos[MBOX_HDR_X_STATUS] == (size_t)-1 &&
+       if (ctx->hdr_pos[MBOX_HDR_X_STATUS] == SIZE_MAX &&
            (ctx->mail.flags & XSTATUS_FLAGS_MASK) != 0) {
                str_append(ctx->header, "X-Status: ");
                ctx->hdr_pos[MBOX_HDR_X_STATUS] = str_len(ctx->header);
@@ -244,7 +244,7 @@ static void mbox_sync_add_missing_headers(struct mbox_sync_mail_context *ctx)
 
        ctx->mail.flags ^= MBOX_NONRECENT_KLUDGE;
 
-       if (ctx->hdr_pos[MBOX_HDR_X_KEYWORDS] == (size_t)-1 &&
+       if (ctx->hdr_pos[MBOX_HDR_X_KEYWORDS] == SIZE_MAX &&
            array_is_created(&ctx->mail.keywords) &&
            array_count(&ctx->mail.keywords) > 0) {
                str_append(ctx->header, "X-Keywords: ");
@@ -261,9 +261,9 @@ static void mbox_sync_add_missing_headers(struct mbox_sync_mail_context *ctx)
        }
 
        if (str_len(ctx->header) != new_hdr_size) {
-               if (ctx->header_first_change == (size_t)-1)
+               if (ctx->header_first_change == SIZE_MAX)
                        ctx->header_first_change = new_hdr_size;
-               ctx->header_last_change = (size_t)-1;
+               ctx->header_last_change = SIZE_MAX;
        }
 
        if (ctx->have_eoh)
@@ -272,7 +272,7 @@ static void mbox_sync_add_missing_headers(struct mbox_sync_mail_context *ctx)
 
 static void mbox_sync_update_status(struct mbox_sync_mail_context *ctx)
 {
-       if (ctx->hdr_pos[MBOX_HDR_STATUS] != (size_t)-1) {
+       if (ctx->hdr_pos[MBOX_HDR_STATUS] != SIZE_MAX) {
                status_flags_replace(ctx, ctx->hdr_pos[MBOX_HDR_STATUS],
                                     mbox_status_flags);
        }
@@ -280,7 +280,7 @@ static void mbox_sync_update_status(struct mbox_sync_mail_context *ctx)
 
 static void mbox_sync_update_xstatus(struct mbox_sync_mail_context *ctx)
 {
-       if (ctx->hdr_pos[MBOX_HDR_X_STATUS] != (size_t)-1) {
+       if (ctx->hdr_pos[MBOX_HDR_X_STATUS] != SIZE_MAX) {
                status_flags_replace(ctx, ctx->hdr_pos[MBOX_HDR_X_STATUS],
                                     mbox_xstatus_flags);
        }
@@ -318,14 +318,14 @@ static void mbox_sync_update_line(struct mbox_sync_mail_context *ctx,
        }
 
        mbox_sync_move_buffer(ctx, pos, str_len(new_line), p - hdr + 1);
-       buffer_copy(ctx->header, pos, new_line, 0, (size_t)-1);
+       buffer_copy(ctx->header, pos, new_line, 0, SIZE_MAX);
 }
 
 static void mbox_sync_update_xkeywords(struct mbox_sync_mail_context *ctx)
 {
        string_t *str;
 
-       if (ctx->hdr_pos[MBOX_HDR_X_KEYWORDS] == (size_t)-1)
+       if (ctx->hdr_pos[MBOX_HDR_X_KEYWORDS] == SIZE_MAX)
                return;
 
        str = t_str_new(256);
@@ -343,7 +343,7 @@ static void mbox_sync_update_x_imap_base(struct mbox_sync_mail_context *ctx)
        i_assert(sync_ctx->base_uid_validity != 0);
 
        if (!sync_ctx->dest_first_mail ||
-           ctx->hdr_pos[MBOX_HDR_X_IMAPBASE] == (size_t)-1)
+           ctx->hdr_pos[MBOX_HDR_X_IMAPBASE] == SIZE_MAX)
                return;
 
        if (!ctx->imapbase_rewrite) {
@@ -371,7 +371,7 @@ static void mbox_sync_update_x_uid(struct mbox_sync_mail_context *ctx)
 {
        string_t *str;
 
-       if (ctx->hdr_pos[MBOX_HDR_X_UID] == (size_t)-1 ||
+       if (ctx->hdr_pos[MBOX_HDR_X_UID] == SIZE_MAX ||
            ctx->mail.uid == ctx->parsed_uid)
                return;
 
index a09cd3ae1af37b79e60d492f35efcbae1ef61ac1..e2ccb4815de68ad4d82286457ac607315828e983 100644 (file)
@@ -626,7 +626,7 @@ static void pop3c_client_connect_ip(struct pop3c_client *client)
        client->input = client->raw_input =
                i_stream_create_fd(client->fd, POP3C_MAX_INBUF_SIZE);
        client->output = client->raw_output =
-               o_stream_create_fd(client->fd, (size_t)-1);
+               o_stream_create_fd(client->fd, SIZE_MAX);
        o_stream_set_no_error_handling(client->output, TRUE);
 
        if (*client->set.rawlog_dir != '\0' &&
index 19b682c4b525c6b305565fc7cda2ef327bed99f5..1012c8b0a50a3ca7fbb1792610e0de79eddae240 100644 (file)
@@ -101,10 +101,10 @@ static const struct setting_parser_info pop3c_setting_parser_info = {
        .defines = pop3c_setting_defines,
        .defaults = &pop3c_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct pop3c_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .parent = &mail_user_setting_parser_info,
 
         .check_func = pop3c_settings_check
index da22fb386c56d825ed7ee40d6e07045ede4b8fe9..172cacc53a6b2b1a9abae96a9863b28f12476718 100644 (file)
@@ -167,10 +167,10 @@ const struct setting_parser_info mail_storage_setting_parser_info = {
        .defines = mail_storage_setting_defines,
        .defaults = &mail_storage_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct mail_storage_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .parent = &mail_user_setting_parser_info,
 
        .check_func = mail_storage_settings_check,
@@ -211,7 +211,7 @@ const struct setting_parser_info mailbox_setting_parser_info = {
        .type_offset = offsetof(struct mailbox_settings, name),
        .struct_size = sizeof(struct mailbox_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .parent = &mail_user_setting_parser_info,
 
        .check_func = mailbox_settings_check
@@ -355,10 +355,10 @@ const struct setting_parser_info mail_user_setting_parser_info = {
        .defines = mail_user_setting_defines,
        .defaults = &mail_user_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct mail_user_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
        .check_func = mail_user_settings_check,
 #ifndef CONFIG_BINARY
index da147017744d17729ce486f213edbbef3523c8ba..42e1e0a8d6a03ce07eb56e837726413a4c460bb4 100644 (file)
@@ -48,7 +48,7 @@ static ssize_t test_read(struct istream_private *stream)
                tstream->skip_diff = new_skip_diff;
 
                cur_max = tstream->max_pos;
-               if (stream->max_buffer_size < (size_t)-1 - stream->skip &&
+               if (stream->max_buffer_size < SIZE_MAX - stream->skip &&
                    cur_max > stream->skip + stream->max_buffer_size)
                        cur_max = stream->skip + stream->max_buffer_size;
 
@@ -120,7 +120,7 @@ struct istream *test_istream_create_data(const void *data, size_t size)
        i_stream_create(&tstream->istream, NULL, -1, 0);
        tstream->istream.statbuf.st_size = tstream->max_pos = size;
        tstream->allow_eof = TRUE;
-       tstream->istream.max_buffer_size = (size_t)-1;
+       tstream->istream.max_buffer_size = SIZE_MAX;
        return &tstream->istream.istream;
 }
 
index 7e7784ce1d6c93437af973356dcd06b496734dcc..ea42e7a7fb90d12b4786d68c91120da2c08ece8a 100644 (file)
@@ -145,7 +145,7 @@ struct ostream *test_ostream_create(buffer_t *output)
        struct ostream *ostream;
 
        tstream = i_new(struct test_ostream, 1);
-       tstream->ostream.max_buffer_size = (size_t)-1;
+       tstream->ostream.max_buffer_size = SIZE_MAX;
        tstream->ostream.iostream.destroy = o_stream_test_destroy;
        tstream->ostream.sendv = o_stream_test_sendv;
        tstream->ostream.flush = o_stream_test_flush;
@@ -155,7 +155,7 @@ struct ostream *test_ostream_create(buffer_t *output)
        tstream->ostream.ostream.blocking = TRUE;
 
        tstream->output_buf = output;
-       tstream->max_output_size = (size_t)-1;
+       tstream->max_output_size = SIZE_MAX;
        ostream = o_stream_create(&tstream->ostream, NULL, -1);
        o_stream_set_name(ostream, "(test-ostream)");
        return ostream;
index 21578f7e3366f7872e085dc79de8e3d2000ebfec..44b91a504a02e07d32364379095640a1b3029d6b 100644 (file)
@@ -36,7 +36,7 @@ void *array_insert_space_i(struct array *array, unsigned int idx)
 
        pos = idx * array->element_size;
        buffer_copy(array->buffer, pos + array->element_size,
-                   array->buffer, pos, (size_t)-1);
+                   array->buffer, pos, SIZE_MAX);
 
        data = buffer_get_space_unsafe(array->buffer, pos, array->element_size);
        memset(data, 0, array->element_size);
index 0890fd525600e9f1f80613baf473b5017054f473..f22305b7e494f096f8745f41f07e6810450484a7 100644 (file)
@@ -199,7 +199,7 @@ static inline void
 array_append_array_i(struct array *dest_array, const struct array *src_array)
 {
        i_assert(dest_array->element_size == src_array->element_size);
-       buffer_append_buf(dest_array->buffer, src_array->buffer, 0, (size_t)-1);
+       buffer_append_buf(dest_array->buffer, src_array->buffer, 0, SIZE_MAX);
 }
 #define array_append_array(dest_array, src_array) \
        array_append_array_i(&(dest_array)->arr + ARRAY_TYPES_CHECK(dest_array, src_array), \
index 28a24c1995d12fb0f62ff8caa8b72d8c7f256e20..41b879022eca11834c8cfda2365c1d4ee06dc670 100644 (file)
@@ -46,7 +46,7 @@ buffer_check_limits(struct real_buffer *buf, size_t pos, size_t data_size)
        unsigned int extra;
        size_t new_size;
 
-       if (unlikely((size_t)-1 - pos < data_size))
+       if (unlikely(SIZE_MAX - pos < data_size))
                i_panic("Buffer write out of range (%zu + %zu)", pos, data_size);
 
        new_size = pos + data_size;
@@ -214,7 +214,7 @@ void buffer_insert(buffer_t *_buf, size_t pos,
        if (pos >= buf->used)
                buffer_write(_buf, pos, data, data_size);
        else {
-               buffer_copy(_buf, pos + data_size, _buf, pos, (size_t)-1);
+               buffer_copy(_buf, pos + data_size, _buf, pos, SIZE_MAX);
                memcpy(buf->w_buffer + pos, data, data_size);
        }
 }
@@ -262,7 +262,7 @@ void buffer_replace(buffer_t *_buf, size_t pos, size_t size,
                } else {
                        /* insert */
                        buffer_copy(_buf, pos + data_size, _buf, pos + size,
-                                   (size_t)-1);
+                                   SIZE_MAX);
                        memcpy(buf->w_buffer + pos, data, data_size);
                }
        } else {
@@ -295,7 +295,7 @@ void buffer_insert_zero(buffer_t *_buf, size_t pos, size_t data_size)
        if (pos >= buf->used)
                buffer_write_zero(_buf, pos, data_size);
        else {
-               buffer_copy(_buf, pos + data_size, _buf, pos, (size_t)-1);
+               buffer_copy(_buf, pos + data_size, _buf, pos, SIZE_MAX);
                memset(buf->w_buffer + pos, 0, data_size);
        }
 }
index 5a9dc2fbb94faaa13d3af5ce5450ec5065921f09..2c5ae797c806dc7a42cfb50af568c63c1c27cbeb 100644 (file)
@@ -73,11 +73,11 @@ void buffer_insert_zero(buffer_t *buf, size_t pos, size_t data_size);
 
 /* Copy data from buffer to another. The buffers may be same in which case
    it's internal copying, possibly with overlapping positions (ie. memmove()
-   like functionality). copy_size may be set to (size_t)-1 to copy the rest of
+   like functionality). copy_size may be set to SIZE_MAX to copy the rest of
    the used data in buffer. */
 void buffer_copy(buffer_t *dest, size_t dest_pos,
                 const buffer_t *src, size_t src_pos, size_t copy_size);
-/* Append data to buffer from another. copy_size may be set to (size_t)-1 to
+/* Append data to buffer from another. copy_size may be set to SIZE_MAX to
    copy the rest of the used data in buffer. */
 void buffer_append_buf(buffer_t *dest, const buffer_t *src,
                       size_t src_pos, size_t copy_size);
index 157268e383930db401b0c16bc56a4bed04b5a9d2..936bc816d5d14236e7d9e337b0235f7c94d90ca6 100644 (file)
@@ -70,7 +70,7 @@ int file_cache_set_size(struct file_cache *cache, uoff_t size)
        if (size <= cache->mmap_length)
                return 0;
 
-       if (size > (size_t)-1) {
+       if (size > SIZE_MAX) {
                i_error("file_cache_set_size(%s, %"PRIuUOFF_T"): size too large",
                        cache->path, size);
                return -1;
index b40d0266cac4795495a2bf13c7ff0d14a0b6e99e..b97fc21252133eee920ffc9ab6ab8addb16b250c 100644 (file)
@@ -23,7 +23,7 @@ struct istream *i_stream_create_from_data(const void *data, size_t size)
        stream = i_new(struct istream_private, 1);
        stream->buffer = data;
        stream->pos = size;
-       stream->max_buffer_size = (size_t)-1;
+       stream->max_buffer_size = SIZE_MAX;
 
        stream->read = i_stream_data_read;
        stream->seek = i_stream_data_seek;
index 67ff65620b72576ae0971287b5e52c22589d5673..b4bd3d858a39f51be867f470d7d24a4835b2146b 100644 (file)
@@ -238,7 +238,7 @@ static int i_stream_seekable_write_failed(struct seekable_istream *sstream)
 
        i_assert(sstream->fd != -1);
 
-       stream->max_buffer_size = (size_t)-1;
+       stream->max_buffer_size = SIZE_MAX;
        data = i_stream_alloc(stream, sstream->write_peak);
 
        if (pread_full(sstream->fd, data, sstream->write_peak, 0) < 0) {
@@ -266,7 +266,7 @@ static ssize_t i_stream_seekable_read(struct istream_private *stream)
 
                /* copy everything to temp file and use it as the stream */
                if (copy_to_temp_file(sstream) < 0) {
-                       stream->max_buffer_size = (size_t)-1;
+                       stream->max_buffer_size = SIZE_MAX;
                        if (!read_from_buffer(sstream, &ret))
                                i_unreached();
                        return ret;
index 10b27829274fb07bae1ce21ae3ec85d8ecd41ef9..1858716b64c466f88c4005c86a198b25bb673bbe 100644 (file)
@@ -53,14 +53,14 @@ static void tee_streams_skip(struct tee_istream *tee)
        struct tee_child_istream *tstream = tee->children;
        size_t min_skip;
 
-       min_skip = (size_t)-1;
+       min_skip = SIZE_MAX;
        for (; tstream != NULL; tstream = tstream->next) {
                if (tstream->istream.skip < min_skip &&
                    !tstream->istream.istream.closed)
                        min_skip = tstream->istream.skip;
        }
 
-       if (min_skip > 0 && min_skip != (size_t)-1) {
+       if (min_skip > 0 && min_skip != SIZE_MAX) {
                i_stream_skip(tee->input, min_skip);
                tee_streams_update_buffer(tee);
        }
index 51ea7e34f85344c2aee087669e51f84bef916014..7d1addcaa60adf1d122e3bd27a0462030d3abbcb 100644 (file)
@@ -133,7 +133,7 @@ static void *pool_system_realloc(pool_t pool ATTR_UNUSED, void *mem,
                                 size_t old_size, size_t new_size)
 {
 #if defined(HAVE_MALLOC_USABLE_SIZE)
-       i_assert(old_size == (size_t)-1 || mem == NULL ||
+       i_assert(old_size == SIZE_MAX || mem == NULL ||
                 old_size <= malloc_usable_size(mem));
 #endif
 
index 1a0a16f95e9df902d60ce63549e2c2108afc7f91..76e192db796d38f4631a7c76508c1dabc9882952 100644 (file)
@@ -70,7 +70,7 @@ struct ostream *o_stream_create_buffer(buffer_t *buf)
        /* we don't set buffer as blocking, because if max_buffer_size is
           changed it can get truncated. this is used in various places in
           unit tests. */
-       bstream->ostream.max_buffer_size = (size_t)-1;
+       bstream->ostream.max_buffer_size = SIZE_MAX;
        bstream->ostream.seek = o_stream_buffer_seek;
        bstream->ostream.sendv = o_stream_buffer_sendv;
        bstream->ostream.write_at = o_stream_buffer_write_at;
index 882e25fcb4929a9f8952056a9cef1af087143c20..b5d155a6f274abe60879478445c90c19dfed8f4d 100644 (file)
@@ -371,7 +371,7 @@ wrapper_ostream_writev(struct wrapper_ostream *wostream,
        i_assert(parent != NULL);
        o_stream_set_max_buffer_size(parent, IO_BLOCK_SIZE);
        sent = o_stream_sendv(parent, iov, iov_count);
-       o_stream_set_max_buffer_size(parent, (size_t)-1);
+       o_stream_set_max_buffer_size(parent, SIZE_MAX);
        if (sent < 0) {
                wrapper_ostream_handle_parent_error(wostream);
                return -1;
@@ -1007,8 +1007,8 @@ wrapper_ostream_get_buffer_avail_size(const struct ostream_private *stream)
        struct wrapper_ostream *wostream = (struct wrapper_ostream *)stream;
        size_t size = 0;
 
-       if (wostream->ostream.max_buffer_size == (size_t)-1)
-               return (size_t)-1;
+       if (wostream->ostream.max_buffer_size == SIZE_MAX)
+               return SIZE_MAX;
 
        if (wostream->buffer == NULL)
                size = wostream->ostream.max_buffer_size;
index 49fe81872fa8a383ab56d03563ad228ab65ecc60..7b5e54499a753916b7d1582d273256a007c3acdb 100644 (file)
@@ -91,7 +91,7 @@ char *p_strndup(pool_t pool, const void *str, size_t max_chars)
        size_t len;
 
        i_assert(str != NULL);
-       i_assert(max_chars != (size_t)-1);
+       i_assert(max_chars != SIZE_MAX);
 
        len = 0;
        while (len < max_chars && ((const char *) str)[len] != '\0')
index 688c3cd057236221bbb8045cf5fc7ed27dcf12ef..056c85958004be32b1b6528d8acc6d92712e23a4 100644 (file)
@@ -74,7 +74,7 @@ static void test_buffer_append_full_istream(void)
        fd_set_nonblock(fds[0], TRUE);
        fd_set_nonblock(fds[1], TRUE);
 
-       struct istream *is = i_stream_create_fd(fds[0], (size_t)-1);
+       struct istream *is = i_stream_create_fd(fds[0], SIZE_MAX);
        /* test just the READ_MORE stuff */
 
        test_assert(write_full(fds[1], "some data ", 10) == 0);
index 2d188654a3f28615cb9efa897a5a68fa4fd3e61b..0b4417b1d15b267690d2a3c9c537c7ca2480e36c 100644 (file)
@@ -289,7 +289,7 @@ static void test_buffer_truncate_bits(void)
 
        for(size_t i = 0; i < N_ELEMENTS(test_cases); i++) {
                buffer_set_used_size(buf, 0);
-               buffer_copy(buf, 0, &test_cases[i].input, 0, (size_t)-1);
+               buffer_copy(buf, 0, &test_cases[i].input, 0, SIZE_MAX);
                buffer_truncate_rshift_bits(buf, test_cases[i].bits);
                test_assert_idx(buffer_cmp(buf, &test_cases[i].output) == TRUE, i);
        }
index 8e757d3acecfeda7baccf31fe85f5b5531298c8b..22677c3fe5a3ac9dadb8753d69f6293c50588459 100644 (file)
@@ -17,8 +17,8 @@ static const struct connection_settings client_set =
        .major_version = 1,
        .minor_version = 0,
        .client = TRUE,
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
 };
 
 static const struct connection_settings server_set =
@@ -28,8 +28,8 @@ static const struct connection_settings server_set =
        .major_version = 1,
        .minor_version = 0,
        .client = FALSE,
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
 };
 
 static bool received_quit = FALSE;
@@ -133,7 +133,7 @@ static const struct connection_settings no_input_client_set =
        .minor_version = 0,
        .client = TRUE,
        .input_max_size = 0,
-       .output_max_size = (size_t)-1,
+       .output_max_size = SIZE_MAX,
 };
 
 static const struct connection_settings no_input_server_set =
@@ -144,14 +144,14 @@ static const struct connection_settings no_input_server_set =
        .minor_version = 0,
        .client = FALSE,
        .input_max_size = 0,
-       .output_max_size = (size_t)-1,
+       .output_max_size = SIZE_MAX,
 };
 
 static void
 test_connection_no_input_input(struct connection *conn)
 {
        const char *input;
-       struct istream *is = i_stream_create_fd(conn->fd_in, -1);
+       struct istream *is = i_stream_create_fd(conn->fd_in, SIZE_MAX);
        i_stream_set_blocking(is, FALSE);
        while ((input = i_stream_read_next_line(is)) != NULL) {
                const char *const *args = t_strsplit_tabescaped(input);
@@ -299,7 +299,7 @@ static const struct connection_settings input_full_client_set =
        .minor_version = 0,
        .client = TRUE,
        .input_max_size = 100,
-       .output_max_size = (size_t)-1,
+       .output_max_size = SIZE_MAX,
 };
 
 static int test_connection_input_full_input_args(struct connection *conn,
@@ -460,8 +460,8 @@ static const struct connection_settings idle_kill_server_set =
        .major_version = 1,
        .minor_version = 0,
        .client = FALSE,
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .input_idle_timeout_secs = 1,
 };
 
@@ -518,8 +518,8 @@ static void test_connection_handshake_failed_version(void)
                .major_version = 1,
                .minor_version = 0,
                .client = TRUE,
-               .input_max_size = (size_t)-1,
-               .output_max_size = (size_t)-1,
+               .input_max_size = SIZE_MAX,
+               .output_max_size = SIZE_MAX,
        },
        {
                .service_name_in = "TEST-C",
@@ -527,8 +527,8 @@ static void test_connection_handshake_failed_version(void)
                .major_version = 1,
                .minor_version = 0,
                .client = TRUE,
-               .input_max_size = (size_t)-1,
-               .output_max_size = (size_t)-1,
+               .input_max_size = SIZE_MAX,
+               .output_max_size = SIZE_MAX,
        },
        {
                .service_name_in = "TEST-S",
@@ -536,8 +536,8 @@ static void test_connection_handshake_failed_version(void)
                .major_version = 2,
                .minor_version = 0,
                .client = TRUE,
-               .input_max_size = (size_t)-1,
-               .output_max_size = (size_t)-1,
+               .input_max_size = SIZE_MAX,
+               .output_max_size = SIZE_MAX,
        }
        };
 
@@ -547,8 +547,8 @@ static void test_connection_handshake_failed_version(void)
                .major_version = 1,
                .minor_version = 2,
                .client = TRUE,
-               .input_max_size = (size_t)-1,
-               .output_max_size = (size_t)-1,
+               .input_max_size = SIZE_MAX,
+               .output_max_size = SIZE_MAX,
        };
 
        test_begin("connection handshake failed (version)");
@@ -699,8 +699,8 @@ static const struct connection_settings no_version_client_set =
        .major_version = 0,
        .minor_version = 0,
        .client = TRUE,
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .dont_send_version = TRUE,
 };
 
@@ -708,8 +708,8 @@ static const struct connection_settings no_version_server_set =
 {
        .major_version = 0,
        .minor_version = 0,
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .dont_send_version = TRUE,
 };
 
index 86c95ba55fad87ca3d9bf01ff0e32fdfee07d7c6..aa25a9cc6163ea9eb10811818b120eca2f36e557 100644 (file)
@@ -70,7 +70,7 @@ static void test_file_cache_write_read(void)
        file_cache_free(&cache);
        i_close_fd(&fd);
 
-       struct istream *is = i_stream_create_file(TEST_FILENAME, (size_t)-1);
+       struct istream *is = i_stream_create_file(TEST_FILENAME, SIZE_MAX);
        const unsigned char *data;
        test_assert(i_stream_read_more(is, &data, &size) > 0 && size == 13);
        test_assert(memcmp(data, "initial data\n", 13) == 0);
index 2a5aea687a8010ed2d41fb0736a24e675b20b30e..f970fbaa8358a8d950e31e5a5309cebd0ae8b06f 100644 (file)
@@ -109,7 +109,7 @@ run_pump(struct istream *in, struct ostream *out, int *counter,
        if (!ctx.out->blocking && ctx.in->stream_errno != 0 &&
            ctx.out->stream_errno == 0) {
                /* input failed, finish flushing output */
-               test_ostream_set_max_output_size(ctx.out, (size_t)-1);
+               test_ostream_set_max_output_size(ctx.out, SIZE_MAX);
                test_assert(o_stream_flush(ctx.out) > 0);
        } else {
                test_assert(o_stream_flush(ctx.out) != 0);
index 66186ef2b770bd597d2fb2a7e1827cfa4430fda4..185c271ccb7e51202a9895559afd3296ed73dbb6 100644 (file)
@@ -22,7 +22,7 @@ static void test_istream_multiplex_simple(void)
        struct istream *input = test_istream_create_data(data, data_len);
        size_t siz;
 
-       struct istream *chan0 = i_stream_create_multiplex(input, (size_t)-1);
+       struct istream *chan0 = i_stream_create_multiplex(input, SIZE_MAX);
        struct istream *chan1 = i_stream_multiplex_add_channel(chan0, 1);
 
        /* nothing to read until the first byte */
@@ -287,10 +287,10 @@ static void test_istream_multiplex_stream(void)
        test_assert(pipe(fds) == 0);
        fd_set_nonblock(fds[0], TRUE);
        fd_set_nonblock(fds[1], TRUE);
-       struct ostream *os = o_stream_create_fd(fds[1], (size_t)-1);
+       struct ostream *os = o_stream_create_fd(fds[1], SIZE_MAX);
        struct istream *is = i_stream_create_fd(fds[0], 10 + i_rand_limit(10));
 
-       struct istream *chan0 = i_stream_create_multiplex(is, (size_t)-1);
+       struct istream *chan0 = i_stream_create_multiplex(is, SIZE_MAX);
        struct istream *chan1 = i_stream_multiplex_add_channel(chan0, 1);
 
        struct io *io0 =
@@ -330,7 +330,7 @@ static void test_istream_multiplex_close_channel(void)
        struct istream *input = test_istream_create_data(data, data_len);
        size_t siz;
 
-       struct istream *chan0 = i_stream_create_multiplex(input, (size_t)-1);
+       struct istream *chan0 = i_stream_create_multiplex(input, SIZE_MAX);
        struct istream *chan1 = i_stream_multiplex_add_channel(chan0, 1);
 
        i_stream_unref(&chan1);
@@ -344,7 +344,7 @@ static void test_istream_multiplex_close_channel(void)
        i_stream_unref(&input);
 
        input = test_istream_create_data(data, data_len);
-       chan0 = i_stream_create_multiplex(input, (size_t)-1);
+       chan0 = i_stream_create_multiplex(input, SIZE_MAX);
        chan1 = i_stream_multiplex_add_channel(chan0, 1);
 
        /* this is needed to populate chan1 data */
index 5bd9e7a0bae904b4d95cb41830844e62ff38b432..7f36094855469513212878ab86b6046d57959585 100644 (file)
@@ -85,7 +85,7 @@ static void setup_channel(struct test_channel *channel,
        test_assert(pipe(channel->fds) == 0);
        fd_set_nonblock(channel->fds[0], TRUE);
        fd_set_nonblock(channel->fds[1], TRUE);
-       channel->in_alt = i_stream_create_fd(channel->fds[0], (size_t)-1);
+       channel->in_alt = i_stream_create_fd(channel->fds[0], SIZE_MAX);
        channel->out_alt = o_stream_create_fd(channel->fds[1], IO_BLOCK_SIZE);
        channel->io_alt = io_add_istream(channel->in_alt, test_istream_read_alt,
                                         channel);
@@ -126,10 +126,10 @@ static void test_multiplex_stream(void) {
        test_assert(pipe(fds) == 0);
        fd_set_nonblock(fds[0], TRUE);
        fd_set_nonblock(fds[1], TRUE);
-       struct ostream *os = o_stream_create_fd(fds[1], (size_t)-1);
-       struct istream *is = i_stream_create_fd(fds[0], (size_t)-1);
+       struct ostream *os = o_stream_create_fd(fds[1], SIZE_MAX);
+       struct istream *is = i_stream_create_fd(fds[0], SIZE_MAX);
 
-       struct istream *ichan0 = i_stream_create_multiplex(is, (size_t)-1);
+       struct istream *ichan0 = i_stream_create_multiplex(is, SIZE_MAX);
        struct istream *ichan1 = i_stream_multiplex_add_channel(ichan0, 1);
        i_stream_unref(&is);
 
index 42c792f63da7b0816372fac58aa44d1105a0e669..4a449f6f344490498ee241ff6df58880cf0fd6c1 100644 (file)
@@ -67,7 +67,7 @@ static void test_ostream_buffer_size(void)
        test_begin("ostream buffer size/available");
        output = o_stream_create_buffer(str);
        test_assert(o_stream_get_buffer_used_size(output) == 0);
-       test_assert(o_stream_get_buffer_avail_size(output) == (size_t)-1);
+       test_assert(o_stream_get_buffer_avail_size(output) == SIZE_MAX);
 
        /* test shrinking sink's max buffer size */
        o_stream_set_max_buffer_size(output, 10);
index 8f03fab8a893931efc34c8c2aa2632322c88bce9..d5b7ac1173b1b9031183aa43fec3170a3e233ed1 100644 (file)
@@ -24,7 +24,7 @@ static void test_ostream_multiplex_simple(void)
 
        buffer_t *result = t_str_new(64);
        struct ostream *os = test_ostream_create(result);
-       struct ostream *os2 = o_stream_create_multiplex(os, (size_t)-1);
+       struct ostream *os2 = o_stream_create_multiplex(os, SIZE_MAX);
        struct ostream *os3 = o_stream_multiplex_add_channel(os2, 1);
 
        test_assert(o_stream_send_str(os2, "hello") == 5);
@@ -120,10 +120,10 @@ static void test_ostream_multiplex_stream(void)
        test_assert(pipe(fds) == 0);
        fd_set_nonblock(fds[0], TRUE);
        fd_set_nonblock(fds[1], TRUE);
-       struct ostream *os = o_stream_create_fd(fds[1], (size_t)-1);
-       struct istream *is = i_stream_create_fd(fds[0], (size_t)-1);
+       struct ostream *os = o_stream_create_fd(fds[1], SIZE_MAX);
+       struct istream *is = i_stream_create_fd(fds[0], SIZE_MAX);
 
-       chan0 = o_stream_create_multiplex(os, (size_t)-1);
+       chan0 = o_stream_create_multiplex(os, SIZE_MAX);
        chan1 = o_stream_multiplex_add_channel(chan0, 1);
 
        struct io *io0 =
@@ -157,7 +157,7 @@ static void test_ostream_multiplex_cork(void)
        test_begin("ostream multiplex (corking)");
        buffer_t *output = t_buffer_create(128);
        struct ostream *os = test_ostream_create(output);
-       struct ostream *chan0 = o_stream_create_multiplex(os, (size_t)-1);
+       struct ostream *chan0 = o_stream_create_multiplex(os, SIZE_MAX);
 
        const struct const_iovec iov[] = {
                { "hello", 5 },
index 89d50151c9f0d2b3d88698a40f4960e9272f240b..7036e73fbe72ae4a5b189939b552ef39c1b8a118 100644 (file)
@@ -31,7 +31,7 @@ unsigned int uni_strlen(const unichar_t *str)
 
 int uni_utf8_get_char(const char *input, unichar_t *chr_r)
 {
-       return uni_utf8_get_char_n((const unsigned char *)input, (size_t)-1,
+       return uni_utf8_get_char_n((const unsigned char *)input, SIZE_MAX,
                                   chr_r);
 }
 
index 85664aedcc5d88c70e965bd08b8b7214bdfcefa2..02a8d622c6b97f119c051f6c77fcc4ad0bf94a78 100644 (file)
@@ -249,7 +249,7 @@ bool uri_data_decode(struct uri_parser *parser, const char *data,
 
        if (pend == NULL) {
                /* NULL means unlimited; solely rely on '\0' */
-               pend = (const unsigned char *)(size_t)-1;
+               pend = (const unsigned char *)SIZE_MAX;
        }
        
        if (p >= pend || *p == '\0') {
index d6da86eb89bb763b4b8fa1047c74ec278deda538..1d19d8ea74cf3d18a89259a1e940fb957c237a31 100644 (file)
@@ -108,10 +108,10 @@ const struct setting_parser_info lmtp_setting_parser_info = {
        .defines = lmtp_setting_defines,
        .defaults = &lmtp_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct lmtp_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
        .check_func = lmtp_settings_check,
        .dependencies = lmtp_setting_dependencies
index 6ad13ffd4327f9a89e8d26107029f57f35b6a344..77872ac5414ea0df5aa6f3656fdc2eef3f330b22 100644 (file)
@@ -62,7 +62,7 @@ void doveadm_connection_create(struct log_error_buffer *errorbuf, int fd)
        conn = i_new(struct doveadm_connection, 1);
        conn->errorbuf = errorbuf;
        conn->fd = fd;
-       conn->output = o_stream_create_fd(conn->fd, (size_t)-1);
+       conn->output = o_stream_create_fd(conn->fd, SIZE_MAX);
        if (doveadm_connection_send_errors(conn) < 0)
                doveadm_connection_destroy(&conn);
        else {
index a4dab8ac2b1e278a128153455fd84894a8a8e436..53c4f9bf086a9f5143fdd37abfc6a5eb6e28f7ee 100644 (file)
@@ -156,7 +156,7 @@ static void proxy_plain_connected(struct login_proxy *proxy)
        proxy->server_input =
                i_stream_create_fd(proxy->server_fd, MAX_PROXY_INPUT_SIZE);
        proxy->server_output =
-               o_stream_create_fd(proxy->server_fd, (size_t)-1);
+               o_stream_create_fd(proxy->server_fd, SIZE_MAX);
        o_stream_set_no_error_handling(proxy->server_output, TRUE);
 
        proxy->server_io =
index d503a4a4d66e602e45ac546699839373250d00af..40bb1616cf60337f94d1f194a47015a897353c44 100644 (file)
@@ -78,10 +78,10 @@ const struct setting_parser_info login_setting_parser_info = {
        .defines = login_setting_defines,
        .defaults = &login_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct login_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
        .check_func = login_settings_check
 };
index da37a013e247bdaaad28374cc1ec24384714de43..79a811e97f897a7ad26d2fc93fff8c9510afd4b2 100644 (file)
@@ -51,7 +51,7 @@ static const struct setting_parser_info file_listener_setting_parser_info = {
        .type_offset = offsetof(struct file_listener_settings, path),
        .struct_size = sizeof(struct file_listener_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .parent = &service_setting_parser_info
 };
 
@@ -86,7 +86,7 @@ static const struct setting_parser_info inet_listener_setting_parser_info = {
        .type_offset = offsetof(struct inet_listener_settings, name),
        .struct_size = sizeof(struct inet_listener_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .parent = &service_setting_parser_info
 };
 
@@ -237,10 +237,10 @@ const struct setting_parser_info master_setting_parser_info = {
        .defines = master_setting_defines,
        .defaults = &master_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct master_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
        .check_func = master_settings_verify
 };
index b1e4e9fb859d6cd886e438ff2b7c7d171a454e25..3e4df1ef0481b6fccea8ad38ed284edd64730435 100644 (file)
@@ -1125,8 +1125,8 @@ static void server_connection_accept(void *context ATTR_UNUSED)
 /* */
 
 static struct connection_settings server_connection_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = FALSE
 };
 
index 008827240ee2978d074f8afbd5fa579fb6bb68a9..08112d43c34317a4fe0d14fc32fc5d171eb7e030 100644 (file)
@@ -1233,8 +1233,8 @@ static void server_connection_accept(void *context ATTR_UNUSED)
 /* */
 
 static struct connection_settings server_connection_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = FALSE
 };
 
index 83451489764f92a245c50e8d46ea5a38e8906ebb..f0478c72186ed7ed4dd483a71345e4a9415523ab 100644 (file)
@@ -837,8 +837,8 @@ static void server_connection_accept(void *context ATTR_UNUSED)
 /* */
 
 static struct connection_settings server_connection_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = FALSE
 };
 
index 39f0e9f9aec7d80e4fd6c33bbd06af2d11c964ec..5a6d5cb3291e45300d6616b78a3e10c71f49a0ba 100644 (file)
@@ -140,7 +140,7 @@ struct client *client_create(int fd)
        client->fd = fd;
        client->io = io_add(fd, IO_READ, client_input, client);
        client->input = i_stream_create_fd(fd, MAX_INBUF_SIZE);
-       client->output = o_stream_create_fd(fd, (size_t)-1);
+       client->output = o_stream_create_fd(fd, SIZE_MAX);
        o_stream_set_no_error_handling(client->output, TRUE);
        o_stream_set_flush_callback(client->output, client_output, client);
        client->cmd_pool = pool_alloconly_create("cmd pool", 1024);
index 73100afdcc13a5959b80092ddd72752315d50a1e..dc04bfb1af2b8502ca69de9b16be8de262054a70 100644 (file)
@@ -30,7 +30,7 @@ static bool global_memory_free_something(void)
 
 void global_memory_alloc(size_t size)
 {
-       i_assert(size < (size_t)-1 - global_used_memory);
+       i_assert(size < SIZE_MAX - global_used_memory);
        global_used_memory += size;
 
        while (global_used_memory > stats_settings->memory_limit) {
index d749a6f193371af0c4e9ed84ebe4fb602815ddef..a67fca346665c50c3f83e98e227ee5b07206b145 100644 (file)
@@ -96,10 +96,10 @@ const struct setting_parser_info old_stats_setting_parser_info = {
        .defines = old_stats_setting_defines,
        .defaults = &old_stats_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct old_stats_settings),
 
-       .parent_offset = (size_t)-1
+       .parent_offset = SIZE_MAX
 };
 
 const struct old_stats_settings *stats_settings;
index ff5b99d24f110e548fce8fc15cda27f4e350b70f..e960795d0a7c9c34ad001b3f4ae09a0d9cec32b9 100644 (file)
@@ -132,7 +132,7 @@ static int acl_backend_vfile_acllist_read(struct acl_backend_vfile *backend)
        backend->acllist_mtime = st.st_mtime;
        acllist_clear(backend, st.st_size);
 
-       input = i_stream_create_fd(fd, (size_t)-1);
+       input = i_stream_create_fd(fd, SIZE_MAX);
        while ((line = i_stream_read_next_line(input)) != NULL) {
                acllist.mtime = 0;
                for (p = line; *p >= '0' && *p <= '9'; p++)
index 3406752edcc60261a460f284286c8a9ea1214aeb..cc93b3561c48729a22f6cd63b5e25e4c0a410cc6 100644 (file)
@@ -366,7 +366,7 @@ acl_backend_vfile_read(struct acl_object *aclobj, bool global, const char *path,
        if (aclobj->backend->debug)
                i_debug("acl vfile: reading file %s", path);
 
-       input = i_stream_create_fd(fd, (size_t)-1);
+       input = i_stream_create_fd(fd, SIZE_MAX);
        i_stream_set_return_partial_line(input, TRUE);
        linenum = 0;
        while ((line = i_stream_read_next_line(input)) != NULL) {
index 930be92f815ee1477cdab77cf2de87c08c92ae76..02f664397c1a782884433cc0559072ec37803054 100644 (file)
@@ -129,7 +129,7 @@ static int acl_global_file_read(struct acl_global_file *file)
        ctx.file = file;
        i_array_init(&ctx.parse_rights, 32);
 
-       input = i_stream_create_file(file->path, (size_t)-1);
+       input = i_stream_create_file(file->path, SIZE_MAX);
        i_stream_set_return_partial_line(input, TRUE);
        while ((line = i_stream_read_next_line(input)) != NULL) {
                linenum++;
index 29b0fc4665983f837d045c110fa9a8d79c147e8c..b55646c9e9fb5d8720ead9d7cc3f3bcc25932d35 100644 (file)
@@ -70,7 +70,7 @@ int main(int argc ATTR_UNUSED, char *argv[])
                return 1;
 
        valid = buffer_create_dynamic(default_pool, 4096);
-       input = i_stream_create_fd(fd, (size_t)-1);
+       input = i_stream_create_fd(fd, SIZE_MAX);
        ret = 0;
        while (ret == 0 && (line = i_stream_read_next_line(input)) != NULL) {
                if (last != input->v_offset/(1024*100)) {
index 82760f202173498e203c33377beaecc0a0a4f96d..d39ceeaca3f63338309b1234a063cdacb46d91d7 100644 (file)
@@ -400,7 +400,7 @@ fts_expunge_log_read_begin(struct fts_expunge_log *log)
        if (fts_expunge_log_reopen_if_needed(log, FALSE) < 0)
                ctx->failed = TRUE;
        else if (log->fd != -1)
-               ctx->input = i_stream_create_fd(log->fd, (size_t)-1);
+               ctx->input = i_stream_create_fd(log->fd, SIZE_MAX);
        ctx->unlink = TRUE;
        return ctx;
 }
index 71eb2b231a1b23198420f02ab2eb793fbfceb3bd..e6203c3c72cd787f83c92c586e2a89e1d88660b8 100644 (file)
@@ -191,7 +191,7 @@ static int fs_crypt_read_file(const char *set_name, const char *path,
        struct istream *input;
        int ret;
 
-       input = i_stream_create_file(path, (size_t)-1);
+       input = i_stream_create_file(path, SIZE_MAX);
        while (i_stream_read(input) > 0) ;
        if (input->stream_errno != 0) {
                *error_r = t_strdup_printf("%s: read(%s) failed: %s",
index f2877f5b87abe803a071265176dc62ac5b493fe2..7b1ca245db08ea11da6c4a3a6f2163ffa413281e 100644 (file)
@@ -30,9 +30,9 @@ const struct setting_parser_info fs_crypt_setting_parser_info = {
        .defines = fs_crypt_setting_defines,
        .defaults = &fs_crypt_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct fs_crypt_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .dependencies = fs_crypt_setting_dependencies
 };
index a4044a6c4a1ba146165cbeac80887b1577f2dceb..a96f114da87f5cec1994937d42758f5da55b45c5 100644 (file)
@@ -29,9 +29,9 @@ const struct setting_parser_info quota_status_setting_parser_info = {
        .defines = quota_status_setting_defines,
        .defaults = &quota_status_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct quota_status_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .dependencies = quota_status_setting_dependencies
 };
index fba0a5c94f41b93e556171378aeab57391810992..930bb155aa0cd435246ddd183e9d9ce767d4f9e4 100644 (file)
@@ -257,8 +257,8 @@ static void client_destroy(struct connection *conn)
 }
 
 static struct connection_settings client_set = {
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = FALSE
 };
 
index e37e5be638c470eff4eae5f1a08128708840c13f..cfcd2468943a48220342ef677f63c1e13e3872f4 100644 (file)
@@ -299,7 +299,7 @@ static int read_configuration(struct mail_user *user, const char *path)
 
        p_array_init(&tuser->trash_boxes, user->pool, INIT_TRASH_MAILBOX_COUNT);
 
-       input = i_stream_create_fd(fd, (size_t)-1);
+       input = i_stream_create_fd(fd, SIZE_MAX);
        i_stream_set_return_partial_line(input, TRUE);
        while ((line = i_stream_read_next_line(input)) != NULL) {
                /* <priority> <mailbox name> */
index 47fc86b389be2f2cfbae15a64466c5d64ad65170..97346a311fe697ef5921282fe2654579d10e95a3 100644 (file)
@@ -54,7 +54,7 @@ virtual_search_args_parse(const string_t *rule, const char **error_r)
        input = i_stream_create_from_data(str_data(rule), str_len(rule));
        (void)i_stream_read(input);
 
-       imap_parser = imap_parser_create(input, NULL, (size_t)-1);
+       imap_parser = imap_parser_create(input, NULL, SIZE_MAX);
        ret = imap_parser_finish_line(imap_parser, 0,  0, &args);
        if (ret < 0) {
                sargs = NULL;
@@ -501,7 +501,7 @@ int virtual_config_read(struct virtual_mailbox *mbox)
        ctx.mbox = mbox;
        ctx.pool = mbox->box.pool;
        ctx.rule = t_str_new(256);
-       ctx.input = i_stream_create_fd(fd, (size_t)-1);
+       ctx.input = i_stream_create_fd(fd, SIZE_MAX);
        i_stream_set_return_partial_line(ctx.input, TRUE);
        while ((line = i_stream_read_next_line(ctx.input)) != NULL) {
                linenum++;
index 52971f49b23f1a68737f55c975f0f2b6a6797ae6..2dd482eaf2061880d59e6abfbd96b5745f5ed629 100644 (file)
@@ -62,8 +62,8 @@ const struct setting_parser_info pop3_login_setting_parser_info = {
        .module_name = "pop3-login",
        .defines = pop3_login_setting_defines,
 
-       .type_offset = (size_t)-1,
-       .parent_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
+       .parent_offset = SIZE_MAX,
 
        .dependencies = pop3_login_setting_dependencies
 };
index 1f8933ed4f4a7d77a2dbfc63afb68354f7a487da..3b9ea58ef885a64dfb2d1d45cb960a0d32292f2f 100644 (file)
@@ -396,7 +396,7 @@ struct client *client_create(int fd_in, int fd_out,
        client->fd_in = fd_in;
        client->fd_out = fd_out;
        client->input = i_stream_create_fd(fd_in, MAX_INBUF_SIZE);
-       client->output = o_stream_create_fd(fd_out, (size_t)-1);
+       client->output = o_stream_create_fd(fd_out, SIZE_MAX);
        o_stream_set_no_error_handling(client->output, TRUE);
        o_stream_set_flush_callback(client->output, client_output, client);
 
index 2d4a3cfff2e7480a027fe14d9917896088f30e7f..c4f196498c542f17cdb4211a9202f7045b1de8d5 100644 (file)
@@ -104,10 +104,10 @@ const struct setting_parser_info pop3_setting_parser_info = {
        .defines = pop3_setting_defines,
        .defaults = &pop3_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct pop3_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
        .check_func = pop3_settings_verify,
        .dependencies = pop3_setting_dependencies
index 1a54a202582e0acc7ab7bea7f66af79f09d73cb4..f6e66ad1c9580337c9e45bfaaa1f7fadc91ff4f6 100644 (file)
@@ -76,10 +76,10 @@ const struct setting_parser_info aggregator_setting_parser_info = {
        .defines = aggregator_setting_defines,
        .defaults = &aggregator_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct aggregator_settings),
 
-       .parent_offset = (size_t)-1
+       .parent_offset = SIZE_MAX
 };
 
 const struct aggregator_settings *aggregator_settings;
index 6bf6773f6e2f2e22dbf2bbe96b39178c1580b311..f9587fe9e5518cb70a591d6e6b263f383d716bb9 100644 (file)
@@ -111,7 +111,7 @@ void notify_connection_create(int fd, bool fifo)
        conn->io = io_add(fd, IO_READ, notify_input, conn);
        conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE);
        if (!fifo) {
-               conn->output = o_stream_create_fd(fd, (size_t)-1);
+               conn->output = o_stream_create_fd(fd, SIZE_MAX);
                o_stream_set_no_error_handling(conn->output, TRUE);
        }
 
index 0b872e3c2084d8aee298e42d8d0d465f1bdd4000..4c645039992a65f3802d7688529b2517998d88c6 100644 (file)
@@ -171,7 +171,7 @@ static void replicator_connection_connect(struct replicator_connection *conn)
        conn->fd = fd;
        conn->io = io_add(fd, IO_READ, replicator_input, conn);
        conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE);
-       conn->output = o_stream_create_fd(fd, (size_t)-1);
+       conn->output = o_stream_create_fd(fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->output, TRUE);
        o_stream_nsend_str(conn->output, REPLICATOR_HANDSHAKE);
        o_stream_set_flush_callback(conn->output, replicator_output, conn);
index e71a4c979048259d4bd9f44b5ed438ff0a73c3d7..c2a113162d95e498faece2933c41ec509a904bb9 100644 (file)
@@ -322,8 +322,8 @@ static struct connection_settings doveadm_conn_set = {
        .major_version = REPLICATOR_DOVEADM_MAJOR_VERSION,
        .minor_version = REPLICATOR_DOVEADM_MINOR_VERSION,
 
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = FALSE
 };
 
index 5e23fc39525a4f389617e7563feeeee739e8b924..2df12dabbd8b0f5d9608657522ad92d1f8f63179 100644 (file)
@@ -176,8 +176,8 @@ static int dsync_connect(struct dsync_client *client)
        }
        client->last_connect_failure = 0;
        client->io = io_add(client->fd, IO_READ, dsync_input, client);
-       client->input = i_stream_create_fd(client->fd, (size_t)-1);
-       client->output = o_stream_create_fd(client->fd, (size_t)-1);
+       client->input = i_stream_create_fd(client->fd, SIZE_MAX);
+       client->output = o_stream_create_fd(client->fd, SIZE_MAX);
        o_stream_set_no_error_handling(client->output, TRUE);
        o_stream_nsend_str(client->output, DOVEADM_HANDSHAKE);
        return 0;
index 260e54a9a4392f5df50df58b4ae5003682e48b1b..cfc2e20c091e5c9579d4810f2238259773dab0e5 100644 (file)
@@ -140,7 +140,7 @@ notify_connection_create(int fd, struct replicator_queue *queue)
        conn->queue = queue;
        conn->fd = fd;
        conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE);
-       conn->output = o_stream_create_fd(fd, (size_t)-1);
+       conn->output = o_stream_create_fd(fd, SIZE_MAX);
        o_stream_set_no_error_handling(conn->output, TRUE);
        conn->io = io_add(fd, IO_READ, notify_connection_input, conn);
        conn->queue = queue;
index b8d4812c65382eb81497bead771704d840d1b908..430716a22590bbdb5a90b9f5120f45a59b716073 100644 (file)
@@ -388,7 +388,7 @@ int replicator_queue_import(struct replicator_queue *queue, const char *path)
                return -1;
        }
 
-       input = i_stream_create_fd_autoclose(&fd, (size_t)-1);
+       input = i_stream_create_fd_autoclose(&fd, SIZE_MAX);
        while ((line = i_stream_read_next_line(input)) != NULL) {
                T_BEGIN {
                        ret = replicator_queue_import_line(queue, line);
index 8f81dd35cfd9e2ceb89aec5e6fa09b7f4908cb35..7030e0c68db39bdad80ab65cbb8592bedc79c5ae 100644 (file)
@@ -77,10 +77,10 @@ const struct setting_parser_info replicator_setting_parser_info = {
        .defines = replicator_setting_defines,
        .defaults = &replicator_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct replicator_settings),
 
-       .parent_offset = (size_t)-1
+       .parent_offset = SIZE_MAX
 };
 
 const struct replicator_settings *replicator_settings;
index 0ad6d196317b34da71b7a11e90a6cf3b8900ca3b..529474dcf3f6eb6973c983765823e77ec560b5c3 100644 (file)
@@ -174,7 +174,7 @@ static struct connection_settings client_set = {
        .minor_version = 0,
 
        .input_max_size = 1024,
-       .output_max_size = (size_t)-1,
+       .output_max_size = SIZE_MAX,
        .client = FALSE,
 };
 
index 279d3e747c225507e667277f02828e0488030e14..bf3f621a0976886e6834cd4baf16921bc6ff14df 100644 (file)
@@ -307,7 +307,7 @@ static struct connection_settings client_set = {
        .minor_version = 0,
 
        .input_max_size = 1024*128, /* "big enough" */
-       .output_max_size = (size_t)-1,
+       .output_max_size = SIZE_MAX,
        .client = FALSE,
 };
 
index b7879332cf359e1fb30e2c27ef2895529e8ee4b1..7f1ab61739f1b1944dd07c2160b88e946790d428 100644 (file)
@@ -89,7 +89,7 @@ const struct setting_parser_info stats_exporter_setting_parser_info = {
        .type_offset = offsetof(struct stats_exporter_settings, name),
        .struct_size = sizeof(struct stats_exporter_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .check_func = stats_exporter_settings_check,
 };
 
@@ -129,7 +129,7 @@ const struct setting_parser_info stats_metric_setting_parser_info = {
        .type_offset = offsetof(struct stats_metric_settings, metric_name),
        .struct_size = sizeof(struct stats_metric_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .check_func = stats_metric_settings_check,
 };
 
@@ -165,10 +165,10 @@ const struct setting_parser_info stats_setting_parser_info = {
        .defines = stats_setting_defines,
        .defaults = &stats_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct stats_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
        .check_func = stats_settings_check,
 };
 
index 37cfe43b15aa65bb5566830303e355a25b3e6423..e9eed0cb5bee1f1be4f266a94fb5c845c9645224 100644 (file)
@@ -25,8 +25,8 @@ static struct connection_settings client_set = {
        .major_version = 2,
        .minor_version = 0,
        .allow_empty_args_input = TRUE,
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = TRUE,
 };
 
index 608febdbcaed64fe2eb11ff9b6875f6c762c2bc0..290c3ec266ac5fa8b573e36d0180fe54c6349618 100644 (file)
@@ -41,8 +41,8 @@ static struct connection_settings client_set = {
        .major_version = 3,
        .minor_version = 0,
 
-       .input_max_size = (size_t)-1,
-       .output_max_size = (size_t)-1,
+       .input_max_size = SIZE_MAX,
+       .output_max_size = SIZE_MAX,
        .client = TRUE,
 };
 
index 844ceb8c2632d29e02ba425bbc4880623c347f69..4ff5d5b73505b11bc615c6c97bf13c4849b9510b 100644 (file)
@@ -82,9 +82,9 @@ const struct setting_parser_info submission_login_setting_parser_info = {
        .defines = submission_login_setting_defines,
        .defaults = &submission_login_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct submission_login_settings),
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
 #ifndef CONFIG_BINARY
        .check_func = submission_login_settings_check,
index ab411659493114a57be8864ec19e26676132e270..1b07bf286838df200ac77b3cf7ada7efcfecd1ae 100644 (file)
@@ -146,10 +146,10 @@ const struct setting_parser_info submission_setting_parser_info = {
        .defines = submission_setting_defines,
        .defaults = &submission_default_settings,
 
-       .type_offset = (size_t)-1,
+       .type_offset = SIZE_MAX,
        .struct_size = sizeof(struct submission_settings),
 
-       .parent_offset = (size_t)-1,
+       .parent_offset = SIZE_MAX,
 
        .check_func = submission_settings_verify,
        .dependencies = submission_setting_dependencies
index bd19e78a9fb40259fbb0f6bee83715f628cb65cf..6a439791f1d3679b03592bee15b838689d2f601e 100644 (file)
@@ -277,7 +277,7 @@ rawlog_proxy_create(int client_in_fd, int client_out_fd, int server_fd,
 
        proxy = i_new(struct rawlog_proxy, 1);
        proxy->server_fd = server_fd;
-       proxy->server_output = o_stream_create_fd(server_fd, (size_t)-1);
+       proxy->server_output = o_stream_create_fd(server_fd, SIZE_MAX);
        o_stream_set_no_error_handling(proxy->server_output, TRUE);
        o_stream_set_flush_callback(proxy->server_output, server_output, proxy);
        proxy->server_io = io_add(server_fd, IO_READ, server_input, proxy);
@@ -285,7 +285,7 @@ rawlog_proxy_create(int client_in_fd, int client_out_fd, int server_fd,
        proxy->client_in_fd = client_in_fd;
        proxy->client_out_fd = client_out_fd;
        proxy->client_output =
-               o_stream_create_fd(client_out_fd, (size_t)-1);
+               o_stream_create_fd(client_out_fd, SIZE_MAX);
        o_stream_set_no_error_handling(proxy->client_output, TRUE);
        proxy->client_io = io_add(proxy->client_in_fd, IO_READ,
                                  client_input, proxy);