Fix signed/unsigned comparion warnings.

Closes #1196.
pull/1203/head
Roger A. Light 7 years ago
parent b82370a997
commit 0941638143

@ -1179,11 +1179,11 @@ static int mosquitto__urldecode(char *str)
static int mosquitto__parse_socks_url(struct mosq_config *cfg, char *url) static int mosquitto__parse_socks_url(struct mosq_config *cfg, char *url)
{ {
char *str; char *str;
int i; size_t i;
char *username = NULL, *password = NULL, *host = NULL, *port = NULL; char *username = NULL, *password = NULL, *host = NULL, *port = NULL;
char *username_or_host = NULL; char *username_or_host = NULL;
int start; size_t start;
int len; size_t len;
bool have_auth = false; bool have_auth = false;
int port_int; int port_int;

@ -153,7 +153,7 @@ int packet__queue(struct mosquitto *mosq, struct mosquitto__packet *packet)
int packet__check_oversize(struct mosquitto *mosq, uint32_t remaining_length) int packet__check_oversize(struct mosquitto *mosq, uint32_t remaining_length)
{ {
int len; uint32_t len;
if(mosq->maximum_packet_size == 0) return MOSQ_ERR_SUCCESS; if(mosq->maximum_packet_size == 0) return MOSQ_ERR_SUCCESS;

@ -390,7 +390,7 @@ int socks5__read(struct mosquitto *mosq)
mosq->in_packet.to_process += 16+2-1; /* 16 bytes IPv6, 2 bytes port, -1 byte because we've already read the first byte */ mosq->in_packet.to_process += 16+2-1; /* 16 bytes IPv6, 2 bytes port, -1 byte because we've already read the first byte */
mosq->in_packet.packet_length += 16+2-1; mosq->in_packet.packet_length += 16+2-1;
}else if(mosq->in_packet.payload[3] == SOCKS_ATYPE_DOMAINNAME){ }else if(mosq->in_packet.payload[3] == SOCKS_ATYPE_DOMAINNAME){
if(mosq->in_packet.payload[4] > 0 && mosq->in_packet.payload[4] <= 255){ if(mosq->in_packet.payload[4] > 0){
mosq->in_packet.to_process += mosq->in_packet.payload[4]; mosq->in_packet.to_process += mosq->in_packet.payload[4];
mosq->in_packet.packet_length += mosq->in_packet.payload[4]; mosq->in_packet.packet_length += mosq->in_packet.payload[4];
} }

@ -169,7 +169,7 @@ int mosquitto__hex2bin(const char *hex, unsigned char *bin, int bin_max_len)
int len; int len;
int leading_zero = 0; int leading_zero = 0;
int start = 0; int start = 0;
int i = 0; size_t i = 0;
/* Count the number of leading zero */ /* Count the number of leading zero */
for(i=0; i<strlen(hex); i=i+2) { for(i=0; i<strlen(hex); i=i+2) {

@ -63,7 +63,7 @@ int mosquitto_pub_topic_check(const char *str)
int mosquitto_pub_topic_check2(const char *str, size_t len) int mosquitto_pub_topic_check2(const char *str, size_t len)
{ {
int i; size_t i;
if(len > 65535) return MOSQ_ERR_INVAL; if(len > 65535) return MOSQ_ERR_INVAL;
@ -109,7 +109,7 @@ int mosquitto_sub_topic_check(const char *str)
int mosquitto_sub_topic_check2(const char *str, size_t len) int mosquitto_sub_topic_check2(const char *str, size_t len)
{ {
char c = '\0'; char c = '\0';
int i; size_t i;
if(len > 65535) return MOSQ_ERR_INVAL; if(len > 65535) return MOSQ_ERR_INVAL;
@ -149,8 +149,8 @@ int mosquitto_topic_matches_sub(const char *sub, const char *topic, bool *result
/* Does a topic match a subscription? */ /* Does a topic match a subscription? */
int mosquitto_topic_matches_sub2(const char *sub, size_t sublen, const char *topic, size_t topiclen, bool *result) int mosquitto_topic_matches_sub2(const char *sub, size_t sublen, const char *topic, size_t topiclen, bool *result)
{ {
int i; size_t i;
int spos, tpos; size_t spos, tpos;
bool multilevel_wildcard = false; bool multilevel_wildcard = false;
if(!result) return MOSQ_ERR_INVAL; if(!result) return MOSQ_ERR_INVAL;

@ -64,7 +64,7 @@ static unsigned char tmpfile_path[36];
static FILE *mpw_tmpfile(void) static FILE *mpw_tmpfile(void)
{ {
int fd; int fd;
int i; size_t i;
if(RAND_bytes(tmpfile_path, sizeof(tmpfile_path)) != 1){ if(RAND_bytes(tmpfile_path, sizeof(tmpfile_path)) != 1){
return NULL; return NULL;
@ -356,7 +356,7 @@ int get_password(char *password, int len)
int copy_contents(FILE *src, FILE *dest) int copy_contents(FILE *src, FILE *dest)
{ {
char buf[MAX_BUFFER_LEN]; char buf[MAX_BUFFER_LEN];
int len; size_t len;
rewind(src); rewind(src);
rewind(dest); rewind(dest);

@ -840,7 +840,7 @@ static int psk__file_parse(struct mosquitto_db *db, struct mosquitto__unpwd **ps
#ifdef WITH_TLS #ifdef WITH_TLS
static int mosquitto__memcmp_const(const void *a, const void *b, size_t len) static int mosquitto__memcmp_const(const void *a, const void *b, size_t len)
{ {
int i; size_t i;
int rc = 0; int rc = 0;
if(!a || !b) return 1; if(!a || !b) return 1;

@ -57,13 +57,13 @@ void sys_tree__init(struct mosquitto_db *db)
static void sys_tree__update_clients(struct mosquitto_db *db, char *buf) static void sys_tree__update_clients(struct mosquitto_db *db, char *buf)
{ {
static unsigned int client_count = -1; static int client_count = -1;
static int clients_expired = -1; static int clients_expired = -1;
static unsigned int client_max = 0; static int client_max = 0;
static int disconnected_count = -1; static int disconnected_count = -1;
static int connected_count = -1; static int connected_count = -1;
unsigned int count_total, count_by_sock; int count_total, count_by_sock;
count_total = HASH_CNT(hh_id, db->contexts_by_id); count_total = HASH_CNT(hh_id, db->contexts_by_id);
count_by_sock = HASH_CNT(hh_sock, db->contexts_by_sock); count_by_sock = HASH_CNT(hh_sock, db->contexts_by_sock);

Loading…
Cancel
Save