diff --git a/Makefile b/Makefile index 4b3f63aa..4bedd3d9 100644 --- a/Makefile +++ b/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 -Wundef +WARN ?= -W -Wall -Werror -Wshadow -Wdouble-promotion -Wmissing-prototypes -Wstrict-prototypes -fno-common -Wconversion -Wundef OPTS ?= -O3 -g3 INCS ?= -Isrc -I. SSL ?= MBEDTLS @@ -62,7 +62,7 @@ unpacked: $(CC) -I. mongoose.c test/unit_test.c -o unit_test fuzzer: mongoose.c mongoose.h Makefile test/fuzz.c - clang mongoose.c test/fuzz.c $(WARN) $(INCS) -DMG_ENABLE_LINES -DMG_ENABLE_LOG=0 -fsanitize=fuzzer,signed-integer-overflow,address -g -o $@ + clang++ mongoose.c test/fuzz.c $(WARN) $(INCS) $(TFLAGS) $(EXTRA) -DMG_ENABLE_LINES -DMG_ENABLE_LOG=0 -fsanitize=fuzzer,signed-integer-overflow,address -Wno-deprecated -o $@ fuzz: fuzzer $(RUN) ./fuzzer diff --git a/mongoose.c b/mongoose.c index 0f2d9e67..b6b6bd04 100644 --- a/mongoose.c +++ b/mongoose.c @@ -632,6 +632,7 @@ struct packed_file { const char *mg_unpack(const char *path, size_t *size, time_t *mtime); const char *mg_unlist(size_t no); + #if MG_ENABLE_PACKED_FS #else const char *mg_unpack(const char *path, size_t *size, time_t *mtime) { diff --git a/mongoose.h b/mongoose.h index ad0ee86a..a33eb424 100644 --- a/mongoose.h +++ b/mongoose.h @@ -562,6 +562,7 @@ size_t mg_asprintf(char **, size_t, const char *fmt, ...) PRINTF_LIKE(3, 4); size_t mg_vasprintf(char **buf, size_t size, const char *fmt, va_list ap); int mg_check_ip_acl(struct mg_str acl, uint32_t remote_ip); int64_t mg_to64(struct mg_str str); +size_t mg_lld(char *buf, int64_t val, bool is_signed, bool is_hex); @@ -1141,7 +1142,6 @@ void mg_resolve_cancel(struct mg_connection *); bool mg_dns_parse(const uint8_t *buf, size_t len, struct mg_dns_message *); size_t mg_dns_parse_rr(const uint8_t *buf, size_t len, size_t ofs, bool is_question, struct mg_dns_rr *); -size_t mg_dns_decode_name(const uint8_t *, size_t, size_t, char *, size_t); #ifdef __cplusplus } diff --git a/src/dns.h b/src/dns.h index bc723f46..a186f4d2 100644 --- a/src/dns.h +++ b/src/dns.h @@ -36,4 +36,3 @@ void mg_resolve_cancel(struct mg_connection *); bool mg_dns_parse(const uint8_t *buf, size_t len, struct mg_dns_message *); size_t mg_dns_parse_rr(const uint8_t *buf, size_t len, size_t ofs, bool is_question, struct mg_dns_rr *); -size_t mg_dns_decode_name(const uint8_t *, size_t, size_t, char *, size_t); diff --git a/src/fs_packed.c b/src/fs_packed.c index a7acaadd..179666fb 100644 --- a/src/fs_packed.c +++ b/src/fs_packed.c @@ -9,6 +9,7 @@ struct packed_file { const char *mg_unpack(const char *path, size_t *size, time_t *mtime); const char *mg_unlist(size_t no); + #if MG_ENABLE_PACKED_FS #else const char *mg_unpack(const char *path, size_t *size, time_t *mtime) { diff --git a/src/str.h b/src/str.h index 53348b31..2dc752ed 100644 --- a/src/str.h +++ b/src/str.h @@ -41,3 +41,4 @@ size_t mg_asprintf(char **, size_t, const char *fmt, ...) PRINTF_LIKE(3, 4); size_t mg_vasprintf(char **buf, size_t size, const char *fmt, va_list ap); int mg_check_ip_acl(struct mg_str acl, uint32_t remote_ip); int64_t mg_to64(struct mg_str str); +size_t mg_lld(char *buf, int64_t val, bool is_signed, bool is_hex); diff --git a/test/mongoose_custom.c b/test/mongoose_custom.c index cf251571..99a117b6 100644 --- a/test/mongoose_custom.c +++ b/test/mongoose_custom.c @@ -33,5 +33,6 @@ struct mg_connection *mg_mkpipe(struct mg_mgr *mgr, mg_event_handler_t fn, return NULL; } +void _fini(void); void _fini(void) { } diff --git a/test/pack.c b/test/pack.c index 8cbce213..225da46b 100644 --- a/test/pack.c +++ b/test/pack.c @@ -25,6 +25,8 @@ #include static const char *code = + "const char *mg_unpack(const char *path, size_t *size, time_t *mtime);\n" + "const char *mg_unlist(size_t no);\n" "const char *mg_unlist(size_t no) {\n" " return packed_files[no].name;\n" "}\n"