diff --git a/apps/mosquitto_ctrl/ctrl_shell.c b/apps/mosquitto_ctrl/ctrl_shell.c index 1cf30f5b..c3315d58 100644 --- a/apps/mosquitto_ctrl/ctrl_shell.c +++ b/apps/mosquitto_ctrl/ctrl_shell.c @@ -21,7 +21,6 @@ Contributors: #include #include #include -#include #include #include #include @@ -131,7 +130,7 @@ static void term_set_canon(bool canon) void ctrl_shell_rtrim(char *buf) { size_t slen = strlen(buf); - while(slen > 0 && isspace(buf[slen-1])){ + while(slen > 0 && isspace((unsigned char)buf[slen-1])){ buf[slen-1] = '\0'; slen = strlen(buf); } diff --git a/apps/mosquitto_ctrl/ctrl_shell.h b/apps/mosquitto_ctrl/ctrl_shell.h index 0acb5ff1..ee1e6dd1 100644 --- a/apps/mosquitto_ctrl/ctrl_shell.h +++ b/apps/mosquitto_ctrl/ctrl_shell.h @@ -24,6 +24,7 @@ extern "C" { #include #include +#include extern const char *ANSI_URL; extern const char *ANSI_MODULE; diff --git a/apps/mosquitto_ctrl/ctrl_shell_dynsec.c b/apps/mosquitto_ctrl/ctrl_shell_dynsec.c index 200cfe65..d15b6e8b 100644 --- a/apps/mosquitto_ctrl/ctrl_shell_dynsec.c +++ b/apps/mosquitto_ctrl/ctrl_shell_dynsec.c @@ -795,7 +795,7 @@ static void print_details(cJSON *j_data) int64_t groupcount; int64_t rolecount; int64_t changeindex; - int align = strlen("Change index: "); + int align = (int)strlen("Change index: "); json_get_int64(j_data, "clientCount", &clientcount, true, 0); json_get_int64(j_data, "groupCount", &groupcount, true, 0); json_get_int64(j_data, "roleCount", &rolecount, true, 0); diff --git a/apps/mosquitto_ctrl/dynsec.c b/apps/mosquitto_ctrl/dynsec.c index fdb6c6ce..b6ee50b2 100644 --- a/apps/mosquitto_ctrl/dynsec.c +++ b/apps/mosquitto_ctrl/dynsec.c @@ -184,7 +184,7 @@ static void print_json_array(cJSON *j_list, int slen, const char *label, const c static void print_client(cJSON *j_response) { cJSON *j_data, *j_client, *jtmp; - const int label_width = strlen("Connections:"); + const int label_width = (int)strlen("Connections:"); j_data = cJSON_GetObjectItem(j_response, "data"); if(j_data == NULL || !cJSON_IsObject(j_data)){ @@ -226,7 +226,7 @@ static void print_client(cJSON *j_response) static void print_group(cJSON *j_response) { cJSON *j_data, *j_group; - int label_width = strlen("Groupname:"); + int label_width = (int)strlen("Groupname:"); const char *groupname; j_data = cJSON_GetObjectItem(j_response, "data"); diff --git a/apps/mosquitto_passwd/mosquitto_passwd.c b/apps/mosquitto_passwd/mosquitto_passwd.c index f93a7ff1..f7d21d1a 100644 --- a/apps/mosquitto_passwd/mosquitto_passwd.c +++ b/apps/mosquitto_passwd/mosquitto_passwd.c @@ -413,7 +413,7 @@ static bool is_username_valid(const char *username) return false; } for(i=0; i str && isspace(endptr[0])){ + while(endptr > str && isspace((unsigned char)endptr[0])){ endptr[0] = '\0'; endptr--; } diff --git a/plugins/acl-file/acl_parse.c b/plugins/acl-file/acl_parse.c index c9fd8a91..0547fd17 100644 --- a/plugins/acl-file/acl_parse.c +++ b/plugins/acl-file/acl_parse.c @@ -213,7 +213,7 @@ int acl_file__parse(struct acl_file_data *data) while(mosquitto_fgets(&buf, &buflen, aclfptr)){ slen = strlen(buf); - while(slen > 0 && isspace(buf[slen-1])){ + while(slen > 0 && isspace((unsigned char)buf[slen-1])){ buf[slen-1] = '\0'; slen = strlen(buf); } diff --git a/plugins/dynamic-security/config_init.c b/plugins/dynamic-security/config_init.c index f3821719..e1867663 100644 --- a/plugins/dynamic-security/config_init.c +++ b/plugins/dynamic-security/config_init.c @@ -82,7 +82,7 @@ static int get_password_from_init_file(struct dynsec__data *data, char **pw) fclose(fptr); pos = (int)strlen(buf)-1; - while(pos >= 0 && isspace(buf[pos])){ + while(pos >= 0 && isspace((unsigned char)buf[pos])){ buf[pos] = '\0'; pos--; } diff --git a/src/conf.c b/src/conf.c index b680b479..74f281e8 100644 --- a/src/conf.c +++ b/src/conf.c @@ -3003,7 +3003,7 @@ static int config__check(struct mosquitto__config *config) id_prefix_len = config->security_options.auto_id_prefix_len; }else{ id_prefix = "auto-"; - id_prefix_len = strlen("auto-"); + id_prefix_len = (int)strlen("auto-"); } /* Default to auto_id_prefix = 'auto-' if none set. */ diff --git a/src/conf_includedir.c b/src/conf_includedir.c index feee6a57..96127708 100644 --- a/src/conf_includedir.c +++ b/src/conf_includedir.c @@ -59,7 +59,7 @@ static int scmp_p(const void *p1, const void *p2) while(s1[0] && s2[0]){ /* Sort by case insensitive part first */ - result = toupper(s1[0]) - toupper(s2[0]); + result = toupper((unsigned char)s1[0]) - toupper((unsigned char)s2[0]); if(result == 0){ /* Case insensitive part matched, now distinguish between case */ result = s1[0] - s2[0]; diff --git a/src/control.c b/src/control.c index 0c8812ad..a17828df 100644 --- a/src/control.c +++ b/src/control.c @@ -41,7 +41,7 @@ static void control__negative_reply(const char *clientid, const char *request_to } snprintf(response_topic, response_topic_len, "%s/response", request_topic); - mosquitto_broker_publish_copy(clientid, response_topic, strlen(payload), payload, 0, false, NULL); + mosquitto_broker_publish_copy(clientid, response_topic, (int)strlen(payload), payload, 0, false, NULL); mosquitto_FREE(response_topic); } diff --git a/src/listeners.c b/src/listeners.c index c05d74ee..34c9a70c 100644 --- a/src/listeners.c +++ b/src/listeners.c @@ -172,7 +172,7 @@ static int listeners__add_local(const char *host, uint16_t port) mosquitto_FREE(listeners[db.config->listener_count].security_options); return MOSQ_ERR_NOMEM; } - listeners[db.config->listener_count].security_options->auto_id_prefix_len = strlen("auto-"); + listeners[db.config->listener_count].security_options->auto_id_prefix_len = (int)strlen("auto-"); listeners[db.config->listener_count].port = port; listeners[db.config->listener_count].host = mosquitto_strdup(host); if(listeners[db.config->listener_count].host == NULL){