gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (22a04edf -> 62ac46de)


From: gnunet
Subject: [libmicrohttpd] branch master updated (22a04edf -> 62ac46de)
Date: Sun, 31 Oct 2021 15:41:57 +0100

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 22a04edf websockets interface: added "experimental" warning
     new 291a1480 MHD_get_connection_info(): fixed return value
     new ed503f0b connection.c: fixed code style
     new e1d15585 MHD_set_connection_option(): improved readability
     new 0187a69d Unified timeout parameter processing
     new 62ac46de daemon.c: fixed code style

The 5 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:
 src/microhttpd/connection.c | 20 ++++++++++----------
 src/microhttpd/daemon.c     | 37 ++++++++++++++++++-------------------
 2 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index e64bf8f8..b5724f5b 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -221,7 +221,7 @@ str_conn_error_ (ssize_t mhd_err_code)
  * @return pointer to allocated memory region in the pool or
  *         NULL if no memory is available
  */
-static void*
+static void *
 connection_alloc_memory (struct MHD_Connection *connection,
                          size_t size)
 {
@@ -4818,7 +4818,7 @@ MHD_get_connection_info (struct MHD_Connection 
*connection,
     return (const union MHD_ConnectionInfo *) &connection->suspended_dummy;
   case MHD_CONNECTION_INFO_CONNECTION_TIMEOUT:
     connection->connection_timeout_dummy =
-      (unsigned int) connection->connection_timeout_ms * 1000;
+      (unsigned int) connection->connection_timeout_ms / 1000;
     return (const union MHD_ConnectionInfo *) &connection->
            connection_timeout_dummy;
   case MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE:
@@ -4852,6 +4852,7 @@ MHD_set_connection_option (struct MHD_Connection 
*connection,
 {
   va_list ap;
   struct MHD_Daemon *daemon;
+  unsigned int ui_val;
 
   daemon = connection->daemon;
   switch (option)
@@ -4875,25 +4876,24 @@ MHD_set_connection_option (struct MHD_Connection 
*connection,
                      connection);
     }
     va_start (ap, option);
-    connection->connection_timeout_ms = va_arg (ap,
-                                                unsigned int);
+    ui_val = va_arg (ap, unsigned int);
     va_end (ap);
 #if (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT
-    if ((UINT64_MAX / 2000 - 1) < connection->connection_timeout_ms)
+    if ((UINT64_MAX / 2000 - 1) < ui_val)
     {
 #ifdef HAVE_MESSAGES
       MHD_DLOG (connection->daemon,
-                _ ("The specified connection timeout (" PRIu64 ") is too " \
-                   "large. Maximum allowed value (" PRIu64 ") will be used " \
+                _ ("The specified connection timeout (%u) is too " \
+                   "large. Maximum allowed value (%" PRIu64 ") will be used " \
                    "instead.\n"),
-                connection->connection_timeout_ms,
+                ui_val,
                 (UINT64_MAX / 2000 - 1));
 #endif
-      connection->connection_timeout_ms = UINT64_MAX / 2000 - 1;
+      ui_val = UINT64_MAX / 2000 - 1;
     }
     else
 #endif /* (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT */
-    connection->connection_timeout_ms *= 1000;
+    connection->connection_timeout_ms = ui_val * 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 1c115657..8fae1c64 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -226,9 +226,9 @@ MHD_default_logger_ (void *cls,
                      const char *fm,
                      va_list ap)
 {
-  vfprintf ((FILE*) cls, fm, ap);
+  vfprintf ((FILE *) cls, fm, ap);
 #ifdef _DEBUG
-  fflush ((FILE*) cls);
+  fflush ((FILE *) cls);
 #endif /* _DEBUG */
 }
 
@@ -257,7 +257,7 @@ MHD_free (void *ptr)
  * @param daemon handle to a daemon
  * @return master daemon handle
  */
-static struct MHD_Daemon*
+static struct MHD_Daemon *
 MHD_get_master (struct MHD_Daemon *daemon)
 {
   while (NULL != daemon->master)
@@ -372,7 +372,7 @@ MHD_ip_addr_to_key (const struct sockaddr *addr,
   /* IPv4 addresses */
   if (sizeof (struct sockaddr_in) == addrlen)
   {
-    const struct sockaddr_in *addr4 = (const struct sockaddr_in*) addr;
+    const struct sockaddr_in *addr4 = (const struct sockaddr_in *) addr;
 
     key->family = AF_INET;
     memcpy (&key->addr.ipv4,
@@ -385,7 +385,7 @@ MHD_ip_addr_to_key (const struct sockaddr *addr,
   /* IPv6 addresses */
   if (sizeof (struct sockaddr_in6) == addrlen)
   {
-    const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6*) addr;
+    const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *) addr;
 
     key->family = AF_INET6;
     memcpy (&key->addr.ipv6,
@@ -1752,7 +1752,7 @@ thread_main_connection_upgrade (struct MHD_Connection 
*con)
       /* FIXME: does this check really needed? */
       if (MHD_INVALID_SOCKET != max_fd)
       {
-        struct timeval*tvp;
+        struct timeval *tvp;
         struct timeval tv;
         if (((con->tls_read_ready) &&
              (urh->in_buffer_used < urh->in_buffer_size)) ||
@@ -2579,9 +2579,9 @@ new_connection_prepare_ (struct MHD_Daemon *daemon,
       const char prt1[] = "http/1.1"; /* Registered code for HTTP/1.1 */
       const char prt2[] = "http/1.0"; /* Registered code for HTTP/1.0 */
 
-      prts[0].data = (void*) prt1;
+      prts[0].data = (void *) prt1;
       prts[0].size = MHD_STATICSTR_LEN_ (prt1);
-      prts[1].data = (void*) prt2;
+      prts[1].data = (void *) prt2;
       prts[1].size = MHD_STATICSTR_LEN_ (prt2);
       if (GNUTLS_E_SUCCESS !=
           gnutls_alpn_set_protocols (connection->tls_session,
@@ -5645,14 +5645,13 @@ parse_options_va (struct MHD_Daemon *daemon,
 #ifdef HAVE_MESSAGES
         MHD_DLOG (daemon,
                   _ ("The specified connection timeout (%u) is too large. " \
-                     "Maximum allowed value (" PRIu64 ") will be used " \
+                     "Maximum allowed value (%" PRIu64 ") will be used " \
                      "instead.\n"),
                   uv,
                   (UINT64_MAX / 2000 - 1));
 #endif
-        daemon->connection_timeout_ms = UINT64_MAX / 2000 - 1;
+        uv = UINT64_MAX / 2000 - 1;
       }
-      else
 #endif /* (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT */
       daemon->connection_timeout_ms = uv * 1000;
       break;
@@ -6033,7 +6032,7 @@ parse_options_va (struct MHD_Daemon *daemon,
       break;
     case MHD_OPTION_ARRAY:
       daemon->num_opts--; /* Do not count MHD_OPTION_ARRAY */
-      oa = va_arg (ap, struct MHD_OptionItem*);
+      oa = va_arg (ap, struct MHD_OptionItem *);
       i = 0;
       while (MHD_OPTION_END != (opt = oa[i].option))
       {
@@ -6714,7 +6713,7 @@ MHD_start_daemon_va (unsigned int flags,
       if (0 > setsockopt (listen_fd,
                           SOL_SOCKET,
                           SO_REUSEADDR,
-                          (void*) &on, sizeof (on)))
+                          (void *) &on, sizeof (on)))
       {
 #ifdef HAVE_MESSAGES
         MHD_DLOG (daemon,
@@ -6733,7 +6732,7 @@ MHD_start_daemon_va (unsigned int flags,
       if (0 > setsockopt (listen_fd,
                           SOL_SOCKET,
                           SO_REUSEADDR,
-                          (void*) &on, sizeof (on)))
+                          (void *) &on, sizeof (on)))
       {
 #ifdef HAVE_MESSAGES
         MHD_DLOG (daemon,
@@ -6901,7 +6900,7 @@ MHD_start_daemon_va (unsigned int flags,
       if (0 != setsockopt (listen_fd,
                            IPPROTO_TCP,
                            TCP_FASTOPEN,
-                           (const void*) &daemon->fastopen_queue_size,
+                           (const void *) &daemon->fastopen_queue_size,
                            sizeof (daemon->fastopen_queue_size)))
       {
 #ifdef HAVE_MESSAGES
@@ -8070,7 +8069,7 @@ gcry_w32_mutex_init (void **ppmtx)
 
   if (NULL == *ppmtx)
     return ENOMEM;
-  if (! MHD_mutex_init_ ((MHD_mutex_*) *ppmtx))
+  if (! MHD_mutex_init_ ((MHD_mutex_ *) *ppmtx))
   {
     free (*ppmtx);
     *ppmtx = NULL;
@@ -8084,7 +8083,7 @@ gcry_w32_mutex_init (void **ppmtx)
 static int
 gcry_w32_mutex_destroy (void **ppmtx)
 {
-  int res = (MHD_mutex_destroy_ ((MHD_mutex_*) *ppmtx)) ? 0 : EINVAL;
+  int res = (MHD_mutex_destroy_ ((MHD_mutex_ *) *ppmtx)) ? 0 : EINVAL;
   free (*ppmtx);
   return res;
 }
@@ -8093,14 +8092,14 @@ gcry_w32_mutex_destroy (void **ppmtx)
 static int
 gcry_w32_mutex_lock (void **ppmtx)
 {
-  return MHD_mutex_lock_ ((MHD_mutex_*) *ppmtx) ? 0 : EINVAL;
+  return MHD_mutex_lock_ ((MHD_mutex_ *) *ppmtx) ? 0 : EINVAL;
 }
 
 
 static int
 gcry_w32_mutex_unlock (void **ppmtx)
 {
-  return MHD_mutex_unlock_ ((MHD_mutex_*) *ppmtx) ? 0 : EINVAL;
+  return MHD_mutex_unlock_ ((MHD_mutex_ *) *ppmtx) ? 0 : EINVAL;
 }
 
 

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