From aaab73802c5f05d231d87ab9d401e6b262c6fe2e Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Wed, 1 Sep 2021 19:47:06 +0300 Subject: [PATCH] Fixed possible preprocessor errors --- configure.ac | 1 + src/microhttpd/connection.c | 4 ++-- src/microhttpd/daemon.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 76903382..ec27649d 100644 --- 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 ]]) +AC_CHECK_SIZEOF([unsigned int], [], [[#include ]]) 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..83110dd3 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: