gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 19/26: md5.c: muted compiler alignment warnings


From: gnunet
Subject: [libmicrohttpd] 19/26: md5.c: muted compiler alignment warnings
Date: Mon, 25 Apr 2022 15:08:43 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

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

    md5.c: muted compiler alignment warnings
---
 src/microhttpd/md5.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c
index 8ac56793..a467ccac 100644
--- 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

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]