Formatting: Indent fixes

This commit is contained in:
Roger A. Light
2025-09-15 14:06:55 +01:00
parent d743413ac3
commit 9d95bf24c3
7 changed files with 31 additions and 31 deletions

View File

@@ -33,18 +33,18 @@ Contributors:
#ifdef WIN32
# include <windows.h>
# include <process.h>
# ifndef __cplusplus
# if defined(_MSC_VER) && _MSC_VER < 1900
# define bool char
# define true 1
# define false 0
# else
# include <stdbool.h>
# endif
# endif
# ifndef __cplusplus
# if defined(_MSC_VER) && _MSC_VER < 1900
# define bool char
# define true 1
# define false 0
# else
# include <stdbool.h>
# endif
# endif
# define snprintf sprintf_s
# include <io.h>
# include <windows.h>
# include <io.h>
# include <windows.h>
#else
# include <stdbool.h>
# include <unistd.h>

View File

@@ -165,8 +165,8 @@ int handle__publish(struct mosquitto *mosq)
if(mosquitto_pub_topic_check(message->msg.topic) != MOSQ_ERR_SUCCESS){
message__cleanup(&message);
mosquitto_property_free_all(&properties);
return MOSQ_ERR_MALFORMED_PACKET;
}
return MOSQ_ERR_MALFORMED_PACKET;
}
message->msg.payloadlen = (int)(mosq->in_packet.remaining_length - mosq->in_packet.pos);
if(message->msg.payloadlen){

View File

@@ -994,7 +994,7 @@ static void net__handle_ssl(struct mosquitto *mosq, int ret)
}else if(err == SSL_ERROR_SSL){
net__print_ssl_error(mosq, "while trying to get the error");
errno = EPROTO;
/* else if SSL_ERROR_SYSCALL leave errno alone */
/* else if SSL_ERROR_SYSCALL leave errno alone */
}
ERR_clear_error();
#ifdef WIN32

View File

@@ -83,14 +83,13 @@ int mosquitto_connect_srv(struct mosquitto *mosq, const char *host, int keepaliv
h = mosquitto_malloc(strlen(host) + strlen("_secure-mqtt._tcp.") + 1);
if(!h) return MOSQ_ERR_NOMEM;
sprintf(h, "_secure-mqtt._tcp.%s", host);
}else{
}else
#endif
{
h = mosquitto_malloc(strlen(host) + strlen("_mqtt._tcp.") + 1);
if(!h) return MOSQ_ERR_NOMEM;
sprintf(h, "_mqtt._tcp.%s", host);
#ifdef WITH_TLS
}
#endif
ares_search(mosq->achan, h, ns_c_in, ns_t_srv, srv_callback, mosq);
mosquitto_FREE(h);
}

View File

@@ -293,16 +293,17 @@ char *mosquitto_fgets(char **buf, int *buflen, FILE *stream)
#define INVOKE_LOG_FN(format, ...) \
do{ \
if(log_fn){ \
int tmp_err_no = errno; \
char msg[2*PATH_MAX]; \
snprintf(msg, sizeof(msg), (format), __VA_ARGS__); \
msg[sizeof(msg)-1] = '\0'; \
(*log_fn)(msg); \
errno = tmp_err_no; \
} \
}while (0)
do{ \
if(log_fn){ \
int tmp_err_no = errno; \
char msg[2*PATH_MAX]; \
snprintf(msg, sizeof(msg), (format), __VA_ARGS__); \
msg[sizeof(msg)-1] = '\0'; \
(*log_fn)(msg); \
errno = tmp_err_no; \
} \
}while(0)
int mosquitto_write_file(const char *target_path, bool restrict_read, int (*write_fn)(FILE *fptr, void *user_data), void *user_data, void (*log_fn)(const char *msg))
{

View File

@@ -67,7 +67,7 @@ static int callback_message_in(int event, void *event_data, void *userdata)
MQTT_PROP_USER_PROPERTY,
"$timestamp",
ts_buf);
if (result != MOSQ_ERR_SUCCESS) return result;
if(result != MOSQ_ERR_SUCCESS) return result;
// Add client id
result = mosquitto_property_add_string_pair(
@@ -75,7 +75,7 @@ static int callback_message_in(int event, void *event_data, void *userdata)
MQTT_PROP_USER_PROPERTY,
"$clientid",
mosquitto_client_id(ed->client));
if (result != MOSQ_ERR_SUCCESS) return result;
if(result != MOSQ_ERR_SUCCESS) return result;
// Add client username
result = mosquitto_property_add_string_pair(
@@ -83,7 +83,7 @@ static int callback_message_in(int event, void *event_data, void *userdata)
MQTT_PROP_USER_PROPERTY,
"$client_username",
mosquitto_client_username(ed->client));
if (result != MOSQ_ERR_SUCCESS) return result;
if(result != MOSQ_ERR_SUCCESS) return result;
// If no return occurred up to this point, we were successful
return MOSQ_ERR_SUCCESS;

View File

@@ -215,7 +215,7 @@ static int create_tables(struct mosquitto_sqlite *ms)
}
if(db_schema_version[0] == 1){
/* 1.0.x needs to be upgraded to 1.1 */
if (db_schema_version[1] == 0){
if(db_schema_version[1] == 0){
rc = create_tables_1_1(ms);
if (rc) { goto fail; }
memcpy(db_schema_version, (int[3]){1, 1, 0}, sizeof(db_schema_version));