mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-09-22 08:04:23 +08:00
Remove C++ style comments.
This commit is contained in:
@@ -99,7 +99,6 @@ static void free__client_msg(struct P_client_msg *chunk)
|
||||
|
||||
static void free__msg_store(struct P_msg_store *chunk)
|
||||
{
|
||||
//free(chunk->source_id);
|
||||
free(chunk->topic);
|
||||
free(chunk->payload);
|
||||
mosquitto_property_free_all(&chunk->properties);
|
||||
@@ -425,7 +424,7 @@ int main(int argc, char *argv[])
|
||||
read_e(fd, &header, 15);
|
||||
if(!memcmp(header, magic, 15)){
|
||||
if(do_print) printf("Mosquitto DB dump\n");
|
||||
// Restore DB as normal
|
||||
/* Restore DB as normal */
|
||||
read_e(fd, &crc, sizeof(uint32_t));
|
||||
if(do_print) printf("CRC: %d\n", crc);
|
||||
read_e(fd, &i32temp, sizeof(uint32_t));
|
||||
|
||||
@@ -183,8 +183,8 @@ void print__msg_store(struct P_msg_store *chunk, uint32_t length)
|
||||
printf("DB_CHUNK_MSG_STORE:\n");
|
||||
printf("\tLength: %d\n", length);
|
||||
printf("\tStore ID: %" PRIu64 "\n", chunk->F.store_id);
|
||||
//printf("\tSource ID: %s\n", chunk->source_id);
|
||||
//printf("\tSource Username: %s\n", chunk->source_username);
|
||||
/* printf("\tSource ID: %s\n", chunk->source_id); */
|
||||
/* printf("\tSource Username: %s\n", chunk->source_username); */
|
||||
printf("\tSource Port: %d\n", chunk->F.source_port);
|
||||
printf("\tSource MID: %d\n", chunk->F.source_mid);
|
||||
printf("\tTopic: %s\n", chunk->topic);
|
||||
|
||||
@@ -440,7 +440,7 @@ static void dynsec__payload_callback(struct mosq_ctrl *ctrl, long payloadlen, co
|
||||
}else if(!strcasecmp(j_command->valuestring, "getAnonymousGroup")){
|
||||
print_anonymous_group(j_response);
|
||||
}else{
|
||||
//fprintf(stderr, "%s: Success\n", j_command->valuestring);
|
||||
/* fprintf(stderr, "%s: Success\n", j_command->valuestring); */
|
||||
}
|
||||
}
|
||||
cJSON_Delete(tree);
|
||||
|
||||
+42
-41
@@ -53,7 +53,7 @@ static int check_format(const char *str)
|
||||
for(i=0; i<len; i++){
|
||||
if(str[i] == '%'){
|
||||
if(i == len-1){
|
||||
// error
|
||||
/* error */
|
||||
fprintf(stderr, "Error: Incomplete format specifier.\n");
|
||||
return 1;
|
||||
}else{
|
||||
@@ -61,7 +61,7 @@ static int check_format(const char *str)
|
||||
/* Flag characters */
|
||||
i++;
|
||||
if(i == len-1){
|
||||
// error
|
||||
/* error */
|
||||
fprintf(stderr, "Error: Incomplete format specifier.\n");
|
||||
return 1;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ static int check_format(const char *str)
|
||||
while(str[i+1] >= '0' && str[i+1] <= '9'){
|
||||
i++;
|
||||
if(i == len-1){
|
||||
// error
|
||||
/* error */
|
||||
fprintf(stderr, "Error: Incomplete format specifier.\n");
|
||||
return 1;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ static int check_format(const char *str)
|
||||
/* Precision specifier */
|
||||
i++;
|
||||
if(i == len-1){
|
||||
// error
|
||||
/* error */
|
||||
fprintf(stderr, "Error: Incomplete format specifier.\n");
|
||||
return 1;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ static int check_format(const char *str)
|
||||
while(str[i+1] >= '0' && str[i+1] <= '9'){
|
||||
i++;
|
||||
if(i == len-1){
|
||||
// error
|
||||
/* error */
|
||||
fprintf(stderr, "Error: Incomplete format specifier.\n");
|
||||
return 1;
|
||||
}
|
||||
@@ -97,49 +97,49 @@ static int check_format(const char *str)
|
||||
}
|
||||
|
||||
if(str[i+1] == '%'){
|
||||
// Print %, ignore
|
||||
/* Print %, ignore */
|
||||
}else if(str[i+1] == 'A'){
|
||||
// MQTT v5 property topic-alias
|
||||
/* MQTT v5 property topic-alias */
|
||||
}else if(str[i+1] == 'C'){
|
||||
// MQTT v5 property content-type
|
||||
/* MQTT v5 property content-type */
|
||||
}else if(str[i+1] == 'D'){
|
||||
// MQTT v5 property correlation-data
|
||||
/* MQTT v5 property correlation-data */
|
||||
}else if(str[i+1] == 'E'){
|
||||
// MQTT v5 property message-expiry-interval
|
||||
/* MQTT v5 property message-expiry-interval */
|
||||
}else if(str[i+1] == 'F'){
|
||||
// MQTT v5 property payload-format-indicator
|
||||
/* MQTT v5 property payload-format-indicator */
|
||||
}else if(str[i+1] == 'I'){
|
||||
// ISO 8601 date+time
|
||||
/* ISO 8601 date+time */
|
||||
}else if(str[i+1] == 'l'){
|
||||
// payload length
|
||||
/* payload length */
|
||||
}else if(str[i+1] == 'm'){
|
||||
// mid
|
||||
/* mid */
|
||||
}else if(str[i+1] == 'P'){
|
||||
// MQTT v5 property user-property
|
||||
/* MQTT v5 property user-property */
|
||||
}else if(str[i+1] == 'p'){
|
||||
// payload
|
||||
/* payload */
|
||||
}else if(str[i+1] == 'q'){
|
||||
// qos
|
||||
/* qos */
|
||||
}else if(str[i+1] == 'R'){
|
||||
// MQTT v5 property response-topic
|
||||
/* MQTT v5 property response-topic */
|
||||
}else if(str[i+1] == 'S'){
|
||||
// MQTT v5 property subscription-identifier
|
||||
/* MQTT v5 property subscription-identifier */
|
||||
}else if(str[i+1] == 'r'){
|
||||
// retain
|
||||
/* retain */
|
||||
}else if(str[i+1] == 't'){
|
||||
// topic
|
||||
/* topic */
|
||||
}else if(str[i+1] == 'j'){
|
||||
// JSON output, escaped payload
|
||||
/* JSON output, escaped payload */
|
||||
}else if(str[i+1] == 'J'){
|
||||
// JSON output, assuming JSON payload
|
||||
/* JSON output, assuming JSON payload */
|
||||
}else if(str[i+1] == 'U'){
|
||||
// Unix time+nanoseconds
|
||||
/* Unix time+nanoseconds */
|
||||
#ifdef WIN32
|
||||
fprintf(stderr, "Error: The %%U format option is not supported on Windows.\n");
|
||||
return 1;
|
||||
#endif
|
||||
}else if(str[i+1] == 'x' || str[i+1] == 'X'){
|
||||
// payload in hex
|
||||
/* payload in hex */
|
||||
}else{
|
||||
fprintf(stderr, "Error: Invalid format specifier '%c'.\n", str[i+1]);
|
||||
return 1;
|
||||
@@ -148,26 +148,26 @@ static int check_format(const char *str)
|
||||
}
|
||||
}else if(str[i] == '@'){
|
||||
if(i == len-1){
|
||||
// error
|
||||
/* error */
|
||||
fprintf(stderr, "Error: Incomplete format specifier.\n");
|
||||
return 1;
|
||||
}
|
||||
i++;
|
||||
}else if(str[i] == '\\'){
|
||||
if(i == len-1){
|
||||
// error
|
||||
/* error */
|
||||
fprintf(stderr, "Error: Incomplete escape specifier.\n");
|
||||
return 1;
|
||||
}else{
|
||||
switch(str[i+1]){
|
||||
case '\\': // '\'
|
||||
case '0': // 0 (NULL)
|
||||
case 'a': // alert
|
||||
case 'e': // escape
|
||||
case 'n': // new line
|
||||
case 'r': // carriage return
|
||||
case 't': // horizontal tab
|
||||
case 'v': // vertical tab
|
||||
case '\\': /* '\' */
|
||||
case '0': /* 0 (NULL) */
|
||||
case 'a': /* alert */
|
||||
case 'e': /* escape */
|
||||
case 'n': /* new line */
|
||||
case 'r': /* carriage return */
|
||||
case 't': /* horizontal tab */
|
||||
case 'v': /* vertical tab */
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1463,12 +1463,13 @@ static int mosquitto__parse_socks_url(struct mosq_config *cfg, char *url)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// socks5h://username:password@host:1883
|
||||
// socks5h://username:password@host
|
||||
// socks5h://username@host:1883
|
||||
// socks5h://username@host
|
||||
// socks5h://host:1883
|
||||
// socks5h://host
|
||||
/* socks5h://username:password@host:1883
|
||||
* socks5h://username:password@host
|
||||
* socks5h://username@host:1883
|
||||
* socks5h://username@host
|
||||
* socks5h://host:1883
|
||||
* socks5h://host
|
||||
*/
|
||||
|
||||
start = 0;
|
||||
for(i=0; i<strlen(str); i++){
|
||||
|
||||
+1
-1
@@ -182,7 +182,7 @@ void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flag
|
||||
}else{
|
||||
err_printf(&cfg, "Connection error: %s\n", mosquitto_connack_string(result));
|
||||
}
|
||||
// let the loop know that this is an unrecoverable connection
|
||||
/* let the loop know that this is an unrecoverable connection */
|
||||
status = STATUS_NOHOPE;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ static int mosquitto__reconnect(struct mosquitto *mosq, bool blocking)
|
||||
message__reconnect_reset(mosq, false);
|
||||
|
||||
if(mosq->sock != INVALID_SOCKET){
|
||||
net__socket_close(mosq); //close socket
|
||||
net__socket_close(mosq);
|
||||
}
|
||||
|
||||
#ifdef WITH_SOCKS
|
||||
|
||||
+1
-1
@@ -456,7 +456,7 @@ int packet__read(struct mosquitto *mosq)
|
||||
return MOSQ_ERR_OVERSIZE_PACKET;
|
||||
}
|
||||
#else
|
||||
// FIXME - client case for incoming message received from broker too large
|
||||
/* FIXME - client case for incoming message received from broker too large */
|
||||
#endif
|
||||
if(mosq->in_packet.remaining_length > 0){
|
||||
mosq->in_packet.payload = mosquitto__malloc(mosq->in_packet.remaining_length*sizeof(uint8_t));
|
||||
|
||||
@@ -645,7 +645,7 @@ static int client__set_password(struct dynsec__client *client, const char *passw
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}else{
|
||||
client->pw.valid = false;
|
||||
// FIXME - this should fail safe without modifying the existing password
|
||||
/* FIXME - this should fail safe without modifying the existing password */
|
||||
return MOSQ_ERR_NOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ bool sub_acl_check(const char *acl, const char *sub)
|
||||
}
|
||||
|
||||
sub_len = strlen(sub);
|
||||
//mosquitto_validate_utf8(acl, acl_len);
|
||||
/* mosquitto_validate_utf8(acl, acl_len); */
|
||||
|
||||
acl_local = strdup(acl);
|
||||
sub_local = strdup(sub);
|
||||
|
||||
+4
-4
@@ -876,7 +876,7 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
}else if(!strcmp(token, "auth_plugin") || !strcmp(token, "plugin")){
|
||||
if(reload) continue; // Auth plugin not currently valid for reloading.
|
||||
if(reload) continue; /* Auth plugin not currently valid for reloading. */
|
||||
conf__set_cur_security_options(config, cur_listener, &cur_security_options);
|
||||
cur_security_options->auth_plugin_configs = mosquitto__realloc(cur_security_options->auth_plugin_configs, (size_t)(cur_security_options->auth_plugin_config_count+1)*sizeof(struct mosquitto__auth_plugin_config));
|
||||
if(!cur_security_options->auth_plugin_configs){
|
||||
@@ -1053,7 +1053,7 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
|
||||
#endif
|
||||
}else if(!strcmp(token, "bridge_max_packet_size")){
|
||||
#if defined(WITH_BRIDGE)
|
||||
if(reload) continue; // Bridges not valid for reloading.
|
||||
if(reload) continue; /* Bridges not valid for reloading. */
|
||||
if(!cur_bridge){
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
||||
return MOSQ_ERR_INVAL;
|
||||
@@ -1066,7 +1066,7 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
|
||||
#endif
|
||||
}else if(!strcmp(token, "bridge_outgoing_retain")){
|
||||
#if defined(WITH_BRIDGE)
|
||||
if(reload) continue; // Listeners not valid for reloading.
|
||||
if(reload) continue; /* Listeners not valid for reloading. */
|
||||
if(!cur_bridge){
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
||||
return MOSQ_ERR_INVAL;
|
||||
@@ -1214,7 +1214,7 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
|
||||
#endif
|
||||
}else if(!strcmp(token, "local_cleansession")){
|
||||
#ifdef WITH_BRIDGE
|
||||
if(reload) continue; // FIXME
|
||||
if(reload) continue; /* FIXME */
|
||||
if(!cur_bridge){
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
||||
return MOSQ_ERR_INVAL;
|
||||
|
||||
@@ -677,7 +677,6 @@ int db__messages_easy_queue(struct mosquitto *context, const char *topic, uint8_
|
||||
|
||||
/* This function requires topic to be allocated on the heap. Once called, it owns topic and will free it on error. Likewise payload and properties. */
|
||||
int db__message_store(const struct mosquitto *source, struct mosquitto_msg_store *stored, uint32_t message_expiry_interval, dbid_t store_id, enum mosquitto_msg_origin origin)
|
||||
//int db__message_store(const struct mosquitto *source, uint16_t source_mid, char *topic, int qos, uint32_t payloadlen, mosquitto__payload_uhpa *payload, int retain, struct mosquitto_msg_store **stored, uint32_t message_expiry_interval, mosquitto_property *properties, dbid_t store_id, enum mosquitto_msg_origin origin)
|
||||
{
|
||||
assert(stored);
|
||||
|
||||
|
||||
+2
-2
@@ -181,9 +181,9 @@ void plugin__handle_tick(void)
|
||||
struct mosquitto__callback *cb_base;
|
||||
struct mosquitto__security_options *opts;
|
||||
|
||||
// FIXME - set now_s and now_ns to avoid need for multiple time lookups
|
||||
/* FIXME - set now_s and now_ns to avoid need for multiple time lookups */
|
||||
if(db.config->per_listener_settings){
|
||||
// FIXME - iterate over all listeners
|
||||
/* FIXME - iterate over all listeners */
|
||||
}else{
|
||||
opts = &db.config->security_options;
|
||||
memset(&event_data, 0, sizeof(event_data));
|
||||
|
||||
Reference in New Issue
Block a user