commit aaab73802c5f05d231d87ab9d401e6b262c6fe2e
parent 0920a1f90865073a20d6e9822fca18ffe5f46d2e
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Wed, 1 Sep 2021 19:47:06 +0300
Fixed possible preprocessor errors
Diffstat:
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -1102,6 +1102,7 @@ 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_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
@@ -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
@@ -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: