gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] 02/10: Avoid dropping 'const' qualifier in


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] 02/10: Avoid dropping 'const' qualifier in macros
Date: Tue, 21 May 2019 21:29:06 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit c011158fe674cff7f989a3eb5bf105b0cd319719
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Tue May 21 20:47:39 2019 +0300

    Avoid dropping 'const' qualifier in macros
---
 src/microhttpd/mhd_bithelpers.h | 24 ++++++++++++------------
 src/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
index caa24846..ac2a13ce 100644
--- 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
index 6336c986..6463532e 100644
--- 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

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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