gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated (6c985f4a -> e67fdd04


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated (6c985f4a -> e67fdd04)
Date: Wed, 17 Apr 2019 19:45:40 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 6c985f4a File read block size: move to proper location
     new d928d171 Fixed build broken by 6c985f4adcb5b71c2b70a17de0a99468090bfb0d
     new aec7a304 mhd_byteorder.h: narrow down includes
     new e67fdd04 Moved bit manipulation to separate header file.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/microhttpd/Makefile.am      |  3 ++-
 src/microhttpd/md5.c            | 32 +++++-----------------
 src/microhttpd/mhd_bithelpers.h | 60 +++++++++++++++++++++++++++++++++++++++++
 src/microhttpd/mhd_byteorder.h  |  4 ++-
 src/microhttpd/response.c       | 13 +++++++++
 5 files changed, 84 insertions(+), 28 deletions(-)
 create mode 100644 src/microhttpd/mhd_bithelpers.h

diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am
index 64890de3..16db5009 100644
--- a/src/microhttpd/Makefile.am
+++ b/src/microhttpd/Makefile.am
@@ -133,6 +133,7 @@ endif
 if ENABLE_DAUTH
 libmicrohttpd_la_SOURCES += \
   digestauth.c \
+  mhd_bithelpers.h \
   md5.c md5.h \
   sha256.c sha256.h
 endif
@@ -319,7 +320,7 @@ test_http_reasons_SOURCES = \
 
 test_md5_SOURCES = \
   test_md5.c test_helpers.h \
-  md5.c md5.h
+  md5.c md5.h mhd_bithelpers.h
 
 test_options_SOURCES = \
   test_options.c
diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c
index a88dd711..7838ac10 100644
--- a/src/microhttpd/md5.c
+++ b/src/microhttpd/md5.c
@@ -20,29 +20,9 @@
 
 #include "md5.h"
 #include "mhd_byteorder.h"
+#include "mhd_bithelpers.h"
 #include "mhd_assert.h"
 
-#if _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN
-#define PUT_64BIT_LE(addr, value64) ((*(uint64_t*)(addr)) = 
(uint64_t)(value64))
-#define PUT_32BIT_LE(addr, value32) ((*(uint32_t*)(addr)) = 
(uint32_t)(value32))
-#else
-#define PUT_64BIT_LE(addr, value) do {                                 \
-       (addr)[7] = (uint8_t)((value64) >> 56);                         \
-       (addr)[6] = (uint8_t)((value64) >> 48);                         \
-       (addr)[5] = (uint8_t)((value64) >> 40);                         \
-       (addr)[4] = (uint8_t)((value64) >> 32);                         \
-       (addr)[3] = (uint8_t)((value64) >> 24);                         \
-       (addr)[2] = (uint8_t)((value64) >> 16);                         \
-       (addr)[1] = (uint8_t)((value64) >> 8);                          \
-       (addr)[0] = (uint8_t)((value64)); } while (0)
-
-#define PUT_32BIT_LE(addr, value32) do {                               \
-       (addr)[3] = (uint8_t)((value32) >> 24);                         \
-       (addr)[2] = (uint8_t)((value32) >> 16);                         \
-       (addr)[1] = (uint8_t)((value32) >> 8);                          \
-       (addr)[0] = (uint8_t)((value32)); } while (0)
-#endif
-
 
 /**
  * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
@@ -102,14 +82,14 @@ MD5Final (void *ctx_,
 
   /* Put number of bits */
   count_bits = ctx->count << 3;
-  PUT_64BIT_LE(ctx->buffer + 56, count_bits);
+  _MHD_PUT_64BIT_LE(ctx->buffer + 56, count_bits);
   MD5Transform(ctx->state, ctx->buffer);
 
   /* Put digest in LE mode */
-  PUT_32BIT_LE(digest, ctx->state[0]);
-  PUT_32BIT_LE(digest + 4, ctx->state[1]);
-  PUT_32BIT_LE(digest + 8, ctx->state[2]);
-  PUT_32BIT_LE(digest + 12, ctx->state[3]);
+  _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]);
 
   /* Erase buffer */
   memset(ctx, 0, sizeof(*ctx));
