libmicrohttpd

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

commit c4c111d4d4a9da3b8197e1be365d58fc9bb1f1b7
parent a08e765fc403d74b4ea09a5702dca14bc688dc0c
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sat, 23 Apr 2022 20:14:33 +0300

md5.c: muted compiler alignment warnings

Diffstat:
Msrc/microhttpd/md5.c | 12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c @@ -113,10 +113,12 @@ MHD_MD5Final (void *ctx_, if (1) #endif /* _MHD_PUT_32BIT_LE_UNALIGNED */ { - _MHD_PUT_32BIT_LE (digest, ctx->state[0]); - _MHD_PUT_32BIT_LE (digest + 4, ctx->state[1]); - _MHD_PUT_32BIT_LE (digest + 8, ctx->state[2]); - _MHD_PUT_32BIT_LE (digest + 12, ctx->state[3]); + /* Use cast to (void*) here to mute compiler alignment warnings. + * Compilers are not smart enough to see that alignment has been checked. */ + _MHD_PUT_32BIT_LE ((void *) (digest + 0), ctx->state[0]); + _MHD_PUT_32BIT_LE ((void *) (digest + 4), ctx->state[1]); + _MHD_PUT_32BIT_LE ((void *) (digest + 8), ctx->state[2]); + _MHD_PUT_32BIT_LE ((void *) (digest + 12), ctx->state[3]); } /* Erase buffer */ @@ -158,7 +160,7 @@ MD5Transform (uint32_t state[4], in = data_buf; } else - in = (const uint32_t *) block; + in = (const uint32_t *) ((const void *) block); #endif /* _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN) || \ ! _MHD_GET_32BIT_LE_UNALIGNED */ #if _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN