Skip to content

Commit e29f079

Browse files
committed
Code cleanup: remove trailing whitespaces
Signed-off-by: Ajay Bhargav <ajay.bhargav@waybyte.in>
1 parent a9349af commit e29f079

20 files changed

+187
-212
lines changed

mqttclient/mqttclient.c

Lines changed: 118 additions & 118 deletions
Large diffs are not rendered by default.

network/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
string(REGEX REPLACE ".*/(.*)" "\\1" CURRENT_LIB_NAME ${CMAKE_CURRENT_SOURCE_DIR})
1+
string(REGEX REPLACE ".*/(.*)" "\\1" CURRENT_LIB_NAME ${CMAKE_CURRENT_SOURCE_DIR})
22

33
set(CURRENT_LIB_NAME ${LIBRARY_PREFIX}-${CURRENT_LIB_NAME})
44

@@ -16,7 +16,7 @@ set(${CURRENT_LIB_NAME}_INC_DIRS
1616
)
1717

1818
# 源文件目录
19-
set(${CURRENT_LIB_NAME}_SRC_DIRS
19+
set(${CURRENT_LIB_NAME}_SRC_DIRS
2020
${CMAKE_CURRENT_SOURCE_DIR}
2121
)
2222

network/nettype_tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int nettype_tcp_connect(network_t* n)
2424
n->socket = platform_net_socket_connect(n->host, n->port, PLATFORM_NET_PROTO_TCP);
2525
if (n->socket < 0)
2626
RETURN_ERROR(n->socket);
27-
27+
2828
RETURN_ERROR(MQTT_SUCCESS_ERROR);
2929
}
3030

network/nettype_tls.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ static int nettype_tls_entropy_source(void *data, uint8_t *output, size_t len, s
5151
static int nettype_tls_init(network_t* n, nettype_tls_params_t* nettype_tls_params)
5252
{
5353
int rc = MQTT_SUCCESS_ERROR;
54-
54+
5555
mbedtls_platform_set_calloc_free(platform_memory_calloc, platform_memory_free);
56-
56+
5757
mbedtls_net_init(&(nettype_tls_params->socket_fd));
5858
mbedtls_ssl_init(&(nettype_tls_params->ssl));
5959
mbedtls_ssl_config_init(&(nettype_tls_params->ssl_conf));
@@ -99,7 +99,7 @@ static int nettype_tls_init(network_t* n, nettype_tls_params_t* nettype_tls_para
9999
MQTT_LOG_E("%s:%d %s()... mbedtls_ssl_conf_own_cert failed returned 0x%04x", __FILE__, __LINE__, __FUNCTION__, (rc < 0 )? -rc : rc);
100100
RETURN_ERROR(rc);
101101
}
102-
102+
103103
mbedtls_ssl_conf_verify(&(nettype_tls_params->ssl_conf), server_certificate_verify, (void *)n->host);
104104

105105
mbedtls_ssl_conf_authmode(&(nettype_tls_params->ssl_conf), MBEDTLS_SSL_VERIFY_REQUIRED);
@@ -130,7 +130,7 @@ int nettype_tls_connect(network_t* n)
130130
int rc;
131131
if (NULL == n)
132132
RETURN_ERROR(MQTT_NULL_VALUE_ERROR);
133-
133+
134134
nettype_tls_params_t *nettype_tls_params = (nettype_tls_params_t *) platform_memory_alloc(sizeof(nettype_tls_params_t));
135135

136136
if (NULL == nettype_tls_params)
@@ -170,12 +170,12 @@ int nettype_tls_connect(network_t* n)
170170
}
171171

172172

173-
void nettype_tls_disconnect(network_t* n)
173+
void nettype_tls_disconnect(network_t* n)
174174
{
175175
int rc = 0;
176176
if (NULL == n)
177177
return;
178-
178+
179179
nettype_tls_params_t *nettype_tls_params = (nettype_tls_params_t *) n->nettype_tls_params;
180180

181181
do {
@@ -204,7 +204,7 @@ int nettype_tls_write(network_t *n, unsigned char *buf, int len, int timeout)
204204

205205
if (NULL == n)
206206
RETURN_ERROR(MQTT_NULL_VALUE_ERROR);
207-
207+
208208
nettype_tls_params_t *nettype_tls_params = (nettype_tls_params_t *) n->nettype_tls_params;
209209

210210
platform_timer_cutdown(&timer, timeout);
@@ -217,7 +217,7 @@ int nettype_tls_write(network_t *n, unsigned char *buf, int len, int timeout)
217217
} else if ((rc == 0) || ((rc != MBEDTLS_ERR_SSL_WANT_WRITE) && (rc != MBEDTLS_ERR_SSL_WANT_READ) && (rc != MBEDTLS_ERR_SSL_TIMEOUT))) {
218218
MQTT_LOG_E("%s:%d %s()... mbedtls_ssl_write failed: 0x%04x", __FILE__, __LINE__, __FUNCTION__, (rc < 0 )? -rc : rc);
219219
break;
220-
}
220+
}
221221
} while((!platform_timer_is_expired(&timer)) && (write_len < len));
222222

