aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/mhd_bithelpers.h
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2019-05-21 20:47:39 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2019-05-21 22:22:23 +0300
commitc011158fe674cff7f989a3eb5bf105b0cd319719 (patch)
tree4184d8e54f5e22e1bbee94af3d6605067e66a966 /src/microhttpd/mhd_bithelpers.h
parentedfdbbf794837190729f1bc9c87e6cfbe26717d9 (diff)
downloadlibmicrohttpd-c011158fe674cff7f989a3eb5bf105b0cd319719.tar.gz
libmicrohttpd-c011158fe674cff7f989a3eb5bf105b0cd319719.zip
Avoid dropping 'const' qualifier in macros
Diffstat (limited to 'src/microhttpd/mhd_bithelpers.h')
-rw-r--r--src/microhttpd/mhd_bithelpers.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/microhttpd/mhd_bithelpers.h b/src/microhttpd/mhd_bithelpers.h
index caa24846..ac2a13ce 100644
--- a/src/microhttpd/mhd_bithelpers.h
+++ b/src/microhttpd/mhd_bithelpers.h
@@ -136,17 +136,17 @@
136 */ 136 */
137#if _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN 137#if _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN
138#define _MHD_GET_32BIT_LE(addr) \ 138#define _MHD_GET_32BIT_LE(addr) \
139 (*(uint32_t*)(addr)) 139 (*(const uint32_t*)(addr))
140#elif _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN 140#elif _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN
141#define _MHD_GET_32BIT_LE(addr) \ 141#define _MHD_GET_32BIT_LE(addr) \
142 _MHD_BYTES_SWAP32(*(uint32_t*)(addr)) 142 _MHD_BYTES_SWAP32(*(const uint32_t*)(addr))
143#else /* _MHD_BYTE_ORDER != _MHD_BIG_ENDIAN */ 143#else /* _MHD_BYTE_ORDER != _MHD_BIG_ENDIAN */
144/* Endianess was not detected or non-standard like PDP-endian */ 144/* Endianess was not detected or non-standard like PDP-endian */
145#define _MHD_GET_32BIT_LE(addr) \ 145#define _MHD_GET_32BIT_LE(addr) \
146 ( ( (uint32_t)(((uint8_t*)addr)[0])) | \ 146 ( ( (uint32_t)(((const uint8_t*)addr)[0])) | \
147 (((uint32_t)(((uint8_t*)addr)[1])) << 8) | \ 147 (((uint32_t)(((const uint8_t*)addr)[1])) << 8) | \
148 (((uint32_t)(((uint8_t*)addr)[2])) << 16) | \ 148 (((uint32_t)(((const uint8_t*)addr)[2])) << 16) | \
149 (((uint32_t)(((uint8_t*)addr)[3])) << 24) ) 149 (((uint32_t)(((const uint8_t*)addr)[3])) << 24) )
150#endif /* _MHD_BYTE_ORDER != _MHD_BIG_ENDIAN */ 150#endif /* _MHD_BYTE_ORDER != _MHD_BIG_ENDIAN */
151 151
152 152
@@ -200,17 +200,17 @@
200 */ 200 */
201#if _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN 201#if _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN
202#define _MHD_GET_32BIT_BE(addr) \ 202#define _MHD_GET_32BIT_BE(addr) \
203 (*(uint32_t*)(addr)) 203 (*(const uint32_t*)(addr))
204#elif _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN 204#elif _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN
205#define _MHD_GET_32BIT_BE(addr) \ 205#define _MHD_GET_32BIT_BE(addr) \
206 _MHD_BYTES_SWAP32(*(uint32_t*)(addr)) 206 _MHD_BYTES_SWAP32(*(const uint32_t*)(addr))
207#else /* _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN */ 207#else /* _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN */
208/* Endianess was not detected or non-standard like PDP-endian */ 208/* Endianess was not detected or non-standard like PDP-endian */
209#define _MHD_GET_32BIT_BE(addr) \ 209#define _MHD_GET_32BIT_BE(addr) \
210 ( (((uint32_t)(((uint8_t*)addr)[0])) << 24) | \ 210 ( (((uint32_t)(((const uint8_t*)addr)[0])) << 24) | \
211 (((uint32_t)(((uint8_t*)addr)[1])) << 16) | \ 211 (((uint32_t)(((const uint8_t*)addr)[1])) << 16) | \
212 (((uint32_t)(((uint8_t*)addr)[2])) << 8) | \ 212 (((uint32_t)(((const uint8_t*)addr)[2])) << 8) | \
213 ((uint32_t) (((uint8_t*)addr)[3])) ) 213 ((uint32_t) (((const uint8_t*)addr)[3])) )
214#endif /* _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN */ 214#endif /* _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN */
215 215
216 216