gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (afb8ed41 -> 1b8c52f1)


From: gnunet
Subject: [libmicrohttpd] branch master updated (afb8ed41 -> 1b8c52f1)
Date: Tue, 31 May 2022 19:38:09 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from afb8ed41 HTTPS tests: added missing function declaration
     new 3ab43751 connection.c: fixed compiler warnings
     new 5fd6ea30 MHD_FIND_ADD_CC_{C,LD}FLAG_IFELSE: added new autoconf macros
     new b3b131c6 configure: added more workarounds for clang
     new 92bfeb76 MHD_get_timeout*(): improved doxy
     new 7422951e Fixed wrong variable type used for result of 
gnutls_priority_init()
     new b21d3090 configure: disabled one more warning on clang
     new 887a5543 mhd_sockets: muted compiler warning with very minor 
optimisation
     new 041ada4e daemon.c: fixed possible uninitialized value
     new f061c861 Fixed 'int' instead of 'MHD_Result'
     new 1b8c52f1 daemon: muted compiler warning, refactored code for 
readability

The 10 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                                       | 48 ++++++++++++----------
 m4/mhd_find_add_cc_cflag.m4                        | 39 ++++++++++++------
 m4/mhd_find_add_cc_cflag_ifelse.m4                 | 45 ++++++++++++++++++++
 m4/mhd_find_add_cc_ldflag.m4                       |  6 +--
 ..._ldflag.m4 => mhd_find_add_cc_ldflag_ifelse.m4} | 15 ++++---
 src/include/microhttpd.h                           |  4 +-
 src/microhttpd/connection.c                        |  7 +++-
 src/microhttpd/daemon.c                            | 44 ++++++++++++--------
 src/microhttpd/digestauth.c                        |  2 +-
 src/microhttpd/mhd_sockets.c                       | 12 +++---
 src/microhttpd/postprocessor.c                     |  4 +-
 11 files changed, 153 insertions(+), 73 deletions(-)
 create mode 100644 m4/mhd_find_add_cc_cflag_ifelse.m4
 copy m4/{mhd_find_add_cc_ldflag.m4 => mhd_find_add_cc_ldflag_ifelse.m4} (64%)

diff --git a/configure.ac b/configure.ac
index 7cba50af..8b37c19f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,6 +145,21 @@ MHD_CHECK_ADD_CC_CFLAG([-fno-strict-aliasing], [CFLAGS_ac])
 
 AS_VAR_IF([enable_build_type],["neutral"],[],
   [ # Any non-neutral build types
+    AC_CACHE_CHECK([whether workarounds for clang or clang-based compiler are 
required],
+      [mhd_cv_cc_clang_based],
+      [
+        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#if ! defined(__clang__) && ! defined(__llvm__)
+#error Compiler is not clang-based
+choke me now
+#endif
+              ]]
+            )
+          ],
+          [mhd_cv_cc_clang_based="yes"],[mhd_cv_cc_clang_based="no"]
+        )
+      ]
+    )
     MHD_CHECK_ADD_CC_CFLAGS([-Wall -fdelete-null-pointer-checks 
-Wnull-dereference], [CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wdeclaration-after-statement -Wimplicit 
-Wnested-externs], [CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wredundant-decls -Wtrampolines 
-Wunsafe-loop-optimizations], [CFLAGS_ac])
@@ -160,25 +175,6 @@ AS_CASE([${enable_build_type}],[debug|debugger],
     CFLAGS="${user_CFLAGS}"
     AS_VAR_IF([enable_build_type],["debug"],
       [
-        AS_IF([test "x${enable_sanitizers}" != "xno"],
-          [
-            AC_CACHE_CHECK([whether workarounds for clang are required],
-              [mhd_cv_cc_clang_based],
-              [
-                AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
-#if ! defined(__clang__) && ! defined(__llvm__)
-#error Compiler is not clang-based
-choke me now
-#endif
-                      ]]
-                    )
-                  ],
-                  [mhd_cv_cc_clang_based="yes"],[mhd_cv_cc_clang_based="no"]
-                )
-              ]
-            )
-          ]
-        )
         # Clang has ASAN (pointer compare) broken when '-Og' optimisations are 
