gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (0920a1f9 -> 9f333edb)


From: gnunet
Subject: [libmicrohttpd] branch master updated (0920a1f9 -> 9f333edb)
Date: Thu, 02 Sep 2021 09:45:57 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 0920a1f9 -fix typo
     new aaab7380 Fixed possible preprocessor errors
     new 9f333edb Fixed possible preprocessor error when SIZE_MAX is not 
digits-only

The 2 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:
 configure.ac                 | 15 +++++++++++++++
 src/microhttpd/connection.c  |  4 ++--
 src/microhttpd/daemon.c      |  8 ++++----
 src/microhttpd/mhd_threads.c |  4 ++--
 4 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 76903382..3ee40378 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1073,6 +1073,9 @@ AC_CHECK_HEADER([[search.h]],
 AM_CONDITIONAL([MHD_HAVE_TSEARCH], [[test "x$ac_cv_header_search_h" = xyes && 
test "x$HAVE_TSEARCH" = "x1" && test "x$REPLACE_TSEARCH" != "x1"]])
 
 # Check for types sizes
+# Types sizes are used as an indirect indication of maximum allowed values for 
types
+# which is used to exclude by preprocessor some compiler checks for values 
clips
+# Assuming no staffing or uniform staffing for integer types
 AC_CACHE_CHECK([size of tv_sec member of struct timeval], 
[mhd_cv_size_timeval_tv_sec],
   [
     AC_COMPUTE_INT([mhd_cv_size_timeval_tv_sec], [((long 
int)sizeof(test_var.tv_sec))],
@@ -1102,6 +1105,18 @@ static struct timeval test_var;
 AC_DEFINE_UNQUOTED([SIZEOF_STRUCT_TIMEVAL_TV_SEC], 
[$mhd_cv_size_timeval_tv_sec],
   [The size of `tv_sec' member of `struct timeval', as computed by sizeof])
 AC_CHECK_SIZEOF([uint64_t], [], [[#include <stdint.h>]])
+AC_CHECK_SIZEOF([unsigned int], [], [[#include <stdint.h>]])
+AC_CHECK_SIZEOF([size_t], [],
+  [[
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif /* HAVE_STDLIB_H */
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif /* HAVE_STDDEF_H */
+#include <stdio.h>
+  ]]
+)
 
 AC_CHECK_HEADERS([dlfcn.h],[have_tlsplugin=yes],[have_tlsplugin=no], 
[AC_INCLUDES_DEFAULT])
 AM_CONDITIONAL([MHD_HAVE_TLS_PLUGIN], [[test "x$have_tlsplugin" = xyes]])
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index de81f08a..e16eec27 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -4782,7 +4782,7 @@ MHD_set_connection_option (struct MHD_Connection 
*connection,
     connection->connection_timeout_ms = va_arg (ap,
                                                 unsigned int);
     va_end (ap);
-#if (0 == (UINT64_MAX + 0)) || ((UINT_MAX + 0) >= (UINT64_MAX + 0))
+#if (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT
     if ((UINT64_MAX / 2000 - 1) < connection->connection_timeout_ms)
     {
 #ifdef HAVE_MESSAGES
@@ -4796,7 +4796,7 @@ MHD_set_connection_option (struct MHD_Connection 
*connection,
       connection->connection_timeout_ms = UINT64_MAX / 2000 - 1;
     }
     else
-#endif /* UINTMAX_MAX >= UINT64_MAX */
+#endif /* (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT */
     connection->connection_timeout_ms *= 1000;
     if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
          (! connection->suspended) )
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index bec6d8d8..faf12c08 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -5624,7 +5624,7 @@ parse_options_va (struct MHD_Daemon *daemon,
     case MHD_OPTION_CONNECTION_TIMEOUT:
       uv = va_arg (ap,
                    unsigned int);
-#if (0 == (UINT64_MAX + 0)) || ((UINT_MAX + 0) >= (UINT64_MAX + 0))
+#if (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT
       if ((UINT64_MAX / 2000 - 1) < uv)
       {
 #ifdef HAVE_MESSAGES
@@ -5638,7 +5638,7 @@ parse_options_va (struct MHD_Daemon *daemon,
         daemon->connection_timeout_ms = UINT64_MAX / 2000 - 1;
       }
       else
-#endif /* UINTMAX_MAX >= UINT64_MAX */
+#endif /* (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT */
       daemon->connection_timeout_ms = uv * 1000;
       break;
     case MHD_OPTION_NOTIFY_COMPLETED:
@@ -5695,7 +5695,7 @@ parse_options_va (struct MHD_Daemon *daemon,
 #endif
         daemon->worker_pool_size = 0;
       }
-#if (0 == (UINT_MAX + 0)) || (UINT_MAX >= (SIZE_MAX / (64 * 1024)))
+#if SIZEOF_UNSIGNED_INT >= (SIZEOF_SIZE_T - 2)
       /* Next comparison could be always false on some platforms and whole 
branch will
        * be optimized out on these platforms. On others it will be compiled 
into real
        * check. */
@@ -5709,7 +5709,7 @@ parse_options_va (struct MHD_Daemon *daemon,
 #endif
         return MHD_NO;
       }
-#endif /* (UINT_MAX >= (SIZE_MAX/(64*1024))) */
+#endif /* SIZEOF_UNSIGNED_INT >= (SIZEOF_SIZE_T - 2) */
       else
       {
         if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD))
diff --git a/src/microhttpd/mhd_threads.c b/src/microhttpd/mhd_threads.c
index 52aba875..f40480c6 100644
--- a/src/microhttpd/mhd_threads.c
+++ b/src/microhttpd/mhd_threads.c
@@ -215,13 +215,13 @@ MHD_create_thread_ (MHD_thread_handle_ID_ *thread,
 
   return ! res;
 #elif defined(MHD_USE_W32_THREADS)
-#if SIZE_MAX != UINT_MAX
+#if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_INT
   if (stack_size > UINT_MAX)
   {
     errno = EINVAL;
     return 0;
   }
-#endif /* SIZE_MAX != UINT_MAX */
+#endif /* SIZEOF_SIZE_T != SIZEOF_UNSIGNED_INT */
 
   thread->handle = (MHD_thread_handle_)
                    _beginthreadex (NULL,

-- 
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]