mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-26 22:41:03 +08:00
Remove MG_ENABLE_DIRLIST
This commit is contained in:
parent
969b84043c
commit
5bc164de76
@ -241,7 +241,6 @@ Here is a list of build constants and their default values:
|
||||
|MG_ENABLE_LOG | 1 | Enable `LOG()` macro |
|
||||
|MG_ENABLE_MD5 | 0 | Use native MD5 implementation |
|
||||
|MG_ENABLE_SSI | 1 | Enable serving SSI files by `mg_http_serve_dir()` |
|
||||
|MG_ENABLE_DIRLIST | 0 | Enable directory listing |
|
||||
|MG_ENABLE_CUSTOM_RANDOM | 0 | Provide custom RNG function `mg_random()` |
|
||||
|MG_ENABLE_PACKED_FS | 0 | Enable embedded FS support |
|
||||
|MG_ENABLE_FATFS | 0 | Enable embedded FAT FS support |
|
||||
|
21
mongoose.c
21
mongoose.c
@ -3900,9 +3900,17 @@ const char *mg_strstr(const struct mg_str haystack,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool is_digit(int c) {
|
||||
return c >= '0' && c <= '9';
|
||||
}
|
||||
|
||||
static bool is_space(int c) {
|
||||
return c == ' ' || c == '\r' || c == '\n' || c == '\t';
|
||||
}
|
||||
|
||||
struct mg_str mg_strstrip(struct mg_str s) {
|
||||
while (s.len > 0 && isspace((int) *s.ptr)) s.ptr++, s.len--;
|
||||
while (s.len > 0 && isspace((int) *(s.ptr + s.len - 1))) s.len--;
|
||||
while (s.len > 0 && is_space((int) *s.ptr)) s.ptr++, s.len--;
|
||||
while (s.len > 0 && is_space((int) *(s.ptr + s.len - 1))) s.len--;
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -4115,14 +4123,14 @@ size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap) {
|
||||
if (c == '#') x++, c = fmt[++i];
|
||||
if (c == '-') minus++, c = fmt[++i];
|
||||
if (c == '0') pad = '0', c = fmt[++i];
|
||||
while (isdigit(c)) w *= 10, w += (size_t) (c - '0'), c = fmt[++i];
|
||||
while (is_digit(c)) w *= 10, w += (size_t) (c - '0'), c = fmt[++i];
|
||||
if (c == '.') {
|
||||
c = fmt[++i];
|
||||
if (c == '*') {
|
||||
pr = (size_t) va_arg(ap, int);
|
||||
c = fmt[++i];
|
||||
} else {
|
||||
while (isdigit(c)) pr *= 10, pr += (size_t) (c - '0'), c = fmt[++i];
|
||||
while (is_digit(c)) pr *= 10, pr += (size_t) (c - '0'), c = fmt[++i];
|
||||
}
|
||||
}
|
||||
while (c == 'h') c = fmt[++i]; // Treat h and hh as int
|
||||
@ -4170,7 +4178,10 @@ size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap) {
|
||||
if (n < len) buf[n] = '%';
|
||||
n++;
|
||||
} else {
|
||||
abort(); // Unsupported format specifier
|
||||
if (n < len) buf[n] = '%';
|
||||
n++;
|
||||
if (n < len) buf[n] = c;
|
||||
n++;
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
|
12
mongoose.h
12
mongoose.h
@ -121,7 +121,6 @@ extern "C" {
|
||||
#include <time.h>
|
||||
|
||||
#define MG_PATH_MAX 128
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
|
||||
#endif
|
||||
|
||||
@ -148,7 +147,6 @@ extern "C" {
|
||||
#include <esp_system.h>
|
||||
|
||||
#define MG_PATH_MAX 128
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
|
||||
#endif
|
||||
|
||||
@ -316,10 +314,6 @@ struct timeval {
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -409,10 +403,6 @@ typedef int socklen_t;
|
||||
#define S_ISDIR(x) (((x) &_S_IFMT) == _S_IFDIR)
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -466,7 +456,7 @@ typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 0
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_CUSTOM_RANDOM
|
||||
|
@ -18,6 +18,5 @@
|
||||
#include <time.h>
|
||||
|
||||
#define MG_PATH_MAX 128
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
|
||||
#endif
|
||||
|
@ -22,6 +22,5 @@
|
||||
#include <esp_system.h>
|
||||
|
||||
#define MG_PATH_MAX 128
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
|
||||
#endif
|
||||
|
@ -30,8 +30,4 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -86,8 +86,4 @@ typedef int socklen_t;
|
||||
#define S_ISDIR(x) (((x) &_S_IFMT) == _S_IFDIR)
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -50,7 +50,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 0
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_CUSTOM_RANDOM
|
||||
|
21
src/str.c
21
src/str.c
@ -81,9 +81,17 @@ const char *mg_strstr(const struct mg_str haystack,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool is_digit(int c) {
|
||||
return c >= '0' && c <= '9';
|
||||
}
|
||||
|
||||
static bool is_space(int c) {
|
||||
return c == ' ' || c == '\r' || c == '\n' || c == '\t';
|
||||
}
|
||||
|
||||
struct mg_str mg_strstrip(struct mg_str s) {
|
||||
while (s.len > 0 && isspace((int) *s.ptr)) s.ptr++, s.len--;
|
||||
while (s.len > 0 && isspace((int) *(s.ptr + s.len - 1))) s.len--;
|
||||
while (s.len > 0 && is_space((int) *s.ptr)) s.ptr++, s.len--;
|
||||
while (s.len > 0 && is_space((int) *(s.ptr + s.len - 1))) s.len--;
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -296,14 +304,14 @@ size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap) {
|
||||
if (c == '#') x++, c = fmt[++i];
|
||||
if (c == '-') minus++, c = fmt[++i];
|
||||
if (c == '0') pad = '0', c = fmt[++i];
|
||||
while (isdigit(c)) w *= 10, w += (size_t) (c - '0'), c = fmt[++i];
|
||||
while (is_digit(c)) w *= 10, w += (size_t) (c - '0'), c = fmt[++i];
|
||||
if (c == '.') {
|
||||
c = fmt[++i];
|
||||
if (c == '*') {
|
||||
pr = (size_t) va_arg(ap, int);
|
||||
c = fmt[++i];
|
||||
} else {
|
||||
while (isdigit(c)) pr *= 10, pr += (size_t) (c - '0'), c = fmt[++i];
|
||||
while (is_digit(c)) pr *= 10, pr += (size_t) (c - '0'), c = fmt[++i];
|
||||
}
|
||||
}
|
||||
while (c == 'h') c = fmt[++i]; // Treat h and hh as int
|
||||
@ -351,7 +359,10 @@ size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap) {
|
||||
if (n < len) buf[n] = '%';
|
||||
n++;
|
||||
} else {
|
||||
abort(); // Unsupported format specifier
|
||||
if (n < len) buf[n] = '%';
|
||||
n++;
|
||||
if (n < len) buf[n] = c;
|
||||
n++;
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
|
@ -18,3 +18,4 @@
|
||||
|
||||
#define MG_PATH_MAX 100
|
||||
#define MG_ENABLE_SOCKET 0
|
||||
#define MG_ENABLE_DIRLIST 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user