used
         AS_IF([test "x${enable_sanitizers}" != "xno" && test 
"x${mhd_cv_cc_clang_based}" = "xyes"],
           [MHD_CHECK_ADD_CC_CFLAG([-O0], [CFLAGS_ac])],
@@ -189,7 +185,13 @@ choke me now
     )
     MHD_FIND_ADD_CC_CFLAG([CFLAGS_ac], [-ggdb3], [-g3], [-ggdb], [-g])
     MHD_CHECK_ADD_CC_CFLAGS([-Wextra -Wdouble-promotion], [CFLAGS_ac])
-    MHD_FIND_ADD_CC_CFLAG([CFLAGS_ac], [-Wformat=2], [-Wformat])
+    MHD_FIND_ADD_CC_CFLAG_IFELSE(
+      [
+        # clang produce warning when string pointer is used as a formar for 
v*printf() function
+        
AS_VAR_IF([mhd_cv_cc_clang_based],["yes"],[MHD_CHECK_ADD_CC_CFLAG([-Wno-format-nonliteral],
 [CFLAGS_ac])])
+      ],[],
+      [CFLAGS_ac], [-Wformat=2], [-Wformat]
+    )
     MHD_CHECK_ADD_CC_CFLAGS([-Wformat-overflow -Wformat-truncation 
-Wformat-security -Wformat-signedness], [CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wmissing-include-dirs -Wshift-overflow=2 
-Wstringop-overflow=4 -Walloc-zero], [CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wduplicated-branches -Wduplicated-cond 
-Wfloat-equal -Wshadow -Wpointer-arith], [CFLAGS_ac])
@@ -207,7 +209,7 @@ choke me now
     MHD_CHECK_ADD_CC_CFLAGS([-Wanon-enum-enum-conversion 
-Warray-bounds-pointer-arithmetic -Wassign-enum], [CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wbit-int-extension -Wbitfield-enum-conversion 
-Wparentheses -Wbool-operation], [CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wcast-function-type -Wcomma -Wcomment 
-Wcompound-token-split], [CFLAGS_ac])
-    MHD_CHECK_ADD_CC_CFLAGS([-Wconditional-uninitialized -Wdeprecated 
-Wdisabled-macro-expansion], [CFLAGS_ac])
+    MHD_CHECK_ADD_CC_CFLAGS([-Wconditional-uninitialized -Wdeprecated], 
[CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wdocumentation-pedantic -Wempty-init-stmt 
-Wenum-conversion -Wexpansion-to-defined], [CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wflexible-array-extensions -Wloop-analysis 
-Wformat-pedantic], [CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wformat-type-confusion -Wfour-char-constants], 
[CFLAGS_ac])
@@ -220,6 +222,10 @@ choke me now
     MHD_CHECK_ADD_CC_CFLAGS([-Wnewline-eof -Wover-aligned -Wredundant-parens], 
[CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wshift-sign-overflow -Wtautological-compare 
-Wunaligned-access], [CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wunused -Wused-but-marked-unused 
-Wzero-as-null-pointer-constant -Wzero-length-array], [CFLAGS_ac])
+    #
+    # Removed flags:
+    #
+    # -Wdisabled-macro-expansion - warns about macros from system headers
 
     CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
     LDFLAGS="${user_LDFLAGS}"
diff --git a/m4/mhd_find_add_cc_cflag.m4 b/m4/mhd_find_add_cc_cflag.m4
index 7afc0f39..49c7bfff 100644
--- a/m4/mhd_find_add_cc_cflag.m4
+++ b/m4/mhd_find_add_cc_cflag.m4
@@ -33,38 +33,53 @@
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 1
+#serial 2
 
 AC_DEFUN([MHD_FIND_ADD_CC_CFLAG],[dnl
-_MHD_FIND_ADD_CC_XFLAG([[CFLAGS]],$@)])
+_MHD_FIND_ADD_CC_XFLAG([[CFLAGS]],[],[],$@)])
 
 
 # SYNOPSIS
 #
 #   _MHD_FIND_ADD_CC_XFLAG([CFLAGS|LDFLAGS],
