mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-04-11 10:34:55 +02:00
Compiler warning fixes
This commit is contained in:
parent
567d1bbf91
commit
7de6cb42ef
|
|
@ -21,7 +21,6 @@ Contributors:
|
|||
#include <arpa/inet.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <editline/readline.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ extern "C" {
|
|||
|
||||
#include <cjson/cJSON.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
extern const char *ANSI_URL;
|
||||
extern const char *ANSI_MODULE;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ static bool is_username_valid(const char *username)
|
|||
return false;
|
||||
}
|
||||
for(i=0; i<slen; i++){
|
||||
if(iscntrl(username[i])){
|
||||
if(iscntrl((unsigned char)username[i])){
|
||||
fprintf(stderr, "Error: Username must not contain control characters.\n");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ Contributors:
|
|||
|
||||
int packet__alloc(struct mosquitto__packet **packet, uint8_t command, uint32_t remaining_length)
|
||||
{
|
||||
uint8_t remaining_bytes[5], byte;
|
||||
uint8_t remaining_bytes[5] = {0}, byte;
|
||||
int8_t remaining_count;
|
||||
uint32_t packet_length;
|
||||
uint32_t remaining_length_stored;
|
||||
|
|
|
|||
|
|
@ -262,11 +262,11 @@ char *mosquitto_trimblanks(char *str)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
while(isspace(str[0])){
|
||||
while(isspace((unsigned char)str[0])){
|
||||
str++;
|
||||
}
|
||||
endptr = &str[strlen(str)-1];
|
||||
while(endptr > str && isspace(endptr[0])){
|
||||
while(endptr > str && isspace((unsigned char)endptr[0])){
|
||||
endptr[0] = '\0';
|
||||
endptr--;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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--;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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){
|
||||
|
|
|
|||
Loading…
Reference in a new issue