From: Karl Fleischmann Date: Mon, 30 Jan 2023 15:35:56 +0000 (+0100) Subject: global: Complete unsigned int declarations X-Git-Tag: 2.4.0~3021 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15298bfcb65de66802bc03d1fccb3a51f6315f9e;p=thirdparty%2Fdovecot%2Fcore.git global: Complete unsigned int declarations To be more consistent with the rest of the code base and because of code quality reasons this commit adds the "int" keyword that is theoretically optional for unsigned integer types. --- diff --git a/src/auth/db-ldap.c b/src/auth/db-ldap.c index 9df49e920b..2050c4df28 100644 --- a/src/auth/db-ldap.c +++ b/src/auth/db-ldap.c @@ -988,7 +988,7 @@ static void ldap_input(struct ldap_connection *conn) #ifdef HAVE_LDAP_SASL static int -sasl_interact(LDAP *ld ATTR_UNUSED, unsigned flags ATTR_UNUSED, +sasl_interact(LDAP *ld ATTR_UNUSED, unsigned int flags ATTR_UNUSED, void *defaults, void *interact) { struct db_ldap_sasl_bind_context *context = defaults; diff --git a/src/config/old-set-parser.c b/src/config/old-set-parser.c index b790e86b47..b61acfe872 100644 --- a/src/config/old-set-parser.c +++ b/src/config/old-set-parser.c @@ -91,7 +91,7 @@ static int ssl_protocols_to_min_protocol(const char *ssl_protocols, enable = FALSE; ++p; } - for (unsigned i = 0; i < N_ELEMENTS(protocol_versions); i++) { + for (unsigned int i = 0; i < N_ELEMENTS(protocol_versions); i++) { if (strcmp(p, protocol_versions[i]) == 0) { if (enable) { protos[i] = 1; @@ -108,8 +108,8 @@ static int ssl_protocols_to_min_protocol(const char *ssl_protocols, found:; } - unsigned min = N_ELEMENTS(protocol_versions); - for (unsigned i = 0; i < N_ELEMENTS(protocol_versions); i++) { + unsigned int min = N_ELEMENTS(protocol_versions); + for (unsigned int i = 0; i < N_ELEMENTS(protocol_versions); i++) { if (explicit_enable) { if (protos[i] > 0) min = I_MIN(min, i); diff --git a/src/doveadm/test-doveadm-util.c b/src/doveadm/test-doveadm-util.c index 8756f8ad5d..872646165d 100644 --- a/src/doveadm/test-doveadm-util.c +++ b/src/doveadm/test-doveadm-util.c @@ -10,7 +10,7 @@ struct doveadm_settings *doveadm_settings; /* just to avoid linker error */ bool version_string_verify(const char *line ATTR_UNUSED, const char *service_name ATTR_UNUSED, - unsigned major_version ATTR_UNUSED) + unsigned int major_version ATTR_UNUSED) { return FALSE; } diff --git a/src/lib-dict-backend/dict-cdb.c b/src/lib-dict-backend/dict-cdb.c index c35fb1be9b..66329a5ef3 100644 --- a/src/lib-dict-backend/dict-cdb.c +++ b/src/lib-dict-backend/dict-cdb.c @@ -28,7 +28,7 @@ struct cdb_dict_iterate_context { buffer_t *buffer; const char *values[2]; char *path; - unsigned cptr; + unsigned int cptr; char *error; }; @@ -91,20 +91,20 @@ cdb_dict_lookup(struct dict *_dict, const char **error_r) { struct cdb_dict *dict = (struct cdb_dict *)_dict; - unsigned datalen; + unsigned int datalen; int ret = 0; char *data; /* keys and values may be null terminated... */ if ((dict->flag & CDB_WITH_NULL) != 0) { - ret = cdb_find(&dict->cdb, key, (unsigned)strlen(key)+1); + ret = cdb_find(&dict->cdb, key, (unsigned int)strlen(key)+1); if (ret > 0) dict->flag &= ENUM_NEGATE(CDB_WITHOUT_NULL); } /* ...or not */ if (ret == 0 && (dict->flag & CDB_WITHOUT_NULL) != 0) { - ret = cdb_find(&dict->cdb, key, (unsigned)strlen(key)); + ret = cdb_find(&dict->cdb, key, (unsigned int)strlen(key)); if (ret > 0) dict->flag &= ENUM_NEGATE(CDB_WITH_NULL); } @@ -155,7 +155,7 @@ cdb_dict_next(struct cdb_dict_iterate_context *ctx, const char **key_r) { struct cdb_dict *dict = (struct cdb_dict *)ctx->ctx.dict; char *data; - unsigned datalen; + unsigned int datalen; int ret; if ((ret = cdb_seqnext(&ctx->cptr, &dict->cdb)) < 1) { @@ -191,7 +191,7 @@ static bool cdb_dict_iterate(struct dict_iterate_context *_ctx, const char *key; bool match = FALSE; char *data; - unsigned datalen; + unsigned int datalen; if (ctx->error != NULL) return FALSE; diff --git a/src/lib-dict/dict-client.c b/src/lib-dict/dict-client.c index d175009f5d..85c3318fd9 100644 --- a/src/lib-dict/dict-client.c +++ b/src/lib-dict/dict-client.c @@ -74,7 +74,7 @@ struct client_dict { char *uri; enum dict_data_type value_type; - unsigned warn_slow_msecs; + unsigned int warn_slow_msecs; time_t last_failed_connect; char *last_connect_error; diff --git a/src/lib-dict/dict-iter-lua.c b/src/lib-dict/dict-iter-lua.c index 780de0316a..ef4e05c2d5 100644 --- a/src/lib-dict/dict-iter-lua.c +++ b/src/lib-dict/dict-iter-lua.c @@ -54,7 +54,7 @@ static int lua_dict_iterate_step(lua_State *L) { struct lua_dict_iter *iter; const int *refs; - unsigned nrefs; + unsigned int nrefs; DLUA_REQUIRE_ARGS(L, 2); diff --git a/src/lib-http/http-client.c b/src/lib-http/http-client.c index 22c2e1d6d6..7e14b556c0 100644 --- a/src/lib-http/http-client.c +++ b/src/lib-http/http-client.c @@ -597,7 +597,7 @@ http_client_context_update_settings(struct http_client_context *cctx) /* Override with available client settings */ for (client = cctx->clients_list; client != NULL; client = client->next) { - unsigned dns_lookup_timeout_msecs = + unsigned int dns_lookup_timeout_msecs = http_client_get_dns_lookup_timeout_msecs(&client->set); if (cctx->dns_client == NULL) diff --git a/src/lib-http/test-http-payload.c b/src/lib-http/test-http-payload.c index d93d86ebab..43a0e0e44d 100644 --- a/src/lib-http/test-http-payload.c +++ b/src/lib-http/test-http-payload.c @@ -71,9 +71,9 @@ static struct ip_addr bind_ip; static in_port_t bind_port = 0; static int fd_listen = -1; static struct ioloop *ioloop_nested = NULL; -static unsigned ioloop_nested_first = 0; -static unsigned ioloop_nested_last = 0; -static unsigned ioloop_nested_depth = 0; +static unsigned int ioloop_nested_first = 0; +static unsigned int ioloop_nested_last = 0; +static unsigned int ioloop_nested_depth = 0; static void main_deinit(void); diff --git a/src/lib-imap/imap-keepalive.c b/src/lib-imap/imap-keepalive.c index 0756ce8b55..15d4cc1338 100644 --- a/src/lib-imap/imap-keepalive.c +++ b/src/lib-imap/imap-keepalive.c @@ -14,7 +14,7 @@ static bool imap_remote_ip_is_usable(const struct ip_addr *ip) if (ip->family == 0) return FALSE; if (ip->family == AF_INET) { -#define IP4(a,b,c,d) ((unsigned)(a)<<24|(unsigned)(b)<<16|(unsigned)(c)<<8|(unsigned)(d)) +#define IP4(a,b,c,d) ((unsigned int)(a)<<24|(unsigned int)(b)<<16|(unsigned int)(c)<<8|(unsigned int)(d)) addr = ip->u.ip4.s_addr; if (addr >= IP4(10,0,0,0) && addr <= IP4(10,255,255,255)) return FALSE; /* 10/8 */ diff --git a/src/lib-index/mail-cache-sync-update.c b/src/lib-index/mail-cache-sync-update.c index 90731876f7..38a748b37f 100644 --- a/src/lib-index/mail-cache-sync-update.c +++ b/src/lib-index/mail-cache-sync-update.c @@ -5,7 +5,7 @@ #include "mail-index-sync-private.h" struct mail_cache_sync_context { - unsigned expunge_count; + unsigned int expunge_count; }; void mail_cache_expunge_count(struct mail_cache *cache, unsigned int count) diff --git a/src/lib-lua/dlua-wrapper.h b/src/lib-lua/dlua-wrapper.h index 3a9f459f24..7af1e80bdf 100644 --- a/src/lib-lua/dlua-wrapper.h +++ b/src/lib-lua/dlua-wrapper.h @@ -158,7 +158,7 @@ static void xlua_push##typename(lua_State *state, type *ptr, bool ro) \ \ index = NULL; \ if (extra_fxns != NULL) { \ - unsigned i; \ + unsigned int i; \ \ luaL_setfuncs(state, extra_fxns, 0); \ \ diff --git a/src/lib-master/master-service.c b/src/lib-master/master-service.c index 932d10a0f4..5261589a39 100644 --- a/src/lib-master/master-service.c +++ b/src/lib-master/master-service.c @@ -1951,7 +1951,7 @@ void master_status_update(struct master_service *service) } bool version_string_verify(const char *line, const char *service_name, - unsigned major_version) + unsigned int major_version) { unsigned int minor_version; @@ -1960,7 +1960,7 @@ bool version_string_verify(const char *line, const char *service_name, } bool version_string_verify_full(const char *line, const char *service_name, - unsigned major_version, + unsigned int major_version, unsigned int *minor_version_r) { size_t service_name_len = strlen(service_name); diff --git a/src/lib-master/master-service.h b/src/lib-master/master-service.h index 7bb0a97c3d..4a10ce5747 100644 --- a/src/lib-master/master-service.h +++ b/src/lib-master/master-service.h @@ -277,10 +277,10 @@ void master_service_deinit_forked(struct master_service **_service); The line is expected to be in format: VERSION service_name major version minor version */ bool version_string_verify(const char *line, const char *service_name, - unsigned major_version); + unsigned int major_version); /* Same as version_string_verify(), but return the minor version. */ bool version_string_verify_full(const char *line, const char *service_name, - unsigned major_version, + unsigned int major_version, unsigned int *minor_version_r); /* Sets process shutdown filter */ diff --git a/src/lib-ssl-iostream/iostream-openssl-common.c b/src/lib-ssl-iostream/iostream-openssl-common.c index 3ffa1ef394..3d7993ba99 100644 --- a/src/lib-ssl-iostream/iostream-openssl-common.c +++ b/src/lib-ssl-iostream/iostream-openssl-common.c @@ -54,7 +54,7 @@ static const struct { int openssl_min_protocol_to_options(const char *min_protocol, long *opt_r, int *version_r) { - unsigned i = 0; + unsigned int i = 0; for (; i < N_ELEMENTS(protocol_versions); i++) { if (strcasecmp(protocol_versions[i].name, min_protocol) == 0) break; diff --git a/src/lib/bits.h b/src/lib/bits.h index 2e84755be0..4a74cad303 100644 --- a/src/lib/bits.h +++ b/src/lib/bits.h @@ -139,7 +139,7 @@ bits_rotr32(uint32_t num, unsigned int count) static inline unsigned int ATTR_CONST bits_fraclog(unsigned int val, unsigned int fracbits) { - unsigned bits = bits_required32(val); + unsigned int bits = bits_required32(val); if (bits <= fracbits + 1) return val; diff --git a/src/lib/json-parser.c b/src/lib/json-parser.c index a21187b764..459833c98d 100644 --- a/src/lib/json-parser.c +++ b/src/lib/json-parser.c @@ -436,7 +436,7 @@ static int json_parse_atom(struct json_parser *parser, const char *atom) static int json_parse_denest(struct json_parser *parser) { const enum json_state *nested_states; - unsigned count; + unsigned int count; parser->data++; json_parser_update_input_pos(parser); diff --git a/src/lib/test-time-util.c b/src/lib/test-time-util.c index 9e23e69419..375f8b8194 100644 --- a/src/lib/test-time-util.c +++ b/src/lib/test-time-util.c @@ -262,7 +262,7 @@ static void test_time_to_local_day_start(void) time_t t; test_begin("time_to_local_day_start()"); - for (unsigned i = 0; i < N_ELEMENTS(tests); i++) { + for (unsigned int i = 0; i < N_ELEMENTS(tests); i++) { tm_copy = tests[i]; tm_copy.tm_isdst = -1; t = mktime(&tm_copy); @@ -283,12 +283,12 @@ static void test_timestamp(const char *ts, int idx) { /* %G:%H:%M:%S */ const char **t = t_strsplit(ts, ":"); - unsigned len = str_array_length(t); + unsigned int len = str_array_length(t); test_assert_idx(len == 4, idx); /* %G - ISO 8601 year */ test_assert_idx(strlen(t[0]) == 4, idx); - unsigned v = 0; + unsigned int v = 0; test_assert_idx(str_to_uint(t[0], &v) == 0, idx); test_assert_idx(1000 <= v, idx); test_assert_idx(v <= 3000, idx); diff --git a/src/plugins/fts-solr/test-solr-response.c b/src/plugins/fts-solr/test-solr-response.c index 733e62c269..22bb6cd780 100644 --- a/src/plugins/fts-solr/test-solr-response.c +++ b/src/plugins/fts-solr/test-solr-response.c @@ -139,7 +139,7 @@ static const struct solr_response_test tests[] = { }, }; -static const unsigned tests_count = N_ELEMENTS(tests); +static const unsigned int tests_count = N_ELEMENTS(tests); static void test_solr_result(const struct solr_response_test_result *test_results, diff --git a/src/plugins/fts/fts-expunge-log.c b/src/plugins/fts/fts-expunge-log.c index 2ae56def08..c18f85ced3 100644 --- a/src/plugins/fts/fts-expunge-log.c +++ b/src/plugins/fts/fts-expunge-log.c @@ -41,7 +41,7 @@ struct fts_expunge_log { struct fts_expunge_log_mailbox { guid_128_t guid; ARRAY_TYPE(seq_range) uids; - unsigned uids_count; + unsigned int uids_count; }; struct fts_expunge_log_append_ctx { diff --git a/src/plugins/pop3-migration/pop3-migration-plugin.c b/src/plugins/pop3-migration/pop3-migration-plugin.c index f81f37ba05..19320bb125 100644 --- a/src/plugins/pop3-migration/pop3-migration-plugin.c +++ b/src/plugins/pop3-migration/pop3-migration-plugin.c @@ -539,7 +539,7 @@ map_read_hdr_hashes(struct mailbox *box, struct array *msg_map, uint32_t seq1) static int pop3_map_read_hdr_hashes(struct mail_storage *storage, struct mailbox *pop3_box, - unsigned first_seq) + unsigned int first_seq) { struct pop3_migration_mail_storage *mstorage = POP3_MIGRATION_CONTEXT_REQUIRE(storage); diff --git a/src/stats/event-exporter-transport-http-post.c b/src/stats/event-exporter-transport-http-post.c index cd8a941469..291c54c673 100644 --- a/src/stats/event-exporter-transport-http-post.c +++ b/src/stats/event-exporter-transport-http-post.c @@ -23,7 +23,7 @@ static void response_fxn(const struct http_response *response, void *context ATTR_UNUSED) { static time_t last_log; - static unsigned suppressed; + static unsigned int suppressed; if (http_response_is_success(response)) return;