223223
return write_len;
@@ -231,11 +231,11 @@ int nettype_tls_read(network_t *n, unsigned char *buf, int len, int timeout)
231231

232232
if (NULL == n)
233233
RETURN_ERROR(MQTT_NULL_VALUE_ERROR);
234-
234+
235235
nettype_tls_params_t *nettype_tls_params = (nettype_tls_params_t *) n->nettype_tls_params;
236236

237237
platform_timer_cutdown(&timer, timeout);
238-
238+
239239
do {
240240
rc = mbedtls_ssl_read(&(nettype_tls_params->ssl), (unsigned char *)(buf + read_len), len - read_len);
241241

@@ -244,7 +244,7 @@ int nettype_tls_read(network_t *n, unsigned char *buf, int len, int timeout)
244244
} else if ((rc == 0) || ((rc != MBEDTLS_ERR_SSL_WANT_WRITE) && (rc != MBEDTLS_ERR_SSL_WANT_READ) && (rc != MBEDTLS_ERR_SSL_TIMEOUT))) {
245245
// MQTT_LOG_E("%s:%d %s()... mbedtls_ssl_read failed: 0x%04x", __FILE__, __LINE__, __FUNCTION__, (rc < 0 )? -rc : rc);
246246
break;
247-
}
247+
}
248248
} while((!platform_timer_is_expired(&timer)) && (read_len < len));
249249

250250
return read_len;

network/nettype_tls.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,4 @@ void nettype_tls_disconnect(network_t* n);
6262
#endif
6363

6464
#endif
65+
s

network/network.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int network_set_ca(network_t *n, const char *ca)
9191
#ifndef MQTT_NETWORK_TYPE_NO_TLS
9292
if ((NULL == n) || (NULL == ca))
9393
RETURN_ERROR(MQTT_NULL_VALUE_ERROR);
94-
94+
9595
n->ca_crt = ca;
9696
n->ca_crt_len = strlen(ca);
9797
n->channel = NETWORK_CHANNEL_TLS;
@@ -110,4 +110,3 @@ int network_set_host_port(network_t* n, char *host, char *port)
110110

111111
RETURN_ERROR(MQTT_SUCCESS_ERROR);
112112
}
113-

platform/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
string(REGEX REPLACE ".*/(.*)" "\\1" CURRENT_LIB_NAME ${CMAKE_CURRENT_SOURCE_DIR})
1+
string(REGEX REPLACE ".*/(.*)" "\\1" CURRENT_LIB_NAME ${CMAKE_CURRENT_SOURCE_DIR})
22

33
set(CURRENT_LIB_NAME ${LIBRARY_PREFIX}-${CURRENT_LIB_NAME})
44