+#                          [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
 #                          [VARIABLE-TO-EXTEND],
 #                          [FLAG1-TO-TEST], [FLAG2-TO-TEST], ...)
 #
 AC_DEFUN([_MHD_FIND_ADD_CC_XFLAG],[dnl
   AC_PREREQ([2.64])dnl for m4_ifnblank
   AC_LANG_ASSERT([C])dnl
-  m4_if(m4_eval([$# >= 3]), [0], [m4_fatal([$0: Macro must have at least three 
parameters])])dnl
-  m4_ifblank([$3],[m4_fatal([$0: Third macro argument must not be empty])])dnl
+  m4_if(m4_eval([$# >= 5]), [0], [m4_fatal([$0: Macro must have at least five 
parameters])])dnl
+  m4_ifblank([$5],[m4_fatal([$0: Fifth macro argument must not be empty])])dnl
+  m4_ifnblank([$2$3],[m4_newline([m4_n([AS_UNSET([mhd_cc_found_flag])])])])dnl
   m4_bmatch(_mhd_norm_expd([$1]), [^\(CFLAGS\|LDFLAGS\)$],[],dnl
-   [m4_fatal([$0: First macro argument must be either 'CFLAGS' or 'LDFLAGS; 
']_mhd_norm_expd([$5])[' is not supported])])dnl
-  m4_ifnblank([$2],[_MHD_FIND_ADD_CC_XFLAG_BODY($@)],dnl
-  [_MHD_FIND_ADD_CC_XFLAG_BODY([$1],[$1],m4_shift2($@))])dnl
+   [m4_fatal([$0: First macro argument must be either 'CFLAGS' or 'LDFLAGS; 
']_mhd_norm_expd([$1])[' is not supported])])dnl
+  
m4_ifnblank([$4],[_MHD_FIND_ADD_CC_XFLAG_BODY(m4_ifnblank([$2$3],[mhd_cc_found_flag]),[$1],[$4],m4_shiftn([4],$@))],dnl
+  
[_MHD_FIND_ADD_CC_XFLAG_BODY(m4_ifnblank([$2$3],[mhd_cc_found_flag]),[$1],[$1],m4_shiftn([4],$@))])dnl
+  m4_ifnblank([$2$3],[
+    AS_IF([test -n "${mhd_cc_found_flag}"],[$2],[$3])
+    AS_UNSET([mhd_cc_found_flag])
+    ])dnl
+  ])dnl
 ])
 
 
