Skip to content

Commit

Permalink
Remove C++ style comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Apr 25, 2021
1 parent f29ed90 commit e1c8f09
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 58 deletions.
3 changes: 1 addition & 2 deletions apps/db_dump/db_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions apps/db_dump/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion apps/mosquitto_ctrl/dynsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
83 changes: 42 additions & 41 deletions client/client_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ 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{
if(str[i+1] == '0' || str[i+1] == '-'){
/* Flag characters */
i++;
if(i == len-1){
// error
/* error */
fprintf(stderr, "Error: Incomplete format specifier.\n");
return 1;
}
Expand All @@ -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;
}
Expand All @@ -81,65 +81,65 @@ 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;
}
/* Precision */
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;
}
}
}

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;
Expand All @@ -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:
Expand Down Expand Up @@ -1463,12 +1463,13 @@ static int mosquitto__parse_socks_url(struct mosq_config *cfg, char *url)
return 1;
}

// socks5h:https://username:password@host:1883
// socks5h:https://username:password@host
// socks5h:https://username@host:1883
// socks5h:https://username@host
// socks5h:https://host:1883
// socks5h:https://host
/* socks5h:https://username:password@host:1883
* socks5h:https://username:password@host
* socks5h:https://username@host:1883
* socks5h:https://username@host
* socks5h:https://host:1883
* socks5h:https://host
*/

start = 0;
for(i=0; i<strlen(str); i++){
Expand Down
2 changes: 1 addition & 1 deletion client/pub_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/packet_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion plugins/dynamic-security/clients.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/dynamic-security/sub_matches_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/database.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit e1c8f09

Please sign in to comment.