Fixed some VS2017 compilation error and warnings (#1916)
* Fixed some VS2017 compilation errors and warnings. Signed-off-by: raspopov <raspopov@cherubicsoft.com>
This commit is contained in:
parent
2687d18214
commit
71845d28ac
@ -103,7 +103,7 @@ int mosquitto_loop(struct mosquitto *mosq, int timeout, int max_packets)
|
||||
/* sockpairR is used to break out of select() before the timeout, on a
|
||||
* call to publish() etc. */
|
||||
FD_SET(mosq->sockpairR, &readfds);
|
||||
if(mosq->sockpairR > maxfd){
|
||||
if((int)mosq->sockpairR > maxfd){
|
||||
maxfd = mosq->sockpairR;
|
||||
}
|
||||
}
|
||||
@ -246,7 +246,7 @@ static int interruptible_sleep(struct mosquitto *mosq, time_t reconnect_delay)
|
||||
int mosquitto_loop_forever(struct mosquitto *mosq, int timeout, int max_packets)
|
||||
{
|
||||
int run = 1;
|
||||
int rc;
|
||||
int rc = MOSQ_ERR_SUCCESS;
|
||||
unsigned long reconnect_delay;
|
||||
enum mosquitto_client_state state;
|
||||
|
||||
@ -361,7 +361,7 @@ static int mosquitto__loop_rc_handle(struct mosquitto *mosq, int rc)
|
||||
|
||||
int mosquitto_loop_read(struct mosquitto *mosq, int max_packets)
|
||||
{
|
||||
int rc;
|
||||
int rc = MOSQ_ERR_SUCCESS;
|
||||
int i;
|
||||
if(max_packets < 1) return MOSQ_ERR_INVAL;
|
||||
|
||||
@ -402,7 +402,7 @@ int mosquitto_loop_read(struct mosquitto *mosq, int max_packets)
|
||||
|
||||
int mosquitto_loop_write(struct mosquitto *mosq, int max_packets)
|
||||
{
|
||||
int rc;
|
||||
int rc = MOSQ_ERR_SUCCESS;
|
||||
int i;
|
||||
if(max_packets < 1) return MOSQ_ERR_INVAL;
|
||||
|
||||
|
@ -52,7 +52,7 @@ FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
|
||||
EXPLICIT_ACCESS_A ea;
|
||||
PACL pacl = NULL;
|
||||
char username[UNLEN + 1];
|
||||
int ulen = UNLEN;
|
||||
DWORD ulen = UNLEN;
|
||||
SECURITY_DESCRIPTOR sd;
|
||||
DWORD dwCreationDisposition;
|
||||
|
||||
|
@ -58,7 +58,7 @@ int mosquitto_lib_init(void)
|
||||
|
||||
if (init_refcount == 0) {
|
||||
#ifdef WIN32
|
||||
srand(GetTickCount64());
|
||||
srand((unsigned int)GetTickCount64());
|
||||
#elif _POSIX_TIMERS>0 && defined(_POSIX_MONOTONIC_CLOCK)
|
||||
struct timespec tp;
|
||||
|
||||
@ -348,7 +348,7 @@ int mosquitto_sub_topic_tokenise(const char *subtopic, char ***topics, int *coun
|
||||
size_t len;
|
||||
size_t hier_count = 1;
|
||||
size_t start, stop;
|
||||
int hier;
|
||||
size_t hier;
|
||||
size_t tlen;
|
||||
size_t i, j;
|
||||
|
||||
|
@ -397,6 +397,8 @@ static int net__try_connect_tcp(const char *host, uint16_t port, mosq_sock_t *so
|
||||
uint32_t val = 1;
|
||||
#endif
|
||||
|
||||
ainfo_bind = NULL;
|
||||
|
||||
*sock = INVALID_SOCKET;
|
||||
memset(&hints, 0, sizeof(struct addrinfo));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
@ -926,7 +928,7 @@ int net__socket_connect(struct mosquitto *mosq, const char *host, uint16_t port,
|
||||
|
||||
if(mosq->tcp_nodelay){
|
||||
int flag = 1;
|
||||
if(setsockopt(mosq->sock, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int)) != 0){
|
||||
if(setsockopt(mosq->sock, IPPROTO_TCP, TCP_NODELAY, (const void*)&flag, sizeof(int)) != 0){
|
||||
log__printf(mosq, MOSQ_LOG_WARNING, "Warning: Unable to set TCP_NODELAY.");
|
||||
}
|
||||
}
|
||||
|
@ -143,9 +143,9 @@ int send__connect(struct mosquitto *mosq, uint16_t keepalive, bool clean_session
|
||||
|
||||
/* Variable header */
|
||||
if(version == MQTT_PROTOCOL_V31){
|
||||
packet__write_string(packet, PROTOCOL_NAME_v31, strlen(PROTOCOL_NAME_v31));
|
||||
packet__write_string(packet, PROTOCOL_NAME_v31, (uint16_t)strlen(PROTOCOL_NAME_v31));
|
||||
}else{
|
||||
packet__write_string(packet, PROTOCOL_NAME, strlen(PROTOCOL_NAME));
|
||||
packet__write_string(packet, PROTOCOL_NAME, (uint16_t)strlen(PROTOCOL_NAME));
|
||||
}
|
||||
#if defined(WITH_BROKER) && defined(WITH_BRIDGE)
|
||||
if(mosq->bridge && mosq->bridge->protocol_version != mosq_p_mqtt5 && mosq->bridge->try_private && mosq->bridge->try_private_accepted){
|
||||
|
Loading…
Reference in New Issue
Block a user