gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 02/02: Fixed possible preprocessor error when SIZE_MAX i


From: gnunet
Subject: [libmicrohttpd] 02/02: Fixed possible preprocessor error when SIZE_MAX is not digits-only
Date: Thu, 02 Sep 2021 09:45:59 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 9f333edbdf76c1a8e9842ab551b97975570cf192
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu Sep 2 10:45:24 2021 +0300

    Fixed possible preprocessor error when SIZE_MAX is not digits-only
---
 configure.ac                 | 14 ++++++++++++++
 src/microhttpd/daemon.c      |  4 ++--
 src/microhttpd/mhd_threads.c |  4 ++--
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index ec27649d..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))],
@@ -1103,6 +1106,17 @@ 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/daemon.c b/src/microhttpd/daemon.c
index 83110dd3..faf12c08 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -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]