mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-23 20:11:49 +00:00
Fix build
This commit is contained in:
1 parent
2a3492766f
commit
fb0a9bc7e3
11 files changed
+22
-16
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
SRCS = mongoose.c test/unit_test.c test/packed_fs.c
|
SRCS = mongoose.c test/unit_test.c test/packed_fs.c
|
||||||
HDRS = $(wildcard src/*.h)
|
HDRS = $(wildcard src/*.h)
|
||||||
DEFS ?= -DMG_MAX_HTTP_HEADERS=7 -DMG_ENABLE_LINES -DMG_ENABLE_PACKED_FS=1
|
DEFS ?= -DMG_MAX_HTTP_HEADERS=7 -DMG_ENABLE_LINES -DMG_ENABLE_PACKED_FS=1
|
||||||
WARN ?= -W -Wall -Werror -Wshadow -Wdouble-promotion -fno-common -Wconversion -Wmissing-prototypes -Wundef
|
WARN ?= -W -Wall -Werror -Wshadow -Wdouble-promotion -fno-common -Wconversion -Wundef
|
||||||
OPTS ?= -O3 -g3
|
OPTS ?= -O3 -g3
|
||||||
INCS ?= -Isrc -I.
|
INCS ?= -Isrc -I.
|
||||||
CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
|
CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) $(EXTRA)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ static void start_thread(void (*f)(void *), void *p) {
|
|||||||
|
|
||||||
static void thread_function(void *param) {
|
static void thread_function(void *param) {
|
||||||
struct mg_connection *c = param; // Pipe connection
|
struct mg_connection *c = param; // Pipe connection
|
||||||
mg_usleep(2 * 1000000); // Simulate long execution
|
sleep(2); // Simulate long execution
|
||||||
mg_mgr_wakeup(c); // Wakeup event manager
|
mg_mgr_wakeup(c); // Wakeup event manager
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-6
@@ -700,11 +700,8 @@ static size_t p_seek(void *fp, size_t offset) {
|
|||||||
#endif
|
#endif
|
||||||
return (size_t) ftell((FILE *) fp);
|
return (size_t) ftell((FILE *) fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static char *p_realpath(const char *path, char *resolved_path) {
|
|
||||||
(void) path, (void) resolved_path;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int p_stat(const char *path, size_t *size, time_t *mtime) {
|
static int p_stat(const char *path, size_t *size, time_t *mtime) {
|
||||||
(void) path, (void) size, (void) mtime;
|
(void) path, (void) size, (void) mtime;
|
||||||
@@ -4161,8 +4158,6 @@ struct mg_str mg_url_pass(const char *url) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if MG_ARCH == MG_ARCH_UNIX && defined(__APPLE__)
|
#if MG_ARCH == MG_ARCH_UNIX && defined(__APPLE__)
|
||||||
#include <mach/mach_time.h>
|
#include <mach/mach_time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+9
-1
@@ -330,7 +330,10 @@ struct timeval {
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define MG_INT64_FMT "%" PRId64
|
#define MG_INT64_FMT "%" PRId64
|
||||||
|
|
||||||
|
#ifndef MG_ENABLE_DIRLIST
|
||||||
#define MG_ENABLE_DIRLIST 1
|
#define MG_ENABLE_DIRLIST 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -384,6 +387,7 @@ typedef enum { false = 0, true = 1 } bool;
|
|||||||
// Protect from calls like std::snprintf in app code
|
// Protect from calls like std::snprintf in app code
|
||||||
// See https://github.com/cesanta/mongoose/issues/1047
|
// See https://github.com/cesanta/mongoose/issues/1047
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
|
#define sleep(x) Sleep(x)
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
#ifndef strdup // For MSVC with _DEBUG, see #1359
|
#ifndef strdup // For MSVC with _DEBUG, see #1359
|
||||||
@@ -417,8 +421,9 @@ typedef int socklen_t;
|
|||||||
|
|
||||||
#define MG_INT64_FMT "%I64d"
|
#define MG_INT64_FMT "%I64d"
|
||||||
|
|
||||||
#undef MG_ENABLE_DIRLIST
|
#ifndef MG_ENABLE_DIRLIST
|
||||||
#define MG_ENABLE_DIRLIST 1
|
#define MG_ENABLE_DIRLIST 1
|
||||||
|
#endif
|
||||||
|
|
||||||
// https://lgtm.com/rules/2154840805/ -gmtime, localtime, ctime and asctime
|
// https://lgtm.com/rules/2154840805/ -gmtime, localtime, ctime and asctime
|
||||||
static __inline struct tm *gmtime_r(time_t *t, struct tm *tm) {
|
static __inline struct tm *gmtime_r(time_t *t, struct tm *tm) {
|
||||||
@@ -598,6 +603,7 @@ void mg_timer_poll(unsigned long current_time_ms);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char *mg_file_read(const char *path, size_t *size);
|
char *mg_file_read(const char *path, size_t *size);
|
||||||
bool mg_file_write(const char *path, const void *buf, size_t len);
|
bool mg_file_write(const char *path, const void *buf, size_t len);
|
||||||
bool mg_file_printf(const char *path, const char *fmt, ...);
|
bool mg_file_printf(const char *path, const char *fmt, ...);
|
||||||
@@ -664,6 +670,7 @@ unsigned long mg_millis(void);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enum { MG_FS_READ = 1, MG_FS_WRITE = 2, MG_FS_DIR = 4 };
|
enum { MG_FS_READ = 1, MG_FS_WRITE = 2, MG_FS_DIR = 4 };
|
||||||
|
|
||||||
// Filesystem API functions
|
// Filesystem API functions
|
||||||
@@ -860,6 +867,7 @@ void mg_mgr_wakeup(struct mg_connection *pipe);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct mg_http_header {
|
struct mg_http_header {
|
||||||
struct mg_str name; // Header name
|
struct mg_str name; // Header name
|
||||||
struct mg_str value; // Header value
|
struct mg_str value; // Header value
|
||||||
|
|||||||
@@ -30,6 +30,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define MG_INT64_FMT "%" PRId64
|
#define MG_INT64_FMT "%" PRId64
|
||||||
|
|
||||||
|
#ifndef MG_ENABLE_DIRLIST
|
||||||
#define MG_ENABLE_DIRLIST 1
|
#define MG_ENABLE_DIRLIST 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+3
-1
@@ -49,6 +49,7 @@ typedef enum { false = 0, true = 1 } bool;
|
|||||||
// Protect from calls like std::snprintf in app code
|
// Protect from calls like std::snprintf in app code
|
||||||
// See https://github.com/cesanta/mongoose/issues/1047
|
// See https://github.com/cesanta/mongoose/issues/1047
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
|
#define sleep(x) Sleep(x)
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
#ifndef strdup // For MSVC with _DEBUG, see #1359
|
#ifndef strdup // For MSVC with _DEBUG, see #1359
|
||||||
@@ -82,8 +83,9 @@ typedef int socklen_t;
|
|||||||
|
|
||||||
#define MG_INT64_FMT "%I64d"
|
#define MG_INT64_FMT "%I64d"
|
||||||
|
|
||||||
#undef MG_ENABLE_DIRLIST
|
#ifndef MG_ENABLE_DIRLIST
|
||||||
#define MG_ENABLE_DIRLIST 1
|
#define MG_ENABLE_DIRLIST 1
|
||||||
|
#endif
|
||||||
|
|
||||||
// https://lgtm.com/rules/2154840805/ -gmtime, localtime, ctime and asctime
|
// https://lgtm.com/rules/2154840805/ -gmtime, localtime, ctime and asctime
|
||||||
static __inline struct tm *gmtime_r(time_t *t, struct tm *tm) {
|
static __inline struct tm *gmtime_r(time_t *t, struct tm *tm) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "arch.h"
|
#include "arch.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
enum { MG_FS_READ = 1, MG_FS_WRITE = 2, MG_FS_DIR = 4 };
|
enum { MG_FS_READ = 1, MG_FS_WRITE = 2, MG_FS_DIR = 4 };
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -185,11 +185,8 @@ static size_t p_seek(void *fp, size_t offset) {
|
|||||||
#endif
|
#endif
|
||||||
return (size_t) ftell((FILE *) fp);
|
return (size_t) ftell((FILE *) fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static char *p_realpath(const char *path, char *resolved_path) {
|
|
||||||
(void) path, (void) resolved_path;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int p_stat(const char *path, size_t *size, time_t *mtime) {
|
static int p_stat(const char *path, size_t *size, time_t *mtime) {
|
||||||
(void) path, (void) size, (void) mtime;
|
(void) path, (void) size, (void) mtime;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "arch.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#include "config.h" // Must go first - important for test++
|
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#if MG_ARCH == MG_ARCH_UNIX && defined(__APPLE__)
|
#if MG_ARCH == MG_ARCH_UNIX && defined(__APPLE__)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "arch.h"
|
#include "arch.h"
|
||||||
|
#include "config.h"
|
||||||
#include "str.h"
|
#include "str.h"
|
||||||
|
|
||||||
char *mg_file_read(const char *path, size_t *size);
|
char *mg_file_read(const char *path, size_t *size);
|
||||||
|
|||||||
Reference in new issue
Block a user