mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-30 12:50:58 +00:00
MG_ENABLE_FS -> MG_ENABLE_STDIO
This commit is contained in:
1 parent
8e5efd4804
commit
529faa1172
11 files changed
+55
-52
No files matched your search
@@ -17,7 +17,7 @@ struct timeval {
|
||||
};
|
||||
#endif
|
||||
|
||||
#if MG_ENABLE_FS
|
||||
#if MG_ENABLE_STDIO
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#if MG_ENABLE_FS
|
||||
#if MG_ENABLE_STDIO
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@
|
||||
#define MG_ENABLE_OPENSSL 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_FS
|
||||
#define MG_ENABLE_FS 1
|
||||
#ifndef MG_ENABLE_STDIO
|
||||
#define MG_ENABLE_STDIO 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_SSI
|
||||
|
||||
+1
-1
@@ -364,7 +364,7 @@ void mg_http_reply(struct mg_connection *c, int code, const char *headers,
|
||||
if (buf != mem) free(buf);
|
||||
}
|
||||
|
||||
#if MG_ENABLE_FS
|
||||
#if MG_ENABLE_STDIO
|
||||
static void http_cb(struct mg_connection *, int, void *, void *);
|
||||
static void restore_http_cb(struct mg_connection *c) {
|
||||
if (c->pfn_data != NULL) fclose((FILE *) c->pfn_data);
|
||||
|
||||
+8
-7
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#if MG_ENABLE_FS
|
||||
#if MG_ENABLE_STDIO
|
||||
int mg_stat(const char *path, mg_stat_t *st) {
|
||||
#ifdef _WIN32
|
||||
wchar_t tmp[MG_PATH_MAX];
|
||||
@@ -74,7 +74,7 @@ bool mg_file_printf(const char *path, const char *fmt, ...) {
|
||||
if (buf != tmp) free(buf);
|
||||
return result;
|
||||
}
|
||||
#endif // MG_ENABLE_FS
|
||||
#endif // MG_ENABLE_STDIO
|
||||
|
||||
void mg_random(void *buf, size_t len) {
|
||||
bool done = false;
|
||||
@@ -82,14 +82,14 @@ void mg_random(void *buf, size_t len) {
|
||||
#if MG_ARCH == MG_ARCH_ESP32
|
||||
while (len--) *p++ = (unsigned char) (esp_random() & 255);
|
||||
#elif MG_ARCH == MG_ARCH_WIN32
|
||||
#elif MG_ARCH_UNIX && MG_ENABLE_FS
|
||||
#elif MG_ARCH_UNIX && MG_ENABLE_STDIO
|
||||
FILE *fp = fopen("/dev/urandom", "rb");
|
||||
if (fp != NULL) {
|
||||
if (fread(buf, 1, len, fp) == len) done = true;
|
||||
fclose(fp);
|
||||
}
|
||||
#endif
|
||||
// Fallback to a pseudo random gen
|
||||
// Fallback to a pseudo random gen
|
||||
if (!done) {
|
||||
while (len--) *p++ = (unsigned char) (rand() & 255);
|
||||
}
|
||||
@@ -186,9 +186,10 @@ char *mg_hex(const void *buf, size_t len, char *to) {
|
||||
}
|
||||
|
||||
static unsigned char mg_unhex_nimble(unsigned char c) {
|
||||
return (c >= '0' && c <= '9') ? (unsigned char) (c - '0')
|
||||
: (c >= 'A' && c <= 'F') ? (unsigned char) (c - '7')
|
||||
: (unsigned char) (c - 'W');
|
||||
return (c >= '0' && c <= '9')
|
||||
? (unsigned char) (c - '0')
|
||||
: (c >= 'A' && c <= 'F') ? (unsigned char) (c - '7')
|
||||
: (unsigned char) (c - 'W');
|
||||
}
|
||||
|
||||
unsigned long mg_unhexn(const char *s, size_t len) {
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ double mg_time(void);
|
||||
unsigned long mg_millis(void);
|
||||
void mg_usleep(unsigned long usecs);
|
||||
|
||||
#if MG_ENABLE_FS
|
||||
#if MG_ENABLE_STDIO
|
||||
#ifdef _WIN32
|
||||
typedef struct _stati64 mg_stat_t;
|
||||
#else
|
||||
|
||||
Reference in new issue
Block a user