@@ -10,7 +10,7 @@ set(${CURRENT_LIB_NAME}_INC_DIRS
1010
)
1111

1212
# 源文件目录
13-
set(${CURRENT_LIB_NAME}_SRC_DIRS
13+
set(${CURRENT_LIB_NAME}_SRC_DIRS
1414
${CMAKE_CURRENT_SOURCE_DIR}/linux
1515
)
1616

@@ -59,5 +59,3 @@ install(DIRECTORY ${${CURRENT_LIB_NAME}_INC_DIRS}
5959
PATTERN "*.h"
6060
PATTERN "*.hpp"
6161
PATTERN "CMakeLists.txt" EXCLUDE)
62-
63-

platform/FreeRTOS/platform_memory.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,3 @@ void platform_memory_free(void *ptr)
2727
{
2828
vPortFree(ptr);
2929
}
30-
31-
32-

platform/FreeRTOS/platform_net_socket.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ int platform_net_socket_connect(const char *host, const char *port, int proto)
1111
{
1212
int fd, ret = MQTT_SOCKET_UNKNOWN_HOST_ERROR;
1313
struct addrinfo hints, *addr_list, *cur;
14-
14+
1515
/* Do name resolution with both IPv6 and IPv4 */
1616
memset(&hints, 0, sizeof(hints));
1717
hints.ai_family = AF_UNSPEC;
1818
hints.ai_socktype = (proto == PLATFORM_NET_PROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM;
1919
hints.ai_protocol = (proto == PLATFORM_NET_PROTO_UDP) ? IPPROTO_UDP : IPPROTO_TCP;
20-
20+
2121
if (getaddrinfo(host, port, &hints, &addr_list) != 0) {
2222
return ret;
2323
}
24-
24+
2525
for (cur = addr_list; cur != NULL; cur = cur->ai_next) {
2626
fd = socket(cur->ai_family, cur->ai_socktype, cur->ai_protocol);
2727
if (fd < 0) {
@@ -51,14 +51,14 @@ int platform_net_socket_recv_timeout(int fd, unsigned char *buf, int len, int ti
5151
{
5252
int nread;
5353
int nleft = len;
54-
unsigned char *ptr;
54+
unsigned char *ptr;
5555
ptr = buf;
5656

5757
struct timeval tv = {
58-
timeout / 1000,
58+
timeout / 1000,
5959
(timeout % 1000) * 1000
6060
};
61-
61+
6262
if (tv.tv_sec < 0 || (tv.tv_sec == 0 && tv.tv_usec <= 0)) {
6363
tv.tv_sec = 0;
6464
tv.tv_usec = 100;
@@ -88,17 +88,17 @@ int platform_net_socket_write(int fd, void *buf, size_t len)
8888
int platform_net_socket_write_timeout(int fd, unsigned char *buf, int len, int timeout)
8989
{
9090
struct timeval tv = {
91-
timeout / 1000,
91+
timeout / 1000,
9292
(timeout % 1000) * 1000
9393
};
94-
94+
9595
if (tv.tv_sec < 0 || (tv.tv_sec == 0 && tv.tv_usec <= 0)) {
9696
tv.tv_sec = 0;
9797
tv.tv_usec = 100;
9898
}
9999

100100
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv,sizeof(struct timeval));
101-
101+
102102
return write(fd, buf, len);
103103
}
104104

@@ -123,4 +123,3 @@ int platform_net_socket_setsockopt(int fd, int level, int optname, const void *o
123123
{
124124
return setsockopt(fd, level, optname, optval, optlen);
125125
}
126-

platform/FreeRTOS/platform_timer.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ void platform_timer_usleep(unsigned long usec)
6262

6363
if(usec != 0) {
6464
tick = usec / portTICK_PERIOD_MS;
65-
65+
6666
if (tick == 0)
6767
tick = 1;
6868
}
6969

7070
vTaskDelay(tick);
7171
}
72-

0 commit comments

Comments
 (0)