+# SYNOPSIS
+#
+#   _MHD_FIND_ADD_CC_XFLAG_BODY([VAR-TO-SET],
+#                               [CFLAGS|LDFLAGS],
+#                               [VARIABLE-TO-EXTEND],
+#                               [FLAG1-TO-TEST], [FLAG2-TO-TEST], ...)
+#
 m4_define([_MHD_FIND_ADD_CC_XFLAG_BODY],[dnl
 m4_version_prereq([2.64])dnl for m4_ifnblank
 m4_if([$#],[0],[m4_fatal([$0: no parameters])])dnl
-m4_bmatch(_mhd_norm_expd([$1]),[^\(CFLAGS\|LDFLAGS\)$],[],dnl
-[m4_fatal([$0: First macro argument must be either 'CFLAGS' or 'LDFLAGS; 
']_mhd_norm_expd([$5])[' is not supported])])dnl
+m4_bmatch(_mhd_norm_expd([$2]),[^\(CFLAGS\|LDFLAGS\)$],[],dnl
+[m4_fatal([$0: Second macro argument must be either 'CFLAGS' or 'LDFLAGS; 
']_mhd_norm_expd([$2])[' is not supported])])dnl
 m4_if([$#],[1],[m4_fatal([$0: not enough parameters])])dnl
 m4_if([$#],[2],[m4_fatal([$0: not enough parameters])])dnl
-m4_if([$#],[3],[m4_ifnblank([$3],[_MHD_CHECK_ADD_CC_XFLAG([$3],[$2],[],[],[$1])])],
-[m4_ifnblank([$3],[_MHD_CHECK_ADD_CC_XFLAG([$3],[$2],[],[$0([$1],[$2],m4_shift3($@))],[$1])],
-[$0([$1],[$2],m4_shift3($@))])])dnl
+m4_if([$#],[3],[m4_fatal([$0: not enough parameters])])dnl
+m4_if([$#],[4],[m4_ifnblank([$4],[_MHD_CHECK_ADD_CC_XFLAG([$4],[$3],m4_ifnblank([$1],[$1="_mhd_norm_expd([$4])"]),[],[$2])])],
+[m4_ifnblank([$4],[_MHD_CHECK_ADD_CC_XFLAG([$4],[$3],m4_ifnblank([$1],[$1="_mhd_norm_expd([$4])"]),[$0([$1],[$2],[$3],m4_shiftn([4],$@))],[$2])],
+[$0([$1],[$2],[$3],m4_shiftn([4],$@))])])dnl
 ])
diff --git a/m4/mhd_find_add_cc_cflag_ifelse.m4 
b/m4/mhd_find_add_cc_cflag_ifelse.m4
new file mode 100644
index 00000000..337c4561
--- /dev/null
+++ b/m4/mhd_find_add_cc_cflag_ifelse.m4
@@ -0,0 +1,45 @@
+# SYNOPSIS
+#
+#   MHD_FIND_ADD_CC_CFLAG_IFELSE([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
+#                                [VARIABLE-TO-EXTEND],
+#                                [FLAG1-TO-TEST], [FLAG2-TO-TEST], ...)
+#
+# DESCRIPTION
+#
+#   This macro checks whether the specific compiler flags are supported.
+#   The flags are checked one-by-one. The checking is stopped when the first
+#   supported flag found.
+#   The checks are performing by appending FLAGx-TO-TEST to the value of
+#   VARIABLE-TO-EXTEND (CFLAGS if not specified), then prepending result to
+#   CFLAGS (unless VARIABLE-TO-EXTEND is CFLAGS), and then performing compile
+#   and link test. If test succeed without warnings, then the flag is added to
+#   VARIABLE-TO-EXTEND and next flags are not checked. If compile-link cycle
+#   cannot be performed without warning with all tested flags, no flag is
+#   added to the VARIABLE-TO-EXTEND.
+#   If any suitable flag is found, ACTION-IF-FOUND is executed otherwise
+#   ACTION-IF-NOT-FOUND is executed. Found flag (if any) is available as
+#   value of shell variable $mhd_cc_found_flag during action execution.
+#
+#   Example usage:
+#
+#     MHD_FIND_ADD_CC_CFLAG_IFELSE([AC_MSG_NOTICE([Enabled debug 
information])],
+#                                  [],
+#                                  [additional_CFLAGS],
+#                                  [-ggdb3], [-g3], [-ggdb], [-g])
+#
+#   Note: Unlike others MHD_CHECK_*CC_CFLAG* macro, this macro uses another
+#   order of parameters.
+#
+# LICENSE
+#
+#   Copyright (c) 2022 Karlson2k (Evgeny Grin) <k2k@narod.ru>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 1
+
+AC_DEFUN([MHD_FIND_ADD_CC_CFLAG_IFELSE],[dnl
+_MHD_FIND_ADD_CC_XFLAG([[CFLAGS]],$@)])
diff --git a/m4/mhd_find_add_cc_ldflag.m4 b/m4/mhd_find_add_cc_ldflag.m4
index 224a4e29..374ecf0f 100644
--- a/m4/mhd_find_add_cc_ldflag.m4
+++ b/m4/mhd_find_add_cc_ldflag.m4
@@ -19,7 +19,7 @@
 #   Example usage:
 #
 #     MHD_CHECK_CC_LDFLAG([additional_LDFLAGS],
-#                        [-Wl,--strip-all], [-Wl,--strip-debug])
+#                         [-Wl,--strip-all], [-Wl,--strip-debug])
 #
 #   Note: Unlike others MHD_CHECK_*CC_LDFLAG* macro, this macro uses another
 #   order of parameters.
@@ -33,7 +33,7 @@
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 1
+#serial 2
 
 AC_DEFUN([MHD_FIND_ADD_CC_LDFLAG],[dnl
-_MHD_FIND_ADD_CC_XFLAG([[LDFLAGS]],$@)])
+_MHD_FIND_ADD_CC_XFLAG([[LDFLAGS]],[],[],$@)])
diff --git a/m4/mhd_find_add_cc_ldflag.m4 b/m4/mhd_find_add_cc_ldflag_ifelse.m4
similarity index 64%
copy from m4/mhd_find_add_cc_ldflag.m4
copy to m4/mhd_find_add_cc_ldflag_ifelse.m4
index 224a4e29..fbb0fd40 100644
--- a/m4/mhd_find_add_cc_ldflag.m4
+++ b/m4/mhd_find_add_cc_ldflag_ifelse.m4
@@ -1,7 +1,8 @@
 # SYNOPSIS
 #
-#   MHD_FIND_ADD_CC_LDFLAG([VARIABLE-TO-EXTEND],
-#                         [FLAG1-TO-TEST], [FLAG2-TO-TEST], ...)
+#   MHD_FIND_ADD_CC_LDFLAG_IFELSE([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
+#                                 [VARIABLE-TO-EXTEND],
+#                                 [FLAG1-TO-TEST], [FLAG2-TO-TEST], ...)
 #
 # DESCRIPTION
 #
@@ -15,11 +16,15 @@
 #   VARIABLE-TO-EXTEND and next flags are not checked. If compile-link cycle
 #   cannot be performed without warning with all tested flags, no flag is
 #   added to the VARIABLE-TO-EXTEND.
+#   If any suitable flag is found, ACTION-IF-FOUND is executed otherwise
+#   ACTION-IF-NOT-FOUND is executed. Found flag (if any) is available as
+#   value of shell variable $mhd_cc_found_flag during action execution.
 #
 #   Example usage:
 #
-#     MHD_CHECK_CC_LDFLAG([additional_LDFLAGS],
-#                        [-Wl,--strip-all], [-Wl,--strip-debug])
+#     MHD_CHECK_CC_LDFLAG([],[AC_MSG_WARN([Stripping is not supported]),
+#                         [additional_LDFLAGS],
+#                         [-Wl,--strip-all], [-Wl,--strip-debug])
 #
 #   Note: Unlike others MHD_CHECK_*CC_LDFLAG* macro, this macro uses another
 #   order of parameters.
@@ -35,5 +40,5 @@
 
 #serial 1
 
-AC_DEFUN([MHD_FIND_ADD_CC_LDFLAG],[dnl
+AC_DEFUN([MHD_FIND_ADD_CC_LDFLAG_IFELSE],[dnl
 _MHD_FIND_ADD_CC_XFLAG([[LDFLAGS]],$@)])
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 92a9278f..dcbc7701 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -2915,7 +2915,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
  * polling function.
  *
  * @param daemon daemon to query for timeout
- * @param timeout set to the timeout (in milliseconds)
+ * @param[out] timeout set to the timeout (in milliseconds)
  * @return #MHD_YES on success, #MHD_NO if timeouts are
  *         not used and no data processing is pending.
  * @ingroup event
@@ -2952,7 +2952,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
  * polling function.
  *
  * @param daemon daemon to query for timeout
- * @param timeout64 the pointer to the variable to be set to the
+ * @param[out] timeout64 the pointer to the variable to be set to the
  *                  timeout (in milliseconds)
  * @return #MHD_YES if timeout value has been set,
  *         #MHD_NO if timeouts are not used and no data processing is pending.
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 9977ea6b..d74535cf 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2824,6 +2824,9 @@ parse_cookies_string_strict (char *str,
     {
       value_start = 0;
       value_len = 0;
+#ifdef _DEBUG
+      val_quoted = false; /* This assignment used in assert */
+#endif
     }
     else
     {
@@ -5327,13 +5330,13 @@ MHD_get_connection_info (struct MHD_Connection 
*connection,
     if (NULL == connection->tls_session)
       return NULL;
     connection->connection_info_dummy.cipher_algorithm =
-      gnutls_cipher_get (connection->tls_session);
+      (int) gnutls_cipher_get (connection->tls_session);
     return &connection->connection_info_dummy;
   case MHD_CONNECTION_INFO_PROTOCOL:
     if (NULL == connection->tls_session)
       return NULL;
     connection->connection_info_dummy.protocol =
-      gnutls_protocol_get_version (connection->tls_session);
+      (int) gnutls_protocol_get_version (connection->tls_session);
     return &connection->connection_info_dummy;
   case MHD_CONNECTION_INFO_GNUTLS_SESSION:
     if (NULL == connection->tls_session)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 8308e6ef..6ac948d9 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1171,6 +1171,7 @@ call_handlers (struct MHD_Connection *con,
   bool states_info_processed = false;
   /* Fast track flag */
   bool on_fasttrack = (con->state == MHD_CONNECTION_INIT);
+  ret = MHD_YES;
 
 #ifdef HTTPS_SUPPORT
   if (con->tls_read_ready)
@@ -3917,7 +3918,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
  * daemon's select()/poll()/etc.
  *
  * @param daemon daemon to query for timeout
- * @param timeout set to the timeout (in milliseconds)
+ * @param[out] timeout set to the timeout (in milliseconds)
  * @return #MHD_YES on success, #MHD_NO if timeouts are
  *         not used and no data processing is pending.
  * @ingroup event
@@ -3969,7 +3970,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
  * daemon's select()/poll()/etc.
  *
  * @param daemon daemon to query for timeout
- * @param timeout64 the pointer to the variable to be set to the
+ * @param[out] timeout64 the pointer to the variable to be set to the
  *                  timeout (in milliseconds)
  * @return #MHD_YES if timeout value has been set,
  *         #MHD_NO if timeouts are not used and no data processing is pending.
@@ -4506,7 +4507,6 @@ MHD_select (struct MHD_Daemon *daemon,
 
   if (MHD_NO != err_state)
     millisec = 0;
-  tv = NULL;
   if (0 == millisec)
   {
     timeout.tv_usec = 0;
@@ -4515,32 +4515,40 @@ MHD_select (struct MHD_Daemon *daemon,
   }
   else
   {
-    uint64_t timeout64;
+    uint64_t mhd_tmo;
+    uint64_t select_tmo;
 
     if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
-         (MHD_NO != MHD_get_timeout64 (daemon, &timeout64)) )
+         (MHD_NO != MHD_get_timeout64 (daemon, &mhd_tmo)) )
     {
-      tv = &timeout; /* have timeout value */
       if ( (0 < millisec) &&
-           (timeout64 > (uint64_t) millisec) )
-        timeout64 = (uint64_t) millisec;
+           (mhd_tmo > (uint64_t) millisec) )
+        select_tmo = (uint64_t) millisec;
+      else
+        select_tmo = mhd_tmo;
+      tv = &timeout; /* have timeout value */
     }
     else if (0 < millisec)
     {
+      select_tmo = (uint64_t) millisec;
       tv = &timeout; /* have timeout value */
-      timeout64 = (uint64_t) millisec;
+    }
+    else
+    {
+      select_tmo = 0; /* Not actually used, silent compiler warning */
+      tv = NULL;
     }
 
     if (NULL != tv)
     { /* have timeout value */
 #if (SIZEOF_UINT64_T - 2) >= SIZEOF_STRUCT_TIMEVAL_TV_SEC
-      if (timeout64 / 1000 > TIMEVAL_TV_SEC_MAX)
+      if (select_tmo / 1000 > TIMEVAL_TV_SEC_MAX)
         timeout.tv_sec = TIMEVAL_TV_SEC_MAX;
       else
 #endif /* (SIZEOF_UINT64_T - 2) >= SIZEOF_STRUCT_TIMEVAL_TV_SEC */
-      timeout.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE) (timeout64 / 1000);
+      timeout.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE) (select_tmo / 1000);
 
-      timeout.tv_usec = ((uint16_t) (timeout64 % 1000)) * ((int32_t) 1000);
+      timeout.tv_usec = ((uint16_t) (select_tmo % 1000)) * ((int32_t) 1000);
     }
   }
   num_ready = MHD_SYS_select_ (maxsock + 1,
@@ -5847,7 +5855,6 @@ parse_options_va (struct MHD_Daemon *daemon,
   unsigned int i;
   unsigned int uv;
 #ifdef HTTPS_SUPPORT
-  enum MHD_Result ret;
   const char *pstr;
 #if GNUTLS_VERSION_MAJOR >= 3
   gnutls_certificate_retrieve_function2 *pgcrf;
@@ -6097,17 +6104,18 @@ parse_options_va (struct MHD_Daemon *daemon,
                      const char *);
       if (0 != (daemon->options & MHD_USE_TLS))
       {
+        int init_res;
         gnutls_priority_deinit (daemon->priority_cache);
-        ret = gnutls_priority_init (&daemon->priority_cache,
-                                    pstr,
-                                    NULL);
-        if (GNUTLS_E_SUCCESS != ret)
+        init_res = gnutls_priority_init (&daemon->priority_cache,
+                                         pstr,
+                                         NULL);
+        if (GNUTLS_E_SUCCESS != init_res)
         {
 #ifdef HAVE_MESSAGES
           MHD_DLOG (daemon,
                     _ ("Setting priorities to `%s' failed: %s\n"),
                     pstr,
-                    gnutls_strerror (ret));
+                    gnutls_strerror (init_res));
 #endif
           daemon->priority_cache = NULL;
           return MHD_NO;
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index 23b41193..d94da65e 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -2161,7 +2161,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection 
*connection,
                                int signal_stale,
                                enum MHD_DigestAuthAlgorithm algo)
 {
-  int ret;
+  enum MHD_Result ret;
   int hlen;
 
   struct DigestAlgorithm da;
diff --git a/src/microhttpd/mhd_sockets.c b/src/microhttpd/mhd_sockets.c
index ba459ce5..2e49652c 100644
--- a/src/microhttpd/mhd_sockets.c
+++ b/src/microhttpd/mhd_sockets.c
@@ -516,16 +516,14 @@ MHD_socket_create_listen_ (int pf)
 
 #if defined(MHD_POSIX_SOCKETS) && (defined(SOCK_CLOEXEC) || \
   defined(SOCK_NOSIGPIPE) )
+
+  cloexec_set = (SOCK_CLOEXEC_OR_ZERO != 0);
+#if defined(SOCK_NOSIGPIPE) || defined(MHD_socket_nosignal_)
+  nosigpipe_set = (SOCK_NOSIGPIPE_OR_ZERO != 0);
+#endif /* SOCK_NOSIGPIPE ||  MHD_socket_nosignal_ */
   fd = socket (pf,
                SOCK_STREAM | SOCK_CLOEXEC | SOCK_NOSIGPIPE_OR_ZERO,
                0);
-  if (MHD_INVALID_SOCKET != fd)
-  {
-    cloexec_set = (SOCK_CLOEXEC_OR_ZERO != 0);
-#if defined(SOCK_NOSIGPIPE) || defined(MHD_socket_nosignal_)
-    nosigpipe_set = (SOCK_NOSIGPIPE_OR_ZERO != 0);
-#endif /* SOCK_NOSIGPIPE ||  MHD_socket_nosignal_ */
-  }
 #elif defined(MHD_WINSOCK_SOCKETS) && defined(WSA_FLAG_NO_HANDLE_INHERIT)
   fd = WSASocketW (pf,
                    SOCK_STREAM,
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index 103eb5e5..8249fc35 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -485,7 +485,7 @@ process_value (struct MHD_PostProcessor *pp,
  * @param post_data_len number of bytes in @a post_data
  * @return #MHD_YES on success, #MHD_NO if there was an error processing the 
data
  */
-static int
+static enum MHD_Result
 post_process_urlencoded (struct MHD_PostProcessor *pp,
                          const char *post_data,
                          size_t post_data_len)
@@ -1163,7 +1163,7 @@ free_unmarked (struct MHD_PostProcessor *pp)
  * @param post_data_len number of bytes in @a post_data
  * @return #MHD_NO on error,
  */
-static int
+static enum MHD_Result
 post_process_multipart (struct MHD_PostProcessor *pp,
                         const char *post_data,
                         size_t post_data_len)

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