mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-26 22:41:03 +08:00
Fix build
This commit is contained in:
parent
2a3492766f
commit
fb0a9bc7e3
2
Makefile
2
Makefile
@ -1,7 +1,7 @@
|
||||
SRCS = mongoose.c test/unit_test.c test/packed_fs.c
|
||||
HDRS = $(wildcard src/*.h)
|
||||
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
|
||||
INCS ?= -Isrc -I.
|
||||
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) {
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -700,11 +700,8 @@ static size_t p_seek(void *fp, size_t offset) {
|
||||
#endif
|
||||
return (size_t) ftell((FILE *) fp);
|
||||
}
|
||||
|
||||
#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) {
|
||||
(void) path, (void) size, (void) mtime;
|
||||
@ -4161,8 +4158,6 @@ struct mg_str mg_url_pass(const char *url) {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if MG_ARCH == MG_ARCH_UNIX && defined(__APPLE__)
|
||||
#include <mach/mach_time.h>
|
||||
#endif
|
||||
|
10
mongoose.h
10
mongoose.h
@ -330,7 +330,10 @@ struct timeval {
|
||||
#include <unistd.h>
|
||||
|
||||
#define MG_INT64_FMT "%" PRId64
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -384,6 +387,7 @@ typedef enum { false = 0, true = 1 } bool;
|
||||
// Protect from calls like std::snprintf in app code
|
||||
// See https://github.com/cesanta/mongoose/issues/1047
|
||||
#ifndef __cplusplus
|
||||
#define sleep(x) Sleep(x)
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#ifndef strdup // For MSVC with _DEBUG, see #1359
|
||||
@ -417,8 +421,9 @@ typedef int socklen_t;
|
||||
|
||||
#define MG_INT64_FMT "%I64d"
|
||||
|
||||
#undef MG_ENABLE_DIRLIST
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
#endif
|
||||
|
||||
// https://lgtm.com/rules/2154840805/ -gmtime, localtime, ctime and asctime
|
||||
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);
|
||||
bool mg_file_write(const char *path, const void *buf, size_t len);
|
||||
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 };
|
||||
|
||||
// Filesystem API functions
|
||||
@ -860,6 +867,7 @@ void mg_mgr_wakeup(struct mg_connection *pipe);
|
||||
|
||||
|
||||
|
||||
|
||||
struct mg_http_header {
|
||||
struct mg_str name; // Header name
|
||||
struct mg_str value; // Header value
|
||||
|
@ -30,6 +30,9 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#define MG_INT64_FMT "%" PRId64
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -49,6 +49,7 @@ typedef enum { false = 0, true = 1 } bool;
|
||||
// Protect from calls like std::snprintf in app code
|
||||
// See https://github.com/cesanta/mongoose/issues/1047
|
||||
#ifndef __cplusplus
|
||||
#define sleep(x) Sleep(x)
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#ifndef strdup // For MSVC with _DEBUG, see #1359
|
||||
@ -82,8 +83,9 @@ typedef int socklen_t;
|
||||
|
||||
#define MG_INT64_FMT "%I64d"
|
||||
|
||||
#undef MG_ENABLE_DIRLIST
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
#endif
|
||||
|
||||
// https://lgtm.com/rules/2154840805/ -gmtime, localtime, ctime and asctime
|
||||
static __inline struct tm *gmtime_r(time_t *t, struct tm *tm) {
|
||||
|
1
src/fs.h
1
src/fs.h
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "arch.h"
|
||||
#include "config.h"
|
||||
|
||||
enum { MG_FS_READ = 1, MG_FS_WRITE = 2, MG_FS_DIR = 4 };
|
||||
|
||||
|
@ -185,11 +185,8 @@ static size_t p_seek(void *fp, size_t offset) {
|
||||
#endif
|
||||
return (size_t) ftell((FILE *) fp);
|
||||
}
|
||||
|
||||
#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) {
|
||||
(void) path, (void) size, (void) mtime;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "arch.h"
|
||||
#include "config.h"
|
||||
#include "fs.h"
|
||||
#include "net.h"
|
||||
|
@ -1,5 +1,3 @@
|
||||
#include "config.h" // Must go first - important for test++
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#if MG_ARCH == MG_ARCH_UNIX && defined(__APPLE__)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "arch.h"
|
||||
#include "config.h"
|
||||
#include "str.h"
|
||||
|
||||
char *mg_file_read(const char *path, size_t *size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user