Nits to have tests pass

This commit is contained in:
cpq 2021-05-12 09:25:21 +01:00
parent 2b836504ab
commit a98e980c8f
7 changed files with 12 additions and 16 deletions

View File

@ -2442,8 +2442,9 @@ void mg_mgr_free(struct mg_mgr *mgr) {
void mg_mgr_init(struct mg_mgr *mgr) { void mg_mgr_init(struct mg_mgr *mgr) {
memset(mgr, 0, sizeof(*mgr)); memset(mgr, 0, sizeof(*mgr));
#if defined(_WIN32) && MG_ENABLE_WINSOCK #if defined(_WIN32) && MG_ENABLE_WINSOCK
WSADATA data; // clang-format off
WSAStartup(MAKEWORD(2, 2), &data); { WSADATA data; WSAStartup(MAKEWORD(2, 2), &data); }
// clang-format on
#elif MG_ARCH == MG_ARCH_FREERTOS_TCP #elif MG_ARCH == MG_ARCH_FREERTOS_TCP
mgr->ss = FreeRTOS_CreateSocketSet(); mgr->ss = FreeRTOS_CreateSocketSet();
#elif defined(__unix) || defined(__unix__) || defined(__APPLE__) #elif defined(__unix) || defined(__unix__) || defined(__APPLE__)
@ -4097,6 +4098,7 @@ struct mg_str mg_url_pass(const char *url) {
#if MG_ENABLE_FS #if MG_ENABLE_FS
int mg_stat(const char *path, mg_stat_t *st) { int mg_stat(const char *path, mg_stat_t *st) {
#ifdef _WIN32 #ifdef _WIN32
@ -4180,7 +4182,7 @@ bool mg_file_printf(const char *path, const char *fmt, ...) {
if (buf != tmp) free(buf); if (buf != tmp) free(buf);
return result; return result;
} }
#endif #endif // MG_ENABLE_FS
void mg_random(void *buf, size_t len) { void mg_random(void *buf, size_t len) {
bool done = false; bool done = false;

View File

@ -154,9 +154,6 @@
#define SO_REUSEADDR 0 #define SO_REUSEADDR 0
#define sockaddr_in freertos_sockaddr #define sockaddr_in freertos_sockaddr
#define sockaddr 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 accept(a, b, c) FreeRTOS_accept((a), (b), (c))
#define connect(a, b, c) FreeRTOS_connect((a), (b), (c)) #define connect(a, b, c) FreeRTOS_connect((a), (b), (c))
#define bind(a, b, c) FreeRTOS_bind((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); unsigned short mg_url_port(const char *url);
int mg_url_is_ssl(const char *url); int mg_url_is_ssl(const char *url);
struct mg_str mg_url_host(const char *url); struct mg_str mg_url_host(const char *url);

View File

@ -41,6 +41,6 @@
#include "arch_esp32.h" #include "arch_esp32.h"
#include "arch_esp8266.h" #include "arch_esp8266.h"
#include "arch_freertos.h" #include "arch_freertos_tcp.h"
#include "arch_unix.h" #include "arch_unix.h"
#include "arch_win32.h" #include "arch_win32.h"

View File

@ -37,9 +37,6 @@
#define SO_REUSEADDR 0 #define SO_REUSEADDR 0
#define sockaddr_in freertos_sockaddr #define sockaddr_in freertos_sockaddr
#define sockaddr 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 accept(a, b, c) FreeRTOS_accept((a), (b), (c))
#define connect(a, b, c) FreeRTOS_connect((a), (b), (c)) #define connect(a, b, c) FreeRTOS_connect((a), (b), (c))
#define bind(a, b, c) FreeRTOS_bind((a), (b), (c)) #define bind(a, b, c) FreeRTOS_bind((a), (b), (c))

View File

@ -124,8 +124,9 @@ void mg_mgr_free(struct mg_mgr *mgr) {
void mg_mgr_init(struct mg_mgr *mgr) { void mg_mgr_init(struct mg_mgr *mgr) {
memset(mgr, 0, sizeof(*mgr)); memset(mgr, 0, sizeof(*mgr));
#if defined(_WIN32) && MG_ENABLE_WINSOCK #if defined(_WIN32) && MG_ENABLE_WINSOCK
WSADATA data; // clang-format off
WSAStartup(MAKEWORD(2, 2), &data); { WSADATA data; WSAStartup(MAKEWORD(2, 2), &data); }
// clang-format on
#elif MG_ARCH == MG_ARCH_FREERTOS_TCP #elif MG_ARCH == MG_ARCH_FREERTOS_TCP
mgr->ss = FreeRTOS_CreateSocketSet(); mgr->ss = FreeRTOS_CreateSocketSet();
#elif defined(__unix) || defined(__unix__) || defined(__APPLE__) #elif defined(__unix) || defined(__unix__) || defined(__APPLE__)

View File

@ -1,5 +1,6 @@
#include "config.h" // Must go first - important for test++
#include "util.h" #include "util.h"
#include "config.h"
#if MG_ENABLE_FS #if MG_ENABLE_FS
int mg_stat(const char *path, mg_stat_t *st) { 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); if (buf != tmp) free(buf);
return result; return result;
} }
#endif #endif // MG_ENABLE_FS
void mg_random(void *buf, size_t len) { void mg_random(void *buf, size_t len) {
bool done = false; bool done = false;

View File

@ -82,4 +82,3 @@ FILE *mg_fopen(const char *fp, const char *mode);
while (*h != (elem_)) h = &(*h)->next; \ while (*h != (elem_)) h = &(*h)->next; \
*h = (elem_)->next; \ *h = (elem_)->next; \
} while (0) } while (0)