Cleanup on riscv baremetal build

This commit is contained in:
Sergey Lyubka committed 2021-07-24 11:40:52 +01:00
1 parent d6dbf831f7
commit cddff2b1b8
4 files changed
+11 -15

No files matched your search

+5 -7
View File
@@ -966,8 +966,9 @@ void mg_http_serve_file(struct mg_connection *c, struct mg_http_message *hm,
"Content-Range: bytes " MG_INT64_FMT "-" MG_INT64_FMT "Content-Range: bytes " MG_INT64_FMT "-" MG_INT64_FMT
"/" MG_INT64_FMT "\r\n", "/" MG_INT64_FMT "\r\n",
r1, r1 + cl - 1, (int64_t) st.st_size); r1, r1 + cl - 1, (int64_t) st.st_size);
#if _FILE_OFFSET_BITS == 64 || _POSIX_C_SOURCE >= 200112L || \ #if defined(_FILE_OFFSET_BITS) && \
_XOPEN_SOURCE >= 600 (_FILE_OFFSET_BITS == 64 || _POSIX_C_SOURCE >= 200112L || \
_XOPEN_SOURCE >= 600)
fseeko(fp, (off_t) r1, SEEK_SET); fseeko(fp, (off_t) r1, SEEK_SET);
#else #else
fseek(fp, (long) r1, SEEK_SET); fseek(fp, (long) r1, SEEK_SET);
@@ -1576,8 +1577,6 @@ void mg_iobuf_free(struct mg_iobuf *io) {
#if MG_ENABLE_MGOS
#else
#if MG_ENABLE_LOG #if MG_ENABLE_LOG
static void mg_log_stdout(const void *buf, size_t len, void *userdata) { static void mg_log_stdout(const void *buf, size_t len, void *userdata) {
(void) userdata; (void) userdata;
@@ -1644,7 +1643,6 @@ void mg_log_set_callback(void (*fn)(const void *, size_t, void *), void *fnd) {
s_fn_param = fnd; s_fn_param = fnd;
} }
#endif #endif
#endif
#ifdef MG_ENABLE_LINES #ifdef MG_ENABLE_LINES
#line 1 "src/md5.c" #line 1 "src/md5.c"
@@ -2544,7 +2542,7 @@ void mg_hmac_sha1(const unsigned char *key, size_t keylen,
#define SNTP_INTERVAL_SEC (3600) #define SNTP_INTERVAL_SEC (3600)
#define SNTP_TIME_OFFSET 2208988800 #define SNTP_TIME_OFFSET 2208988800UL
static unsigned long s_sntmp_next; static unsigned long s_sntmp_next;
@@ -2560,7 +2558,7 @@ int mg_sntp_parse(const unsigned char *buf, size_t len, struct timeval *tv) {
LOG(LL_ERROR, ("%s", "server sent a kiss of death")); LOG(LL_ERROR, ("%s", "server sent a kiss of death"));
} else { } else {
uint32_t *data = (uint32_t *) &buf[40]; uint32_t *data = (uint32_t *) &buf[40];
tv->tv_sec = mg_ntohl(data[0]) - SNTP_TIME_OFFSET; tv->tv_sec = (time_t)(mg_ntohl(data[0]) - SNTP_TIME_OFFSET);
tv->tv_usec = (suseconds_t) mg_ntohl(data[1]); tv->tv_usec = (suseconds_t) mg_ntohl(data[1]);
s_sntmp_next = (unsigned long) (tv->tv_sec + SNTP_INTERVAL_SEC); s_sntmp_next = (unsigned long) (tv->tv_sec + SNTP_INTERVAL_SEC);
res = 0; res = 0;
+3 -2
View File
@@ -547,8 +547,9 @@ void mg_http_serve_file(struct mg_connection *c, struct mg_http_message *hm,
"Content-Range: bytes " MG_INT64_FMT "-" MG_INT64_FMT "Content-Range: bytes " MG_INT64_FMT "-" MG_INT64_FMT
"/" MG_INT64_FMT "\r\n", "/" MG_INT64_FMT "\r\n",
r1, r1 + cl - 1, (int64_t) st.st_size); r1, r1 + cl - 1, (int64_t) st.st_size);
#if _FILE_OFFSET_BITS == 64 || _POSIX_C_SOURCE >= 200112L || \ #if defined(_FILE_OFFSET_BITS) && \
_XOPEN_SOURCE >= 600 (_FILE_OFFSET_BITS == 64 || _POSIX_C_SOURCE >= 200112L || \
_XOPEN_SOURCE >= 600)
fseeko(fp, (off_t) r1, SEEK_SET); fseeko(fp, (off_t) r1, SEEK_SET);
#else #else
fseek(fp, (long) r1, SEEK_SET); fseek(fp, (long) r1, SEEK_SET);
-3
View File
@@ -1,8 +1,6 @@
#include "log.h" #include "log.h"
#include "util.h" #include "util.h"
#if MG_ENABLE_MGOS
#else
#if MG_ENABLE_LOG #if MG_ENABLE_LOG
static void mg_log_stdout(const void *buf, size_t len, void *userdata) { static void mg_log_stdout(const void *buf, size_t len, void *userdata) {
(void) userdata; (void) userdata;
@@ -69,4 +67,3 @@ void mg_log_set_callback(void (*fn)(const void *, size_t, void *), void *fnd) {
s_fn_param = fnd; s_fn_param = fnd;
} }
#endif #endif
#endif
+3 -3
View File
@@ -1,11 +1,11 @@
#include "sntp.h"
#include "arch.h" #include "arch.h"
#include "event.h" #include "event.h"
#include "log.h" #include "log.h"
#include "sntp.h"
#include "util.h" #include "util.h"
#define SNTP_INTERVAL_SEC (3600) #define SNTP_INTERVAL_SEC (3600)
#define SNTP_TIME_OFFSET 2208988800 #define SNTP_TIME_OFFSET 2208988800UL
static unsigned long s_sntmp_next; static unsigned long s_sntmp_next;
@@ -21,7 +21,7 @@ int mg_sntp_parse(const unsigned char *buf, size_t len, struct timeval *tv) {
LOG(LL_ERROR, ("%s", "server sent a kiss of death")); LOG(LL_ERROR, ("%s", "server sent a kiss of death"));
} else { } else {
uint32_t *data = (uint32_t *) &buf[40]; uint32_t *data = (uint32_t *) &buf[40];
tv->tv_sec = mg_ntohl(data[0]) - SNTP_TIME_OFFSET; tv->tv_sec = (time_t)(mg_ntohl(data[0]) - SNTP_TIME_OFFSET);
tv->tv_usec = (suseconds_t) mg_ntohl(data[1]); tv->tv_usec = (suseconds_t) mg_ntohl(data[1]);
s_sntmp_next = (unsigned long) (tv->tv_sec + SNTP_INTERVAL_SEC); s_sntmp_next = (unsigned long) (tv->tv_sec + SNTP_INTERVAL_SEC);
res = 0; res = 0;