Remove C++ style comments.

pull/2215/head
Roger Light 4 years ago
parent f29ed90e4a
commit e1c8f09372

@ -99,7 +99,6 @@ static void free__client_msg(struct P_client_msg *chunk)
static void free__msg_store(struct P_msg_store *chunk) static void free__msg_store(struct P_msg_store *chunk)
{ {
//free(chunk->source_id);
free(chunk->topic); free(chunk->topic);
free(chunk->payload); free(chunk->payload);
mosquitto_property_free_all(&chunk->properties); mosquitto_property_free_all(&chunk->properties);
@ -425,7 +424,7 @@ int main(int argc, char *argv[])
read_e(fd, &header, 15); read_e(fd, &header, 15);
if(!memcmp(header, magic, 15)){ if(!memcmp(header, magic, 15)){
if(do_print) printf("Mosquitto DB dump\n"); if(do_print) printf("Mosquitto DB dump\n");
// Restore DB as normal /* Restore DB as normal */
read_e(fd, &crc, sizeof(uint32_t)); read_e(fd, &crc, sizeof(uint32_t));
if(do_print) printf("CRC: %d\n", crc); if(do_print) printf("CRC: %d\n", crc);
read_e(fd, &i32temp, sizeof(uint32_t)); 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("DB_CHUNK_MSG_STORE:\n");
printf("\tLength: %d\n", length); printf("\tLength: %d\n", length);
printf("\tStore ID: %" PRIu64 "\n", chunk->F.store_id); printf("\tStore ID: %" PRIu64 "\n", chunk->F.store_id);
//printf("\tSource ID: %s\n", chunk->source_id); /* printf("\tSource ID: %s\n", chunk->source_id); */
//printf("\tSource Username: %s\n", chunk->source_username); /* printf("\tSource Username: %s\n", chunk->source_username); */
printf("\tSource Port: %d\n", chunk->F.source_port); printf("\tSource Port: %d\n", chunk->F.source_port);
printf("\tSource MID: %d\n", chunk->F.source_mid); printf("\tSource MID: %d\n", chunk->F.source_mid);
printf("\tTopic: %s\n", chunk->topic); 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")){ }else if(!strcasecmp(j_command->valuestring, "getAnonymousGroup")){
print_anonymous_group(j_response); print_anonymous_group(j_response);
}else{ }else{
//fprintf(stderr, "%s: Success\n", j_command->valuestring); /* fprintf(stderr, "%s: Success\n", j_command->valuestring); */
} }
} }
cJSON_Delete(tree); cJSON_Delete(tree);

