From d46798c2a7cee5657a5d579a9104de5d9dba6394 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Mon, 8 Jul 2024 17:02:45 -0300 Subject: [PATCH] silence cast and c++ warnings) --- mongoose.c | 6 +++--- src/tls_builtin.c | 2 +- src/tls_chacha20.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mongoose.c b/mongoose.c index 54f880c8..fbf87bfd 100644 --- a/mongoose.c +++ b/mongoose.c @@ -9833,7 +9833,7 @@ static void mg_tls_encrypt(struct mg_connection *c, const uint8_t *msg, #if CHACHA20 (void) tag; // tag is only used in aes gcm { - uint8_t *enc = malloc(8192); + uint8_t *enc = (uint8_t *) malloc(8192); if (enc == NULL) { mg_error(c, "TLS OOM"); return; @@ -11019,8 +11019,8 @@ static void core_block(const uint32_t *restrict start, static void xor_block(uint8_t *restrict dest, const uint8_t *restrict source, const uint32_t *restrict pad, unsigned int chunk_size) { - unsigned int i, full_blocks = chunk_size / sizeof(uint32_t); - // have to be carefull, we are going back from uint32 to uint8, so endianess + unsigned int i, full_blocks = chunk_size / (unsigned int) sizeof(uint32_t); + // have to be carefull, we are going back from uint32 to uint8, so endianness // matters again xor32_blocks(dest, source, pad, full_blocks) diff --git a/src/tls_builtin.c b/src/tls_builtin.c index 51b8f673..c01fd2c8 100644 --- a/src/tls_builtin.c +++ b/src/tls_builtin.c @@ -397,7 +397,7 @@ static void mg_tls_encrypt(struct mg_connection *c, const uint8_t *msg, #if CHACHA20 (void) tag; // tag is only used in aes gcm { - uint8_t *enc = malloc(8192); + uint8_t *enc = (uint8_t *) malloc(8192); if (enc == NULL) { mg_error(c, "TLS OOM"); return; diff --git a/src/tls_chacha20.c b/src/tls_chacha20.c index 2abf74f9..7be53023 100644 --- a/src/tls_chacha20.c +++ b/src/tls_chacha20.c @@ -200,8 +200,8 @@ static void core_block(const uint32_t *restrict start, static void xor_block(uint8_t *restrict dest, const uint8_t *restrict source, const uint32_t *restrict pad, unsigned int chunk_size) { - unsigned int i, full_blocks = chunk_size / sizeof(uint32_t); - // have to be carefull, we are going back from uint32 to uint8, so endianess + unsigned int i, full_blocks = chunk_size / (unsigned int) sizeof(uint32_t); + // have to be carefull, we are going back from uint32 to uint8, so endianness // matters again xor32_blocks(dest, source, pad, full_blocks)