mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-19 08:03:14 +08:00
Squash warnings
This commit is contained in:
parent
b7406357c5
commit
6149b619e7
3
Makefile
3
Makefile
@ -9,7 +9,8 @@ INCS ?= -Isrc -I.
|
||||
SSL ?= MBEDTLS
|
||||
CWD ?= $(realpath $(CURDIR))
|
||||
ENV ?= -e Tmp=. -e WINEDEBUG=-all
|
||||
DOCKER ?= docker run --platform linux/amd64 --rm $(ENV) -v $(CWD):$(CWD) -w $(CWD)
|
||||
DOCKERCMD ?= docker
|
||||
DOCKER ?= $(DOCKERCMD) run --rm $(ENV) -v $(CWD):$(CWD) -w $(CWD)
|
||||
VCFLAGS = /nologo /W3 /O2 /MD /I. $(DEFS) $(TFLAGS)
|
||||
IPV6 ?= 1
|
||||
ASAN ?= -fsanitize=address,undefined -fno-sanitize-recover=all
|
||||
|
@ -3912,8 +3912,8 @@ void mg_sha1_final(unsigned char digest[20], mg_sha1_ctx *context) {
|
||||
|
||||
|
||||
|
||||
#define SNTP_TIME_OFFSET 2208988800UL // (1970 - 1900) in seconds
|
||||
#define SNTP_MAX_FRAC 4294967295.0 // 2 ** 32 - 1
|
||||
#define SNTP_TIME_OFFSET 2208988800U // (1970 - 1900) in seconds
|
||||
#define SNTP_MAX_FRAC 4294967295.0 // 2 ** 32 - 1
|
||||
|
||||
static int64_t gettimestamp(const uint32_t *data) {
|
||||
uint32_t sec = mg_ntohl(data[0]), frac = mg_ntohl(data[1]);
|
||||
@ -3970,9 +3970,10 @@ void mg_sntp_request(struct mg_connection *c) {
|
||||
uint64_t now = mg_millis();
|
||||
uint8_t buf[48] = {0};
|
||||
uint32_t *t = (uint32_t *) &buf[40];
|
||||
double frac = ((double) (now % 1000)) / 1000.0;
|
||||
buf[0] = (0 << 6) | (4 << 3) | 3;
|
||||
t[0] = mg_htonl((uint32_t) (now / 1000) + SNTP_TIME_OFFSET);
|
||||
t[1] = mg_htonl((uint32_t) ((now % 1000) / 1000.0 * SNTP_MAX_FRAC));
|
||||
t[1] = mg_htonl((uint32_t) ((uint32_t) (frac * SNTP_MAX_FRAC)));
|
||||
mg_send(c, buf, sizeof(buf));
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
#define SNTP_TIME_OFFSET 2208988800UL // (1970 - 1900) in seconds
|
||||
#define SNTP_MAX_FRAC 4294967295.0 // 2 ** 32 - 1
|
||||
#define SNTP_TIME_OFFSET 2208988800U // (1970 - 1900) in seconds
|
||||
#define SNTP_MAX_FRAC 4294967295.0 // 2 ** 32 - 1
|
||||
|
||||
static int64_t gettimestamp(const uint32_t *data) {
|
||||
uint32_t sec = mg_ntohl(data[0]), frac = mg_ntohl(data[1]);
|
||||
@ -62,9 +62,10 @@ void mg_sntp_request(struct mg_connection *c) {
|
||||
uint64_t now = mg_millis();
|
||||
uint8_t buf[48] = {0};
|
||||
uint32_t *t = (uint32_t *) &buf[40];
|
||||
double frac = ((double) (now % 1000)) / 1000.0;
|
||||
buf[0] = (0 << 6) | (4 << 3) | 3;
|
||||
t[0] = mg_htonl((uint32_t) (now / 1000) + SNTP_TIME_OFFSET);
|
||||
t[1] = mg_htonl((uint32_t) ((now % 1000) / 1000.0 * SNTP_MAX_FRAC));
|
||||
t[1] = mg_htonl((uint32_t) ((uint32_t) (frac * SNTP_MAX_FRAC)));
|
||||
mg_send(c, buf, sizeof(buf));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user