Make mongoose more bare-metal Keil friendly. Declare settings after arch. Introduce MG_ENABLE_FILE

This commit is contained in:
Sergey Lyubka committed 2021-12-21 17:39:55 +00:00
1 parent 9e0f04dc8b
commit 30bfb245f5
13 files changed
+141 -123

No files matched your search

+4 -2
View File
@@ -6,6 +6,7 @@
#include <mach/mach_time.h>
#endif
#if MG_ENABLE_FILE
char *mg_file_read(const char *path, size_t *sizep) {
FILE *fp;
char *data = NULL;
@@ -47,6 +48,7 @@ bool mg_file_write(const char *path, const void *buf, size_t len) {
}
return result;
}
#endif
bool mg_file_printf(const char *path, const char *fmt, ...) {
char tmp[256], *buf = tmp;
@@ -355,8 +357,8 @@ unsigned long mg_millis(void) {
uint64_t ticks = mach_absolute_time();
static mach_timebase_info_data_t timebase;
mach_timebase_info(&timebase);
double ticks_to_nanos = (double)timebase.numer / timebase.denom;
uint64_t uptime_nanos = (uint64_t)(ticks_to_nanos * ticks);
double ticks_to_nanos = (double) timebase.numer / timebase.denom;
uint64_t uptime_nanos = (uint64_t) (ticks_to_nanos * ticks);
return (unsigned long) (uptime_nanos / 1000000);
#else
struct timespec ts;