@ -53,7 +53,7 @@ static int check_format(const char *str)
for(i=0; i<len; i++){ for(i=0; i<len; i++){
if(str[i] == '%'){ if(str[i] == '%'){
if(i == len-1){ if(i == len-1){
// error /* error */
fprintf(stderr, "Error: Incomplete format specifier.\n"); fprintf(stderr, "Error: Incomplete format specifier.\n");
return 1; return 1;
}else{ }else{
@ -61,7 +61,7 @@ static int check_format(const char *str)
/* Flag characters */ /* Flag characters */
i++; i++;
if(i == len-1){ if(i == len-1){
// error /* error */
fprintf(stderr, "Error: Incomplete format specifier.\n"); fprintf(stderr, "Error: Incomplete format specifier.\n");
return 1; return 1;
} }
@ -71,7 +71,7 @@ static int check_format(const char *str)
while(str[i+1] >= '0' && str[i+1] <= '9'){ while(str[i+1] >= '0' && str[i+1] <= '9'){
i++; i++;
if(i == len-1){ if(i == len-1){
// error /* error */
fprintf(stderr, "Error: Incomplete format specifier.\n"); fprintf(stderr, "Error: Incomplete format specifier.\n");
return 1; return 1;
} }
@ -81,7 +81,7 @@ static int check_format(const char *str)
/* Precision specifier */ /* Precision specifier */
i++; i++;
if(i == len-1){ if(i == len-1){
// error /* error */
fprintf(stderr, "Error: Incomplete format specifier.\n"); fprintf(stderr, "Error: Incomplete format specifier.\n");
return 1; return 1;
} }
@ -89,7 +89,7 @@ static int check_format(const char *str)
while(str[i+1] >= '0' && str[i+1] <= '9'){ while(str[i+1] >= '0' && str[i+1] <= '9'){
i++; i++;
if(i == len-1){ if(i == len-1){
// error /* error */
fprintf(stderr, "Error: Incomplete format specifier.\n"); fprintf(stderr, "Error: Incomplete format specifier.\n");
return 1; return 1;
} }
@ -97,49 +97,49 @@ static int check_format(const char *str)
} }
if(str[i+1] == '%'){ if(str[i+1] == '%'){
// Print %, ignore /* Print %, ignore */
}else if(str[i+1] == 'A'){ }else if(str[i+1] == 'A'){
// MQTT v5 property topic-alias /* MQTT v5 property topic-alias */
}else if(str[i+1] == 'C'){ }else if(str[i+1] == 'C'){
// MQTT v5 property content-type /* MQTT v5 property content-type */
}else if(str[i+1] == 'D'){ }else if(str[i+1] == 'D'){
// MQTT v5 property correlation-data /* MQTT v5 property correlation-data */
}else if(str[i+1] == 'E'){ }else if(str[i+1] == 'E'){
// MQTT v5 property message-expiry-interval /* MQTT v5 property message-expiry-interval */
}else if(str[i+1] == 'F'){ }else if(str[i+1] == 'F'){
// MQTT v5 property payload-format-indicator /* MQTT v5 property payload-format-indicator */
}else if(str[i+1] == 'I'){ }else if(str[i+1] == 'I'){
// ISO 8601 date+time /* ISO 8601 date+time */
}else if(str[i+1] == 'l'){ }else if(str[i+1] == 'l'){
// payload length /* payload length */
}else if(str[i+1] == 'm'){ }else if(str[i+1] == 'm'){
// mid /* mid */
}else if(str[i+1] == 'P'){ }else if(str[i+1] == 'P'){
// MQTT v5 property user-property /* MQTT v5 property user-property */
}else if(str[i+1] == 'p'){ }else if(str[i+1] == 'p'){
// payload /* payload */
}else if(str[i+1] == 'q'){ }else if(str[i+1] == 'q'){
// qos /* qos */
}else if(str[i+1] == 'R'){ }else if(str[i+1] == 'R'){
// MQTT v5 property response-topic /* MQTT v5 property response-topic */
}else if(str[i+1] == 'S'){ }else if(str[i+1] == 'S'){
// MQTT v5 property subscription-identifier /* MQTT v5 property subscription-identifier */
}else if(str[i+1] == 'r'){ }else if(str[i+1] == 'r'){
// retain /* retain */
}else if(str[i+1] == 't'){ }else if(str[i+1] == 't'){
// topic /* topic */
}else if(str[i+1] == 'j'){ }else if(str[i+1] == 'j'){
// JSON output, escaped payload /* JSON output, escaped payload */
}else if(str[i+1] == 'J'){ }else if(str[i+1] == 'J'){
// JSON output, assuming JSON payload /* JSON output, assuming JSON payload */
}else if(str[i+1] == 'U'){ }else if(str[i+1] == 'U'){
// Unix time+nanoseconds /* Unix time+nanoseconds */
#ifdef WIN32 #ifdef WIN32
fprintf(stderr, "Error: The %%U format option is not supported on Windows.\n"); fprintf(stderr, "Error: The %%U format option is not supported on Windows.\n");
return 1; return 1;
#endif #endif
}else if(str[i+1] == 'x' || str[i+1] == 'X'){ }else if(str[i+1] == 'x' || str[i+1] == 'X'){
// payload in hex /* payload in hex */
}else{ }else{
fprintf(stderr, "Error: Invalid format specifier '%c'.\n", str[i+1]); fprintf(stderr, "Error: Invalid format specifier '%c'.\n", str[i+1]);
return 1; return 1;
@ -148,26 +148,26 @@ static int check_format(const char *str)
} }
}else if(str[i] == '@'){ }else if(str[i] == '@'){
if(i == len-1){ if(i == len-1){
// error /* error */
fprintf(stderr, "Error: Incomplete format specifier.\n"); fprintf(stderr, "Error: Incomplete format specifier.\n");
return 1; return 1;
} }
i++; i++;
}else if(str[i] == '\\'){ }else if(str[i] == '\\'){
if(i == len-1){ if(i == len-1){
// error /* error */
fprintf(stderr, "Error: Incomplete escape specifier.\n"); fprintf(stderr, "Error: Incomplete escape specifier.\n");
return 1; return 1;
}else{ }else{
switch(str[i+1]){ switch(str[i+1]){
case '\\': // '\' case '\\': /* '\' */
case '0': // 0 (NULL) case '0': /* 0 (NULL) */
case 'a': // alert case 'a': /* alert */
case 'e': // escape case 'e': /* escape */
case 'n': // new line case 'n': /* new line */
case 'r': // carriage return case 'r': /* carriage return */
case 't': // horizontal tab case 't': /* horizontal tab */
case 'v': // vertical tab case 'v': /* vertical tab */
break; break;
default: default:
@ -1463,12 +1463,13 @@ static int mosquitto__parse_socks_url(struct mosq_config *cfg, char *url)
return 1; return 1;
} }
// socks5h://username:password@host:1883 /* socks5h://username:password@host:1883
// socks5h://username:password@host * socks5h://username:password@host
// socks5h://username@host:1883 * socks5h://username@host:1883
// socks5h://username@host * socks5h://username@host
// socks5h://host:1883 * socks5h://host:1883
// socks5h://host * socks5h://host
*/
start = 0; start = 0;
for(i=0; i<strlen(str); i++){ for(i=0; i<strlen(str); i++){

@ -182,7 +182,7 @@ void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flag
}else{ }else{
err_printf(&cfg, "Connection error: %s\n", mosquitto_connack_string(result)); 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; status = STATUS_NOHOPE;
} }
} }

@ -192,7 +192,7 @@ static int mosquitto__reconnect(struct mosquitto *mosq, bool blocking)
message__reconnect_reset(mosq, false); message__reconnect_reset(mosq, false);
if(mosq->sock != INVALID_SOCKET){ if(mosq->sock != INVALID_SOCKET){
net__socket_close(mosq); //close socket net__socket_close(mosq);
} }
#ifdef WITH_SOCKS #ifdef WITH_SOCKS

@ -456,7 +456,7 @@ int packet__read(struct mosquitto *mosq)
return MOSQ_ERR_OVERSIZE_PACKET; return MOSQ_ERR_OVERSIZE_PACKET;
} }
#else #else
// FIXME - client case for incoming message received from broker too large /* FIXME - client case for incoming message received from broker too large */
#endif #endif
if(mosq->in_packet.remaining_length > 0){ if(mosq->in_packet.remaining_length > 0){
mosq->in_packet.payload = mosquitto__malloc(mosq->in_packet.remaining_length*sizeof(uint8_t)); 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; return MOSQ_ERR_SUCCESS;
}else{ }else{
client->pw.valid = false; 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; return MOSQ_ERR_NOMEM;
} }
} }

@ -95,7 +95,7 @@ bool sub_acl_check(const char *acl, const char *sub)
} }
sub_len = strlen(sub); sub_len = strlen(sub);
//mosquitto_validate_utf8(acl, acl_len); /* mosquitto_validate_utf8(acl, acl_len); */
acl_local = strdup(acl); acl_local = strdup(acl);
sub_local = strdup(sub); sub_local = strdup(sub);

@ -876,7 +876,7 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
return MOSQ_ERR_INVAL; return MOSQ_ERR_INVAL;
} }
}else if(!strcmp(token, "auth_plugin") || !strcmp(token, "plugin")){ }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); 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)); 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){ if(!cur_security_options->auth_plugin_configs){
@ -1053,7 +1053,7 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
#endif #endif
}else if(!strcmp(token, "bridge_max_packet_size")){ }else if(!strcmp(token, "bridge_max_packet_size")){
#if defined(WITH_BRIDGE) #if defined(WITH_BRIDGE)
if(reload) continue; // Bridges not valid for reloading. if(reload) continue; /* Bridges not valid for reloading. */
if(!cur_bridge){ if(!cur_bridge){
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration."); log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
return MOSQ_ERR_INVAL; return MOSQ_ERR_INVAL;
@ -1066,7 +1066,7 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
#endif #endif
}else if(!strcmp(token, "bridge_outgoing_retain")){ }else if(!strcmp(token, "bridge_outgoing_retain")){
#if defined(WITH_BRIDGE) #if defined(WITH_BRIDGE)
if(reload) continue; // Listeners not valid for reloading. if(reload) continue; /* Listeners not valid for reloading. */
if(!cur_bridge){ if(!cur_bridge){
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration."); log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
return MOSQ_ERR_INVAL; return MOSQ_ERR_INVAL;
@ -1214,7 +1214,7 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
#endif #endif
}else if(!strcmp(token, "local_cleansession")){ }else if(!strcmp(token, "local_cleansession")){
#ifdef WITH_BRIDGE #ifdef WITH_BRIDGE
if(reload) continue; // FIXME if(reload) continue; /* FIXME */
if(!cur_bridge){ if(!cur_bridge){
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration."); log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
return MOSQ_ERR_INVAL; 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. */ /* 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, 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); assert(stored);

@ -181,9 +181,9 @@ void plugin__handle_tick(void)
struct mosquitto__callback *cb_base; struct mosquitto__callback *cb_base;
struct mosquitto__security_options *opts; 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){ if(db.config->per_listener_settings){
// FIXME - iterate over all listeners /* FIXME - iterate over all listeners */
}else{ }else{
opts = &db.config->security_options; opts = &db.config->security_options;
memset(&event_data, 0, sizeof(event_data)); memset(&event_data, 0, sizeof(event_data));

Loading…
Cancel
Save