diff src/director/doveadm-connection.c @ 15904:d3cf06639864

Replaced all -1U and (unsigned int)-1 with UINT_MAX. It's somewhat clearer this way. Also clang's -fsanitize=integer gives runtime errors about -1U (but not about explicit casts, so no need to change (type)-1 casts).
author Timo Sirainen <tss@iki.fi>
date Sun, 24 Feb 2013 09:16:31 +0200
parents 36ef72481934
children add8c00fb3cc
line wrap: on
line diff
--- a/src/director/doveadm-connection.c	Sun Feb 24 08:58:03 2013 +0200
+++ b/src/director/doveadm-connection.c	Sun Feb 24 09:16:31 2013 +0200
@@ -189,7 +189,7 @@
 	const char *const *args;
 	struct mail_host *host;
 	struct ip_addr ip;
-	unsigned int vhost_count = -1U;
+	unsigned int vhost_count = UINT_MAX;
 
 	args = t_strsplit_tab(line);
 	if (args[0] == NULL ||
@@ -198,14 +198,14 @@
 		i_error("doveadm sent invalid HOST-SET parameters: %s", line);
 		return FALSE;
 	}
-	if (vhost_count > MAX_VALID_VHOST_COUNT && vhost_count != -1U) {
+	if (vhost_count > MAX_VALID_VHOST_COUNT && vhost_count != UINT_MAX) {
 		o_stream_nsend_str(conn->output, "vhost count too large\n");
 		return TRUE;
 	}
 	host = mail_host_lookup(dir->mail_hosts, &ip);
 	if (host == NULL)
 		host = mail_host_add_ip(dir->mail_hosts, &ip);
-	if (vhost_count != -1U)
+	if (vhost_count != UINT_MAX)
 		mail_host_set_vhost_count(dir->mail_hosts, host, vhost_count);
 	director_update_host(dir, dir->self_host, NULL, host);