diff --git a/src/microhttpd/mhd_bithelpers.h b/src/microhttpd/mhd_bithelpers.h
new file mode 100644
index 00000000..d4a47ce4
--- /dev/null
+++ b/src/microhttpd/mhd_bithelpers.h
@@ -0,0 +1,60 @@
+/*
+  This file is part of libmicrohttpd
+  Copyright (C) 2019 Karlson2k (Evgeny Grin)
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Lesser General Public
+  License as published by the Free Software Foundation; either
+  version 2.1 of the License, or (at your option) any later version.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with this library.
+  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file microhttpd/mhd_bithelpers.h
+ * @brief  macros for bits manipulations
+ * @author Karlson2k (Evgeny Grin)
+ */
+
+#ifndef MHD_BITHELPERS_H
+#define MHD_BITHELPERS_H 1
+
+#include "mhd_byteorder.h"
+#include <stdint.h>
+
+
+#if _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN
+#define _MHD_PUT_64BIT_LE(addr, value64) \
+  ((*(uint64_t*)(addr)) = (uint64_t)(value64))
+#else  /* _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN */
+#define _MHD_PUT_64BIT_LE(addr, value64) do {                           \
+        (uint8_t*(addr))[7] = (uint8_t)((value64) >> 56);               \
+        (uint8_t*(addr))[6] = (uint8_t)((value64) >> 48);               \
+        (uint8_t*(addr))[5] = (uint8_t)((value64) >> 40);               \
+        (uint8_t*(addr))[4] = (uint8_t)((value64) >> 32);               \
+        (uint8_t*(addr))[3] = (uint8_t)((value64) >> 24);               \
+        (uint8_t*(addr))[2] = (uint8_t)((value64) >> 16);               \
+        (uint8_t*(addr))[1] = (uint8_t)((value64) >> 8);                \
+        (uint8_t*(addr))[0] = (uint8_t)((value64)); } while (0)
+#endif /* _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN */
+
+#if _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN
+#define _MHD_PUT_32BIT_LE(addr, value32) \
+  ((*(uint32_t*)(addr)) = (uint32_t)(value32))
+#else  /* _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN */
+
+#define _MHD_PUT_32BIT_LE(addr, value32) do {                           \
+        (uint8_t*(addr))[3] = (uint8_t)((value32) >> 24);               \
+        (uint8_t*(addr))[2] = (uint8_t)((value32) >> 16);               \
+        (uint8_t*(addr))[1] = (uint8_t)((value32) >> 8);                \
+        (uint8_t*(addr))[0] = (uint8_t)((value32)); } while (0)
+#endif /* _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN */
+
+#endif /* ! MHD_BITHELPERS_H */
diff --git a/src/microhttpd/mhd_byteorder.h b/src/microhttpd/mhd_byteorder.h
index 66689804..f053aa0e 100644
--- a/src/microhttpd/mhd_byteorder.h
+++ b/src/microhttpd/mhd_byteorder.h
@@ -26,7 +26,9 @@
 #ifndef MHD_BYTEORDER_H
 #define MHD_BYTEORDER_H
 
-#include "platform.h"
+#include "mhd_options.h"
+
+#include <stdint.h>
 
 #if HAVE_ENDIAN_H
 #include <endian.h>
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 9f328eef..3e93dc80 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -56,6 +56,19 @@
 #endif /* _WIN32 */
 
 
+/**
+ * Size of single file read operation for
+ * file-backed responses.
+ */
+#ifndef MHD_FILE_READ_BLOCK_SIZE
+#ifdef _WIN32
+#define MHD_FILE_READ_BLOCK_SIZE 16384 /* 16k */
+#else /* _WIN32 */
+#define MHD_FILE_READ_BLOCK_SIZE 4096 /* 4k */
+#endif /* _WIN32 */
+#endif /* !MHD_FD_BLOCK_SIZE */
+
+
 /**
  * Add a header or footer line to the response.
  *

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



reply via email to

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