gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (99f31f05 -> 0920a1f9)


From: gnunet
Subject: [libmicrohttpd] branch master updated (99f31f05 -> 0920a1f9)
Date: Wed, 01 Sep 2021 19:54:46 +0200

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

grothoff pushed a change to branch master
in repository libmicrohttpd.

    from 99f31f05 configure: added stdint.h to the list of required headers
     new b6f083d8 Fixed preprocessor error, fixed timeout calculation with 64 
bit time_t introduced by e42ec8f54d28c982307367c483cee34ade5c54f8
     new 0920a1f9 -fix typo

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            | 37 ++++++++++++++++++++++++++++++++++---
 src/microhttpd/daemon.c | 16 +++++++++++++---
 2 files changed, 47 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index b73f3cc3..76903382 100644
--- a/configure.ac
+++ b/configure.ac
@@ -319,7 +319,7 @@ AC_CACHE_CHECK([[for C11 'alignof()' support]], 
[[mhd_cv_c_alignof]],
 #if (defined (__GNUC__) && __GNUC__ < 4 && __GNUC_MINOR__ < 9 && ! 
defined(__clang__)) || \
     (defined (__clang__) && __clang_major__ < 8)
 /* GCC before 4.9 and clang before 8.0 have incorrect implementation of 
'alignof()'
-   which returns preferred alignment instead of minimal required alignment */  
  
+   which returns preferred alignment instead of minimal required alignment */
 #error Compiler has incorrect implementation of alignof()
 choke me now
 #endif
@@ -327,7 +327,7 @@ choke me now
           int var2[alignof(unsigned int) - 1];
           int var3[(alignof(char) > 0) ? 1 : -1];
           int var4[(alignof(long) >= 4) ? 1 : -1];
-          
+
           /* Mute compiler warnings */
           var1[0] = var2[0] = var3[0] = 0;
           var4[0] = 1;
@@ -344,7 +344,7 @@ choke me now
                        ]], [[
                          /* Should fail if 'alignof()' works */
                          int var1[alignof(nonexisting_type) - 1];
-                         
+
                          /* Mute compiler warnings */
                          var1[0] = 1;
                          if (var1[0] + 1 == 1)
@@ -1072,6 +1072,37 @@ 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
+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))],
+      [[
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif /* HAVE_SYS_TIME_H */
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif /* HAVE_TIME_H */
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif /* HAVE_SYS_TYPES_H */
+static struct timeval test_var;
+      ]],
+      [
+        # The size is used only to exclude additional checks/comparison in code
+        # to avoid compiler warnings. With larger size MHD code will use
+        # additional checks which ensure that value will fit but it may produce
+        # a harmless compiler warning.
+        AC_MSG_WARN([The size cannot be determined, assuming 8.])
+        mhd_cv_size_timeval_tv_sec=8
+      ]
+    )
+  ]
+)
+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_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 090d39d4..bec6d8d8 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2008,12 +2008,13 @@ thread_main_handle_connection (void *data)
       else
       {
         const uint64_t mseconds_left = timeout - since_actv;
-#if UINT64_MAX != TIMEVAL_TV_SEC_MAX
+#if (SIZEOF_UINT64_T - 1) >= SIZEOF_STRUCT_TIMEVAL_TV_SEC
         if (mseconds_left / 1000 > TIMEVAL_TV_SEC_MAX)
           tv.tv_sec = TIMEVAL_TV_SEC_MAX;
         else
-          tv.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE) mseconds_left / 1000;
-#endif /* UINT64_MAX != TIMEVAL_TV_SEC_MAX */
+#endif /* (SIZEOF_UINT64_T - 1) >= SIZEOF_STRUCT_TIMEVAL_TV_SEC */
+        tv.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE) mseconds_left / 1000;
+
         tv.tv_usec = (mseconds_left % 1000) * 1000;
       }
       tvp = &tv;
@@ -8143,6 +8144,15 @@ MHD_init (void)
   MHD_monotonic_sec_counter_init ();
   MHD_send_init_static_vars_ ();
   MHD_init_mem_pools_ ();
+  /* Check whether sizes were correctly detected by configure */
+#ifdef _DEBUG
+  if (1)
+  {
+    struct timeval tv;
+    mhd_assert (sizeof(tv.tv_sec) == SIZEOF_STRUCT_TIMEVAL_TV_SEC);
+  }
+#endif /* _DEBUG */
+  mhd_assert (sizeof(uint64_t) == SIZEOF_UINT64_T);
 }
 
 

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