libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit c011158fe674cff7f989a3eb5bf105b0cd319719
parent edfdbbf794837190729f1bc9c87e6cfbe26717d9
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Tue, 21 May 2019 20:47:39 +0300

Avoid dropping 'const' qualifier in macros

Diffstat:
Msrc/microhttpd/mhd_bithelpers.h | 24++++++++++++------------
Msrc/microhttpd/sha256.c | 2+-
2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/microhttpd/mhd_bithelpers.h b/src/microhttpd/mhd_bithelpers.h @@ -136,17 +136,17 @@ */ #if _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN #define _MHD_GET_32BIT_LE(addr) \ - (*(uint32_t*)(addr)) + (*(const uint32_t*)(addr)) #elif _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN #define _MHD_GET_32BIT_LE(addr) \ - _MHD_BYTES_SWAP32(*(uint32_t*)(addr)) + _MHD_BYTES_SWAP32(*(const uint32_t*)(addr)) #else /* _MHD_BYTE_ORDER != _MHD_BIG_ENDIAN */ /* Endianess was not detected or non-standard like PDP-endian */ #define _MHD_GET_32BIT_LE(addr) \ - ( ( (uint32_t)(((uint8_t*)addr)[0])) | \ - (((uint32_t)(((uint8_t*)addr)[1])) << 8) | \ - (((uint32_t)(((uint8_t*)addr)[2])) << 16) | \ - (((uint32_t)(((uint8_t*)addr)[3])) << 24) ) + ( ( (uint32_t)(((const uint8_t*)addr)[0])) | \ + (((uint32_t)(((const uint8_t*)addr)[1])) << 8) | \ + (((uint32_t)(((const uint8_t*)addr)[2])) << 16) | \ + (((uint32_t)(((const uint8_t*)addr)[3])) << 24) ) #endif /* _MHD_BYTE_ORDER != _MHD_BIG_ENDIAN */ @@ -200,17 +200,17 @@ */ #if _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN #define _MHD_GET_32BIT_BE(addr) \ - (*(uint32_t*)(addr)) + (*(const uint32_t*)(addr)) #elif _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN #define _MHD_GET_32BIT_BE(addr) \ - _MHD_BYTES_SWAP32(*(uint32_t*)(addr)) + _MHD_BYTES_SWAP32(*(const uint32_t*)(addr)) #else /* _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN */ /* Endianess was not detected or non-standard like PDP-endian */ #define _MHD_GET_32BIT_BE(addr) \ - ( (((uint32_t)(((uint8_t*)addr)[0])) << 24) | \ - (((uint32_t)(((uint8_t*)addr)[1])) << 16) | \ - (((uint32_t)(((uint8_t*)addr)[2])) << 8) | \ - ((uint32_t) (((uint8_t*)addr)[3])) ) + ( (((uint32_t)(((const uint8_t*)addr)[0])) << 24) | \ + (((uint32_t)(((const uint8_t*)addr)[1])) << 16) | \ + (((uint32_t)(((const uint8_t*)addr)[2])) << 8) | \ + ((uint32_t) (((const uint8_t*)addr)[3])) ) #endif /* _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN */ diff --git a/src/microhttpd/sha256.c b/src/microhttpd/sha256.c @@ -135,7 +135,7 @@ sha256_transform (uint32_t H[_SHA256_DIGEST_LENGTH], Input data must be read in big-endian bytes order, see FIPS PUB 180-4 paragraph 3.1.2. */ #define GET_W_FROM_DATA(buf,t) \ - _MHD_GET_32BIT_BE(((uint8_t*)(buf)) + (t) * SHA256_BYTES_IN_WORD) + _MHD_GET_32BIT_BE(((const uint8_t*)(buf)) + (t) * SHA256_BYTES_IN_WORD) /* During first 16 steps, before making any calculations on each step, the W element is read from input data buffer as big-endian value and