mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-10 16:31:44 +00:00
Implement FS virtualization
This commit is contained in:
1 parent
9346122c29
commit
c2176f969b
28 files changed
+659
-732
No files matched your search
+2
-23
@@ -66,17 +66,6 @@ typedef int socklen_t;
|
||||
#ifndef EWOULDBLOCK
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#endif
|
||||
#define realpath(a, b) _fullpath((b), (a), MG_PATH_MAX)
|
||||
#define fopen(a, b) mg_fopen((a), (b))
|
||||
|
||||
// Later windows define _stati64 macro, older do not
|
||||
#ifdef _stati64
|
||||
#define stat _stat64
|
||||
#define _stat64(a, b) mg_stat((a), (b))
|
||||
#else
|
||||
#define stat _stati64
|
||||
#define _stati64(a, b) mg_stat((a), (b))
|
||||
#endif
|
||||
|
||||
#ifndef va_copy
|
||||
#ifdef __va_copy
|
||||
@@ -91,18 +80,8 @@ typedef int socklen_t;
|
||||
|
||||
#define MG_INT64_FMT "%I64d"
|
||||
|
||||
static __inline FILE *mg_fopen(const char *path, const char *mode) {
|
||||
wchar_t b1[MAX_PATH], b2[10];
|
||||
MultiByteToWideChar(CP_UTF8, 0, path, -1, b1, sizeof(b1) / sizeof(b1[0]));
|
||||
MultiByteToWideChar(CP_UTF8, 0, mode, -1, b2, sizeof(b2) / sizeof(b2[0]));
|
||||
return _wfopen(b1, b2);
|
||||
}
|
||||
|
||||
static __inline int mg_stat(const char *path, struct stat *st) {
|
||||
wchar_t tmp[MAX_PATH];
|
||||
MultiByteToWideChar(CP_UTF8, 0, path, -1, tmp, sizeof(tmp) / sizeof(tmp[0]));
|
||||
return _wstati64(tmp, st);
|
||||
}
|
||||
#undef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
|
||||
// https://lgtm.com/rules/2154840805/ -gmtime, localtime, ctime and asctime
|
||||
static __inline struct tm *gmtime_r(time_t *t, struct tm *tm) {
|
||||
|
||||
Reference in new issue
Block a user