Unbreak my heart ^W the build

This commit is contained in:
Sergey Lyubka 2022-07-01 18:10:40 +01:00
parent f1da8542ce
commit d6e1a3ab4c
5 changed files with 82 additions and 94 deletions

View File

@ -907,54 +907,6 @@ bool mg_file_printf(struct mg_fs *fs, const char *path, const char *fmt, ...) {
return result;
}
#ifdef MG_ENABLE_LINES
#line 1 "src/fs_dummy.c"
#endif
static int d_stat(const char *path, size_t *size, time_t *mtime) {
(void) path, (void) size, (void) mtime;
return 0;
}
static void d_list(const char *path, void (*fn)(const char *, void *),
void *userdata) {
(void) path, (void) fn, (void) userdata;
}
static void *d_open(const char *path, int flags) {
(void) path, (void) flags;
return NULL;
}
static void d_close(void *fp) {
(void) fp;
}
static size_t d_read(void *fd, void *buf, size_t len) {
(void) fd, (void) buf, (void) len;
return 0;
}
static size_t d_write(void *fd, const void *buf, size_t len) {
(void) fd, (void) buf, (void) len;
return 0;
}
static size_t d_seek(void *fd, size_t offset) {
(void) fd, (void) offset;
return (size_t) ~0;
}
static bool d_rename(const char *from, const char *to) {
(void) from, (void) to;
return false;
}
static bool d_remove(const char *path) {
(void) path;
return false;
}
static bool d_mkdir(const char *path) {
(void) path;
return false;
}
struct mg_fs mg_fs_dummy = {d_stat, d_list, d_open, d_close, d_read,
d_write, d_seek, d_rename, d_remove, d_mkdir};
#ifdef MG_ENABLE_LINES
#line 1 "src/fs_fat.c"
#endif
@ -1413,6 +1365,47 @@ static bool p_mkdir(const char *path) {
return mkdir(path, 0775) == 0;
}
#else
static int p_stat(const char *path, size_t *size, time_t *mtime) {
(void) path, (void) size, (void) mtime;
return 0;
}
static void p_list(const char *path, void (*fn)(const char *, void *),
void *userdata) {
(void) path, (void) fn, (void) userdata;
}
static void *p_open(const char *path, int flags) {
(void) path, (void) flags;
return NULL;
}
static void p_close(void *fp) {
(void) fp;
}
static size_t p_read(void *fd, void *buf, size_t len) {
(void) fd, (void) buf, (void) len;
return 0;
}
static size_t p_write(void *fd, const void *buf, size_t len) {
(void) fd, (void) buf, (void) len;
return 0;
}
static size_t p_seek(void *fd, size_t offset) {
(void) fd, (void) offset;
return (size_t) ~0;
}
static bool p_rename(const char *from, const char *to) {
(void) from, (void) to;
return false;
}
static bool p_remove(const char *path) {
(void) path;
return false;
}
static bool p_mkdir(const char *path) {
(void) path;
return false;
}
#endif
struct mg_fs mg_fs_posix = {p_stat, p_list, p_open, p_close, p_read,

View File

@ -821,7 +821,6 @@ struct mg_fs {
bool (*mkd)(const char *path); // Create directory
};
extern struct mg_fs mg_fs_dummy; // Dummy FS, does nothing
extern struct mg_fs mg_fs_posix; // POSIX open/close/read/write/seek
extern struct mg_fs mg_fs_packed; // Packed FS, see examples/device-dashboard
extern struct mg_fs mg_fs_fat; // FAT FS

View File

@ -25,7 +25,6 @@ struct mg_fs {
bool (*mkd)(const char *path); // Create directory
};
extern struct mg_fs mg_fs_dummy; // Dummy FS, does nothing
extern struct mg_fs mg_fs_posix; // POSIX open/close/read/write/seek
extern struct mg_fs mg_fs_packed; // Packed FS, see examples/device-dashboard
extern struct mg_fs mg_fs_fat; // FAT FS

View File

@ -1,44 +0,0 @@
#include "fs.h"
static int d_stat(const char *path, size_t *size, time_t *mtime) {
(void) path, (void) size, (void) mtime;
return 0;
}
static void d_list(const char *path, void (*fn)(const char *, void *),
void *userdata) {
(void) path, (void) fn, (void) userdata;
}
static void *d_open(const char *path, int flags) {
(void) path, (void) flags;
return NULL;
}
static void d_close(void *fp) {
(void) fp;
}
static size_t d_read(void *fd, void *buf, size_t len) {
(void) fd, (void) buf, (void) len;
return 0;
}
static size_t d_write(void *fd, const void *buf, size_t len) {
(void) fd, (void) buf, (void) len;
return 0;
}
static size_t d_seek(void *fd, size_t offset) {
(void) fd, (void) offset;
return (size_t) ~0;
}
static bool d_rename(const char *from, const char *to) {
(void) from, (void) to;
return false;
}
static bool d_remove(const char *path) {
(void) path;
return false;
}
static bool d_mkdir(const char *path) {
(void) path;
return false;
}
struct mg_fs mg_fs_dummy = {d_stat, d_list, d_open, d_close, d_read,
d_write, d_seek, d_rename, d_remove, d_mkdir};

View File

@ -202,6 +202,47 @@ static bool p_mkdir(const char *path) {
return mkdir(path, 0775) == 0;
}
#else
static int p_stat(const char *path, size_t *size, time_t *mtime) {
(void) path, (void) size, (void) mtime;
return 0;
}
static void p_list(const char *path, void (*fn)(const char *, void *),
void *userdata) {
(void) path, (void) fn, (void) userdata;
}
static void *p_open(const char *path, int flags) {
(void) path, (void) flags;
return NULL;
}
static void p_close(void *fp) {
(void) fp;
}
static size_t p_read(void *fd, void *buf, size_t len) {
(void) fd, (void) buf, (void) len;
return 0;
}
static size_t p_write(void *fd, const void *buf, size_t len) {
(void) fd, (void) buf, (void) len;
return 0;
}
static size_t p_seek(void *fd, size_t offset) {
(void) fd, (void) offset;
return (size_t) ~0;
}
static bool p_rename(const char *from, const char *to) {
(void) from, (void) to;
return false;
}
static bool p_remove(const char *path) {
(void) path;
return false;
}
static bool p_mkdir(const char *path) {
(void) path;
return false;
}
#endif
struct mg_fs mg_fs_posix = {p_stat, p_list, p_open, p_close, p_read,