Build fixes, particularly pedantic compiler warnings.

pull/2573/head
Roger A. Light 3 years ago
parent 29f49bf6ab
commit 546df9db85

@ -88,7 +88,7 @@
#endif #endif
#define WS_IS_LWS 1 #define WS_IS_LWS 1
#define WS_IS_WSLAY 2 #define WS_IS_BUILTIN 2
#ifdef WITH_BROKER #ifdef WITH_BROKER
# ifdef __GNUC__ # ifdef __GNUC__

@ -26,6 +26,7 @@ Contributors:
#include "mosquitto_internal.h" #include "mosquitto_internal.h"
#include "base64_mosq.h" #include "base64_mosq.h"
#include "http_client.h"
#include "memory_mosq.h" #include "memory_mosq.h"
#include "mqtt_protocol.h" #include "mqtt_protocol.h"
#include "net_mosq.h" #include "net_mosq.h"

@ -243,7 +243,7 @@ struct mosquitto_msg_data{
#define WS_PING 0x09 #define WS_PING 0x09
#define WS_PONG 0x0A #define WS_PONG 0x0A
#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == LWS_IS_BUILTIN #if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_BUILTIN
struct ws_data{ struct ws_data{
struct mosquitto__packet *out_packet; struct mosquitto__packet *out_packet;
char *http_path; char *http_path;
@ -281,7 +281,7 @@ struct mosquitto {
struct gaicb *adns; /* For getaddrinfo_a */ struct gaicb *adns; /* For getaddrinfo_a */
#endif #endif
uint64_t last_cmsg_id; uint64_t last_cmsg_id;
#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == LWS_IS_BUILTIN #if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_BUILTIN
struct ws_data wsd; struct ws_data wsd;
#endif #endif
enum mosquitto__protocol protocol; enum mosquitto__protocol protocol;

@ -204,7 +204,7 @@ static ssize_t read_ws_payloadlen_extended(struct mosquitto *mosq)
} }
ssize_t read_ws_mask(struct mosquitto *mosq) static ssize_t read_ws_mask(struct mosquitto *mosq)
{ {
ssize_t len; ssize_t len;

@ -504,7 +504,7 @@ int mosquitto_int_option(struct mosquitto *mosq, enum mosq_opt_t option, int val
break; break;
case MOSQ_OPT_TRANSPORT: case MOSQ_OPT_TRANSPORT:
#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == LWS_IS_BUILTIN #if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_BUILTIN
if(value == mosq_t_tcp || value == mosq_t_ws){ if(value == mosq_t_tcp || value == mosq_t_ws){
mosq->transport = (uint8_t)value; mosq->transport = (uint8_t)value;
}else{ }else{
@ -516,7 +516,7 @@ int mosquitto_int_option(struct mosquitto *mosq, enum mosq_opt_t option, int val
break; break;
case MOSQ_OPT_HTTP_HEADER_SIZE: case MOSQ_OPT_HTTP_HEADER_SIZE:
#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == LWS_IS_BUILTIN #if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_BUILTIN
if(value < 100){ /* arbitrary limit */ if(value < 100){ /* arbitrary limit */
return MOSQ_ERR_INVAL; return MOSQ_ERR_INVAL;
}else if(mosq->http_request){ }else if(mosq->http_request){

@ -1,3 +1,5 @@
#include "config.h"
#include "plugin_common.h" #include "plugin_common.h"
#include "json_help.h" #include "json_help.h"
#include <mqtt_protocol.h> #include <mqtt_protocol.h>

@ -224,7 +224,7 @@ void context__disconnect(struct mosquitto *context)
return; return;
} }
#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == LWS_IS_BUILTIN #if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_BUILTIN
if(context->transport == mosq_t_ws){ if(context->transport == mosq_t_ws){
uint8_t buf[4] = {0x88, 0x02, 0x03, context->wsd.disconnect_reason}; uint8_t buf[4] = {0x88, 0x02, 0x03, context->wsd.disconnect_reason};
/* Send the disconnect reason, but don't care if it fails */ /* Send the disconnect reason, but don't care if it fails */

@ -57,7 +57,7 @@ Contributors:
extern int g_run; extern int g_run;
#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_WEBSOCKETS && LWS_LIBRARY_VERSION_NUMBER == 3002000 #if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_LWS && LWS_LIBRARY_VERSION_NUMBER == 3002000
void lws__sul_callback(struct lws_sorted_usec_list *l) void lws__sul_callback(struct lws_sorted_usec_list *l)
{ {
} }
@ -175,7 +175,7 @@ int mosquitto_main_loop(struct mosquitto__listener_sock *listensock, int listens
int rc; int rc;
#if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_WEBSOCKETS && LWS_LIBRARY_VERSION_NUMBER == 3002000 #if defined(WITH_WEBSOCKETS) && WITH_WEBSOCKETS == WS_IS_LWS && LWS_LIBRARY_VERSION_NUMBER == 3002000
memset(&sul, 0, sizeof(struct lws_sorted_usec_list)); memset(&sul, 0, sizeof(struct lws_sorted_usec_list));
#endif #endif

@ -977,7 +977,6 @@ int http__context_init(struct mosquitto *context);
int http__context_cleanup(struct mosquitto *context); int http__context_cleanup(struct mosquitto *context);
int http__read(struct mosquitto *context); int http__read(struct mosquitto *context);
int http__write(struct mosquitto *context); int http__write(struct mosquitto *context);
void ws__context_init(struct mosquitto *context);
#endif #endif
void do_disconnect(struct mosquitto *context, int reason); void do_disconnect(struct mosquitto *context, int reason);

@ -323,6 +323,7 @@ BROKER_EXPORT int mosquitto_set_clientid(struct mosquitto *client, const char *c
struct mosquitto *found_client; struct mosquitto *found_client;
char *id_dup; char *id_dup;
bool in_by_id; bool in_by_id;
int clientid_len;
if(!client || !clientid) return MOSQ_ERR_INVAL; if(!client || !clientid) return MOSQ_ERR_INVAL;
@ -343,7 +344,7 @@ BROKER_EXPORT int mosquitto_set_clientid(struct mosquitto *client, const char *c
} }
} }
int clientid_len = (int)strlen(clientid); clientid_len = (int)strlen(clientid);
if(mosquitto_validate_utf8(clientid, clientid_len)){ if(mosquitto_validate_utf8(clientid, clientid_len)){
return MOSQ_ERR_INVAL; return MOSQ_ERR_INVAL;
} }
@ -601,7 +602,7 @@ BROKER_EXPORT int mosquitto_persist_client_delete(const char *client_id)
} }
struct mosquitto_base_msg *find_store_msg(uint64_t store_id) static struct mosquitto_base_msg *find_store_msg(uint64_t store_id)
{ {
struct mosquitto_base_msg *base_msg; struct mosquitto_base_msg *base_msg;

@ -397,7 +397,7 @@ void sys_tree__update(void)
if(out_packet_count != g_out_packet_count){ if(out_packet_count != g_out_packet_count){
out_packet_count = g_out_packet_count; out_packet_count = g_out_packet_count;
len = (uint32_t)snprintf(buf, BUFLEN, "%llu", out_packet_count); len = (uint32_t)snprintf(buf, BUFLEN, "%lu", out_packet_count);
db__messages_easy_queue(NULL, "$SYS/broker/packet/out/count", SYS_TREE_QOS, len, buf, 1, 60, NULL); db__messages_easy_queue(NULL, "$SYS/broker/packet/out/count", SYS_TREE_QOS, len, buf, 1, 60, NULL);
} }

Loading…
Cancel
Save