diff --git a/mongoose.c b/mongoose.c index 5faa2f29..9fd63f90 100644 --- a/mongoose.c +++ b/mongoose.c @@ -2442,8 +2442,9 @@ void mg_mgr_free(struct mg_mgr *mgr) { void mg_mgr_init(struct mg_mgr *mgr) { memset(mgr, 0, sizeof(*mgr)); #if defined(_WIN32) && MG_ENABLE_WINSOCK - WSADATA data; - WSAStartup(MAKEWORD(2, 2), &data); + // clang-format off + { WSADATA data; WSAStartup(MAKEWORD(2, 2), &data); } + // clang-format on #elif MG_ARCH == MG_ARCH_FREERTOS_TCP mgr->ss = FreeRTOS_CreateSocketSet(); #elif defined(__unix) || defined(__unix__) || defined(__APPLE__) @@ -4097,6 +4098,7 @@ struct mg_str mg_url_pass(const char *url) { + #if MG_ENABLE_FS int mg_stat(const char *path, mg_stat_t *st) { #ifdef _WIN32 @@ -4180,7 +4182,7 @@ bool mg_file_printf(const char *path, const char *fmt, ...) { if (buf != tmp) free(buf); return result; } -#endif +#endif // MG_ENABLE_FS void mg_random(void *buf, size_t len) { bool done = false; diff --git a/mongoose.h b/mongoose.h index e79004b4..753da1e9 100644 --- a/mongoose.h +++ b/mongoose.h @@ -154,9 +154,6 @@ #define SO_REUSEADDR 0 #define sockaddr_in freertos_sockaddr #define sockaddr freertos_sockaddr -// struct sockaddr { -// uint8_t sa_len, sa_family; -// }; #define accept(a, b, c) FreeRTOS_accept((a), (b), (c)) #define connect(a, b, c) FreeRTOS_connect((a), (b), (c)) #define bind(a, b, c) FreeRTOS_bind((a), (b), (c)) @@ -535,7 +532,6 @@ FILE *mg_fopen(const char *fp, const char *mode); - unsigned short mg_url_port(const char *url); int mg_url_is_ssl(const char *url); struct mg_str mg_url_host(const char *url); diff --git a/src/arch.h b/src/arch.h index ffa6a96a..ecbb9741 100644 --- a/src/arch.h +++ b/src/arch.h @@ -41,6 +41,6 @@ #include "arch_esp32.h" #include "arch_esp8266.h" -#include "arch_freertos.h" +#include "arch_freertos_tcp.h" #include "arch_unix.h" #include "arch_win32.h" diff --git a/src/arch_freertos_tcp.h b/src/arch_freertos_tcp.h index 52b0d2e9..6a4cc155 100644 --- a/src/arch_freertos_tcp.h +++ b/src/arch_freertos_tcp.h @@ -37,9 +37,6 @@ #define SO_REUSEADDR 0 #define sockaddr_in freertos_sockaddr #define sockaddr freertos_sockaddr -// struct sockaddr { -// uint8_t sa_len, sa_family; -// }; #define accept(a, b, c) FreeRTOS_accept((a), (b), (c)) #define connect(a, b, c) FreeRTOS_connect((a), (b), (c)) #define bind(a, b, c) FreeRTOS_bind((a), (b), (c)) diff --git a/src/net.c b/src/net.c index f8a95403..d3821f69 100644 --- a/src/net.c +++ b/src/net.c @@ -124,8 +124,9 @@ void mg_mgr_free(struct mg_mgr *mgr) { void mg_mgr_init(struct mg_mgr *mgr) { memset(mgr, 0, sizeof(*mgr)); #if defined(_WIN32) && MG_ENABLE_WINSOCK - WSADATA data; - WSAStartup(MAKEWORD(2, 2), &data); + // clang-format off + { WSADATA data; WSAStartup(MAKEWORD(2, 2), &data); } + // clang-format on #elif MG_ARCH == MG_ARCH_FREERTOS_TCP mgr->ss = FreeRTOS_CreateSocketSet(); #elif defined(__unix) || defined(__unix__) || defined(__APPLE__) diff --git a/src/util.c b/src/util.c index 3a98cae0..02a3306b 100644 --- a/src/util.c +++ b/src/util.c @@ -1,5 +1,6 @@ +#include "config.h" // Must go first - important for test++ + #include "util.h" -#include "config.h" #if MG_ENABLE_FS int mg_stat(const char *path, mg_stat_t *st) { @@ -84,7 +85,7 @@ bool mg_file_printf(const char *path, const char *fmt, ...) { if (buf != tmp) free(buf); return result; } -#endif +#endif // MG_ENABLE_FS void mg_random(void *buf, size_t len) { bool done = false; diff --git a/src/util.h b/src/util.h index 0f128eea..c430613b 100644 --- a/src/util.h +++ b/src/util.h @@ -82,4 +82,3 @@ FILE *mg_fopen(const char *fp, const char *mode); while (*h != (elem_)) h = &(*h)->next; \ *h = (elem_)->next; \ } while (0) -