gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37902 - in libmicrohttpd: . src/microhttpd


From: gnunet
Subject: [GNUnet-SVN] r37902 - in libmicrohttpd: . src/microhttpd
Date: Wed, 7 Sep 2016 00:29:12 +0200

Author: grothoff
Date: 2016-09-07 00:29:11 +0200 (Wed, 07 Sep 2016)
New Revision: 37902

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/microhttpd/internal.c
   libmicrohttpd/src/microhttpd/memorypool.c
   libmicrohttpd/src/microhttpd/mhd_compat.c
   libmicrohttpd/src/microhttpd/mhd_itc.c
   libmicrohttpd/src/microhttpd/mhd_mono_clock.c
   libmicrohttpd/src/microhttpd/mhd_sockets.c
   libmicrohttpd/src/microhttpd/mhd_str.c
   libmicrohttpd/src/microhttpd/mhd_threads.c
   libmicrohttpd/src/microhttpd/postprocessor.c
   libmicrohttpd/src/microhttpd/reason_phrase.c
   libmicrohttpd/src/microhttpd/response.c
   libmicrohttpd/src/microhttpd/tsearch.c
   libmicrohttpd/src/microhttpd/tsearch.h
Log:
address #4614: mark translatable strings with _-macro

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2016-09-06 22:05:27 UTC (rev 37901)
+++ libmicrohttpd/ChangeLog     2016-09-06 22:29:11 UTC (rev 37902)
@@ -1,3 +1,6 @@
+Wed Sep  7 00:28:59 CEST 2016
+       Adding remaining "_"-markups for i18n (#4614). -CG
+
 Tue Sep  6 23:39:56 CEST 2016
        Allow out-of-order nonces for digest authentication (#4636). -CG
 

Modified: libmicrohttpd/src/microhttpd/internal.c
===================================================================
--- libmicrohttpd/src/microhttpd/internal.c     2016-09-06 22:05:27 UTC (rev 
37901)
+++ libmicrohttpd/src/microhttpd/internal.c     2016-09-06 22:29:11 UTC (rev 
37902)
@@ -86,6 +86,7 @@
 #endif
 #endif
 
+
 #ifdef HAVE_MESSAGES
 /**
  * fprintf-like helper function for logging debug
@@ -92,7 +93,9 @@
  * messages.
  */
 void
-MHD_DLOG (const struct MHD_Daemon *daemon, const char *format, ...)
+MHD_DLOG (const struct MHD_Daemon *daemon,
+          const char *format,
+          ...)
 {
   va_list va;
 
@@ -99,7 +102,9 @@
   if (0 == (daemon->options & MHD_USE_DEBUG))
     return;
   va_start (va, format);
-  daemon->custom_error_log (daemon->custom_error_log_cls, format, va);
+  daemon->custom_error_log (daemon->custom_error_log_cls,
+                            format,
+                            va);
   va_end (va);
 }
 #endif
@@ -141,7 +146,9 @@
       switch (*rpos)
        {
        case '%':
-          if (2 == MHD_strx_to_uint32_n_ (rpos + 1, 2, &num))
+          if (2 == MHD_strx_to_uint32_n_ (rpos + 1,
+                                          2,
+                                          &num))
            {
              *wpos = (char)((unsigned char) num);
              wpos++;

Modified: libmicrohttpd/src/microhttpd/memorypool.c
===================================================================
--- libmicrohttpd/src/microhttpd/memorypool.c   2016-09-06 22:05:27 UTC (rev 
37901)
+++ libmicrohttpd/src/microhttpd/memorypool.c   2016-09-06 22:29:11 UTC (rev 
37902)
@@ -96,19 +96,26 @@
     pool->memory = MAP_FAILED;
   else
 #if defined(MAP_ANONYMOUS) && !defined(_WIN32)
-    pool->memory = mmap (NULL, max, PROT_READ | PROT_WRITE,
-                        MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+    pool->memory = mmap (NULL,
+                         max,
+                         PROT_READ | PROT_WRITE,
+                        MAP_PRIVATE | MAP_ANONYMOUS,
+                         -1,
+                         0);
 #elif defined(_WIN32)
-    pool->memory = VirtualAlloc(NULL, max, MEM_COMMIT | MEM_RESERVE,
-        PAGE_READWRITE);
+    pool->memory = VirtualAlloc (NULL,
+                                 max,
+                                 MEM_COMMIT | MEM_RESERVE,
+                                 PAGE_READWRITE);
 #endif
 #else
   pool->memory = MAP_FAILED;
 #endif
-  if ((pool->memory == MAP_FAILED) || (pool->memory == NULL))
+  if ( (MAP_FAILED == pool->memory) ||
+       (NULL == pool->memory))
     {
       pool->memory = malloc (max);
-      if (pool->memory == NULL)
+      if (NULL == pool->memory)
         {
           free (pool);
           return NULL;
@@ -134,17 +141,20 @@
 void
 MHD_pool_destroy (struct MemoryPool *pool)
 {
-  if (pool == NULL)
+  if (NULL == pool)
     return;
-  if (pool->is_mmap == MHD_NO)
+  if (MHD_NO == pool->is_mmap)
     free (pool->memory);
   else
 #if defined(MAP_ANONYMOUS) && !defined(_WIN32)
-    munmap (pool->memory, pool->size);
+    munmap (pool->memory,
+            pool->size);
 #elif defined(_WIN32)
-    VirtualFree(pool->memory, 0, MEM_RELEASE);
+    VirtualFree (pool->memory,
+                 0,
+                 MEM_RELEASE);
 #else
-    abort();
+    abort ();
 #endif
   free (pool);
 }
@@ -229,9 +239,11 @@
   size_t asize;
 
   asize = ROUND_TO_ALIGN (new_size);
-  if ( (0 == asize) && (0 != new_size) )
+  if ( (0 == asize) &&
+       (0 != new_size) )
     return NULL; /* new_size too close to SIZE_MAX */
-  if ((pool->end < old_size) || (pool->end < asize))
+  if ( (pool->end < old_size) ||
+       (pool->end < asize) )
     return NULL;                /* unsatisfiable or bogus request */
 
   if ( (pool->pos >= old_size) &&
@@ -243,7 +255,9 @@
           /* fits */
           pool->pos += asize - old_size;
           if (asize < old_size)      /* shrinking - zero again! */
-            memset (&pool->memory[pool->pos], 0, old_size - asize);
+            memset (&pool->memory[pool->pos],
+                    0,
+                    old_size - asize);
           return old;
         }
       /* does not fit */
@@ -257,7 +271,9 @@
       /* fits */
       ret = &pool->memory[pool->pos];
       if (0 != old_size)
-        memmove (ret, old, old_size);
+        memmove (ret,
+                 old,
+                 old_size);
       pool->pos += asize;
       return ret;
     }
@@ -285,16 +301,14 @@
                size_t copy_bytes,
                 size_t new_size)
 {
-  if (NULL != keep)
+  if ( (NULL != keep) &&
+       (keep != pool->memory) )
     {
-      if (keep != pool->memory)
-        {
-          if (0 != copy_bytes)
-            memmove (pool->memory,
-                     keep,
-                     copy_bytes);
-          keep = pool->memory;
-        }
+      if (0 != copy_bytes)
+        memmove (pool->memory,
+                 keep,
+                 copy_bytes);
+      keep = pool->memory;
     }
   pool->end = pool->size;
   /* technically not needed, but safer to zero out */

Modified: libmicrohttpd/src/microhttpd/mhd_compat.c
===================================================================
--- libmicrohttpd/src/microhttpd/mhd_compat.c   2016-09-06 22:05:27 UTC (rev 
37901)
+++ libmicrohttpd/src/microhttpd/mhd_compat.c   2016-09-06 22:29:11 UTC (rev 
37902)
@@ -40,30 +40,41 @@
 #ifndef HAVE_SNPRINTF
 /* Emulate snprintf function on W32 */
 int
-W32_snprintf(char *__restrict s,
-             size_t n,
-             const char *__restrict format,
-             ...)
+W32_snprintf (char *__restrict s,
+              size_t n,
+              const char *__restrict format,
+              ...)
 {
   int ret;
   va_list args;
-  if (0 != n && NULL != s )
+
+  if ( (0 != n) &&
+       (NULL != s) )
   {
-    va_start(args, format);
-    ret = _vsnprintf(s, n, format, args);
-    va_end(args);
+    va_start (args,
+              format);
+    ret = _vsnprintf (s,
+                      n,
+                      format,
+                      args);
+    va_end (args);
     if ((int)n == ret)
       s[n - 1] = 0;
     if (ret >= 0)
       return ret;
   }
-  va_start(args, format);
-  ret = _vscprintf(format, args);
+  va_start(args,
+           format);
+  ret = _vscprintf (format,
+                    args);
   va_end(args);
-  if (0 <= ret && 0 != n && NULL == s)
+  if ( (0 <= ret) &&
+       (0 != n) &&
+       (NULL == s) )
     return -1;
 
   return ret;
 }
+
 #endif  /* HAVE_SNPRINTF */
 #endif /* _WIN32  && !__CYGWIN__ */

Modified: libmicrohttpd/src/microhttpd/mhd_itc.c
===================================================================
--- libmicrohttpd/src/microhttpd/mhd_itc.c      2016-09-06 22:05:27 UTC (rev 
37901)
+++ libmicrohttpd/src/microhttpd/mhd_itc.c      2016-09-06 22:29:11 UTC (rev 
37902)
@@ -46,12 +46,15 @@
 {
   int flags;
 
-  flags = fcntl (fd, F_GETFL);
+  flags = fcntl (fd,
+                 F_GETFL);
   if (-1 == flags)
     return 0;
 
   if ( ((flags | O_NONBLOCK) != flags) &&
-       (0 != fcntl (fd, F_SETFL, flags | O_NONBLOCK)) )
+       (0 != fcntl (fd,
+                    F_SETFL,
+                    flags | O_NONBLOCK)) )
     return 0;
 
   return !0;

Modified: libmicrohttpd/src/microhttpd/mhd_mono_clock.c
===================================================================
--- libmicrohttpd/src/microhttpd/mhd_mono_clock.c       2016-09-06 22:05:27 UTC 
(rev 37901)
+++ libmicrohttpd/src/microhttpd/mhd_mono_clock.c       2016-09-06 22:29:11 UTC 
(rev 37902)
@@ -130,6 +130,7 @@
   _MHD_CLOCK_PERFCOUNTER
 };
 
+
 /**
  * Initialise monotonic seconds counter.
  */
@@ -149,62 +150,75 @@
   mono_clock_service = _MHD_INVALID_CLOCK_SERV;
 #endif /* HAVE_CLOCK_GET_TIME */
 
+  /* just a little syntactic trick to get the
+     various following ifdef's to work out nicely */
   if (0)
-  {
-  } else
+    {
+    }
+  else
 #ifdef HAVE_CLOCK_GETTIME
 #ifdef CLOCK_MONOTONIC_COARSE
   /* Linux-specific fast value-getting clock */
   /* Can be affected by frequency adjustment and don't count time in suspend, 
*/
   /* but preferred since it's fast */
-  if (0 == clock_gettime (CLOCK_MONOTONIC_COARSE, &ts))
+  if (0 == clock_gettime (CLOCK_MONOTONIC_COARSE,
+                          &ts))
     {
       mono_clock_id = CLOCK_MONOTONIC_COARSE;
       mono_clock_start = ts.tv_sec;
       mono_clock_source = _MHD_CLOCK_GETTIME;
-    } else
+    }
+  else
 #endif /* CLOCK_MONOTONIC_COARSE */
 #ifdef CLOCK_MONOTONIC_FAST
   /* FreeBSD/DragonFly fast value-getting clock */
   /* Can be affected by frequency adjustment, but preferred since it's fast */
-  if (0 == clock_gettime (CLOCK_MONOTONIC_FAST, &ts))
+  if (0 == clock_gettime (CLOCK_MONOTONIC_FAST,
+                          &ts))
     {
       mono_clock_id = CLOCK_MONOTONIC_FAST;
       mono_clock_start = ts.tv_sec;
       mono_clock_source = _MHD_CLOCK_GETTIME;
-    } else
+    }
+  else
 #endif /* CLOCK_MONOTONIC_COARSE */
 #ifdef CLOCK_MONOTONIC_RAW
   /* Linux-specific clock */
   /* Not affected by frequency adjustment, but don't count time in suspend */
-  if (0 == clock_gettime (CLOCK_MONOTONIC_RAW , &ts))
+  if (0 == clock_gettime (CLOCK_MONOTONIC_RAW,
+                          &ts))
     {
       mono_clock_id = CLOCK_MONOTONIC_RAW;
       mono_clock_start = ts.tv_sec;
       mono_clock_source = _MHD_CLOCK_GETTIME;
-    } else
+    }
+  else
 #endif /* CLOCK_MONOTONIC_RAW */
 #ifdef CLOCK_BOOTTIME
   /* Linux-specific clock */
   /* Count time in suspend so it's real monotonic on Linux, */
   /* but can be slower value-getting than other clocks */
-  if (0 == clock_gettime(CLOCK_BOOTTIME, &ts))
+  if (0 == clock_gettime (CLOCK_BOOTTIME,
+                          &ts))
     {
       mono_clock_id = CLOCK_BOOTTIME;
       mono_clock_start = ts.tv_sec;
       mono_clock_source = _MHD_CLOCK_GETTIME;
-    } else
+    }
+  else
 #endif /* CLOCK_BOOTTIME */
 #ifdef CLOCK_MONOTONIC
   /* Monotonic clock */
   /* Widely supported, may be affected by frequency adjustment */
   /* On Linux it's not truly monotonic as it doesn't count time in suspend */
-  if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
+  if (0 == clock_gettime (CLOCK_MONOTONIC,
+                          &ts))
     {
       mono_clock_id = CLOCK_MONOTONIC;
       mono_clock_start = ts.tv_sec;
       mono_clock_source = _MHD_CLOCK_GETTIME;
-    } else
+    }
+  else
 #endif /* CLOCK_BOOTTIME */
 #endif /* HAVE_CLOCK_GETTIME */
 #ifdef HAVE_CLOCK_GET_TIME
@@ -211,12 +225,16 @@
   /* Darwin-specific monotonic clock */
   /* Should be monotonic as clock_set_time function always unconditionally */
   /* failed on latest kernels */
-  if (KERN_SUCCESS == host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, 
&mono_clock_service) &&
-      KERN_SUCCESS == clock_get_time(mono_clock_service, &cur_time))
+  if ( (KERN_SUCCESS == host_get_clock_service (mach_host_self(),
+                                                SYSTEM_CLOCK,
+                                                &mono_clock_service)) &&
+       (KERN_SUCCESS == clock_get_time (mono_clock_service,
+                                        &cur_time)) )
     {
       mono_clock_start = cur_time.tv_sec;
       mono_clock_source = _MHD_CLOCK_GET_TIME;
-    } else
+    }
+  else
 #endif /* HAVE_CLOCK_GET_TIME */
 #ifdef _WIN32
 #if _WIN32_WINNT >= 0x0600
@@ -224,21 +242,25 @@
   /* Available since Vista, ~15ms accuracy */
   if (1)
     {
-      tick_start = GetTickCount64();
+      tick_start = GetTickCount64 ();
       mono_clock_source = _MHD_CLOCK_GETTICKCOUNT64;
-    } else
+    }
+  else
 #else  /* _WIN32_WINNT < 0x0600 */
   /* W32 specific monotonic clock */
   /* Available on Windows 2000 and later */
   if (1)
     {
-      LARGE_INTEGER freq, perf_counter;
-      QueryPerformanceFrequency(&freq); /* never fail on XP and later */
-      QueryPerformanceCounter(&perf_counter); /* never fail on XP and later */
+      LARGE_INTEGER freq;
+      LARGE_INTEGER perf_counter;
+
+      QueryPerformanceFrequency (&freq); /* never fail on XP and later */
+      QueryPerformanceCounter (&perf_counter); /* never fail on XP and later */
       perf_freq = freq.QuadPart;
       perf_start = perf_counter.QuadPart;
       mono_clock_source = _MHD_CLOCK_PERFCOUNTER;
-    } else
+    }
+  else
 #endif /* _WIN32_WINNT < 0x0600 */
 #endif /* _WIN32 */
 #ifdef HAVE_CLOCK_GETTIME
@@ -245,12 +267,14 @@
 #ifdef CLOCK_HIGHRES
   /* Solaris-specific monotonic high-resolution clock */
   /* Not preferred due to be potentially resource-hungry */
-  if (0 == clock_gettime (CLOCK_HIGHRES, &ts))
+  if (0 == clock_gettime (CLOCK_HIGHRES,
+                          &ts))
     {
       mono_clock_id = CLOCK_HIGHRES;
       mono_clock_start = ts.tv_sec;
       mono_clock_source = _MHD_CLOCK_GETTIME;
-    } else
+    }
+  else
 #endif /* CLOCK_HIGHRES */
 #endif /* HAVE_CLOCK_GETTIME */
 #ifdef HAVE_GETHRTIME
@@ -258,9 +282,10 @@
   /* Not preferred due to be potentially resource-hungry */
   if (1)
     {
-      hrtime_start = gethrtime();
+      hrtime_start = gethrtime ();
       mono_clock_source = _MHD_CLOCK_GETHRTIME;
-    } else
+    }
+  else
 #endif /* HAVE_GETHRTIME */
     {
       /* no suitable clock source was found */
@@ -272,7 +297,8 @@
        (_MHD_INVALID_CLOCK_SERV != mono_clock_service) )
     {
       /* clock service was initialised but clock_get_time failed */
-      mach_port_deallocate (mach_task_self(), mono_clock_service);
+      mach_port_deallocate (mach_task_self(),
+                            mono_clock_service);
       mono_clock_service = _MHD_INVALID_CLOCK_SERV;
     }
 #else
@@ -292,12 +318,14 @@
 #ifdef HAVE_CLOCK_GET_TIME
   if (_MHD_INVALID_CLOCK_SERV != mono_clock_service)
     {
-      mach_port_deallocate(mach_task_self(), mono_clock_service);
+      mach_port_deallocate (mach_task_self(),
+                            mono_clock_service);
       mono_clock_service = _MHD_INVALID_CLOCK_SERV;
     }
 #endif /* HAVE_CLOCK_GET_TIME */
 }
 
+
 /**
  * Monotonic seconds counter, useful for timeout calculation.
  * Tries to be not affected by manually setting the system real time
@@ -311,8 +339,9 @@
 #ifdef HAVE_CLOCK_GETTIME
   struct timespec ts;
 
-  if (_MHD_UNWANTED_CLOCK != mono_clock_id &&
-      0 == clock_gettime (mono_clock_id , &ts))
+  if ( (_MHD_UNWANTED_CLOCK != mono_clock_id) &&
+       (0 == clock_gettime (mono_clock_id ,
+                            &ts)) )
     return ts.tv_sec - mono_clock_start;
 #endif /* HAVE_CLOCK_GETTIME */
 #ifdef HAVE_CLOCK_GET_TIME
@@ -319,7 +348,9 @@
   if (_MHD_INVALID_CLOCK_SERV != mono_clock_service)
     {
       mach_timespec_t cur_time;
-      if (KERN_SUCCESS == clock_get_time(mono_clock_service, &cur_time))
+
+      if (KERN_SUCCESS == clock_get_time(mono_clock_service,
+                                         &cur_time))
         return cur_time.tv_sec - mono_clock_start;
     }
 #endif /* HAVE_CLOCK_GET_TIME */
@@ -331,7 +362,8 @@
   if (0 != perf_freq)
     {
       LARGE_INTEGER perf_counter;
-      QueryPerformanceCounter(&perf_counter); /* never fail on XP and later */
+
+      QueryPerformanceCounter (&perf_counter); /* never fail on XP and later */
       return (time_t)(((uint64_t)(perf_counter.QuadPart - perf_start)) / 
perf_freq);
     }
 #endif /* _WIN32_WINNT < 0x0600 */
@@ -338,7 +370,7 @@
 #endif /* _WIN32 */
 #ifdef HAVE_GETHRTIME
   if (1)
-    return (time_t)(((uint64_t)(gethrtime() - hrtime_start)) / 1000000000);
+    return (time_t)(((uint64_t) (gethrtime () - hrtime_start)) / 1000000000);
 #endif /* HAVE_GETHRTIME */
 
   return time (NULL) - sys_clock_start;

Modified: libmicrohttpd/src/microhttpd/mhd_sockets.c
===================================================================
--- libmicrohttpd/src/microhttpd/mhd_sockets.c  2016-09-06 22:05:27 UTC (rev 
37901)
+++ libmicrohttpd/src/microhttpd/mhd_sockets.c  2016-09-06 22:29:11 UTC (rev 
37902)
@@ -243,12 +243,14 @@
  * @param sockets_pair array to receive resulted sockets
  * @return non-zero if succeeded, zero otherwise
  */
-int MHD_W32_socket_pair_(SOCKET sockets_pair[2])
+int
+MHD_W32_socket_pair_(SOCKET sockets_pair[2])
 {
   int i;
-  if (!sockets_pair)
+
+  if (! sockets_pair)
     {
-      WSASetLastError(WSAEFAULT);
+      WSASetLastError (WSAEFAULT);
       return 0;
     }
 
@@ -261,7 +263,9 @@
       int addr_len = c_addinlen;
       int opt = 1;
 
-      listen_s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+      listen_s = socket (AF_INET,
+                         SOCK_STREAM,
+                         IPPROTO_TCP);
       if (INVALID_SOCKET == listen_s)
         break; /* can't create even single socket */
 
@@ -268,45 +272,77 @@
       listen_addr.sin_family = AF_INET;
       listen_addr.sin_port = 0; /* same as htons(0) */
       listen_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-      if (0 == bind(listen_s, (struct sockaddr*) &listen_addr, c_addinlen)
-          && 0 == listen(listen_s, 1)
-          && 0 == getsockname(listen_s, (struct sockaddr*) &listen_addr,
-                  &addr_len))
+      if ( (0 == bind (listen_s,
+                       (struct sockaddr*) &listen_addr,
+                       c_addinlen) &&
+            (0 == listen (listen_s,
+                          1) )
+            (0 == getsockname (listen_s,
+                               (struct sockaddr*) &listen_addr,
+                               &addr_len))) )
         {
-          SOCKET client_s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
-          if (INVALID_SOCKET != client_s)
+          SOCKET client_s = socket(AF_INET,
+                                   SOCK_STREAM,
+                                   IPPROTO_TCP);
+          struct sockaddr_in accepted_from_addr;
+          struct sockaddr_in client_addr;
+          SOCKET server_s;
+
+          if (INVALID_SOCKET == client_s)
             {
-              if (0 == ioctlsocket(client_s, FIONBIO, (u_long*) &opt)
-                  && (0 == connect(client_s, (struct sockaddr*) &listen_addr, 
c_addinlen)
-                      || WSAGetLastError() == WSAEWOULDBLOCK))
-                {
-                  struct sockaddr_in accepted_from_addr;
-                  SOCKET server_s;
-                  addr_len = c_addinlen;
-                  server_s = accept(listen_s,
-                      (struct sockaddr*) &accepted_from_addr, &addr_len);
-                  if (INVALID_SOCKET != server_s)
-                    {
-                      struct sockaddr_in client_addr;
-                      addr_len = c_addinlen;
-                      opt = 0;
-                      if (0 == getsockname(client_s, (struct sockaddr*) 
&client_addr, &addr_len)
-                          && accepted_from_addr.sin_family == 
client_addr.sin_family
-                          && accepted_from_addr.sin_port == 
client_addr.sin_port
-                          && accepted_from_addr.sin_addr.s_addr == 
client_addr.sin_addr.s_addr
-                          && 0 == ioctlsocket(client_s, FIONBIO, (u_long*) 
&opt)
-                          && 0 == ioctlsocket(server_s, FIONBIO, (u_long*) 
&opt))
-                        {
-                          closesocket(listen_s);
-                          sockets_pair[0] = client_s;
-                          sockets_pair[1] = server_s;
-                          return !0;
-                        }
-                      closesocket(server_s);
-                    }
-                }
-              closesocket(client_s);
+              /* try again */
+              closesocket (listen_s);
+              continue;
             }
+
+          if ( (0 != ioctlsocket (client_s,
+                                  FIONBIO,
+                                  (u_long*) &opt)) ||
+               ( (0 != connect (client_s,
+                                (struct sockaddr*) &listen_addr,
+                                c_addinlen)) &&
+                 (WSAGetLastError() != WSAEWOULDBLOCK)) )
+            {
+              /* try again */
+              closesocket (listen_s);
+              closesocket (client_s);
+              continue;
+            }
+
+          addr_len = c_addinlen;
+          server_s = accept (listen_s,
+                             (struct sockaddr*) &accepted_from_addr,
+                             &addr_len);
+          if (INVALID_SOCKET == server_s)
+            {
+              /* try again */
+              closesocket (listen_s);
+              closesocket (client_s);
+              continue;
+            }
+
+          addr_len = c_addinlen;
+          opt = 0;
+          if ( (0 == getsockname (client_s,
+                                  (struct sockaddr*) &client_addr,
+                                  &addr_len)) &&
+               (accepted_from_addr.sin_family == client_addr.sin_family) &&
+               (accepted_from_addr.sin_port == client_addr.sin_port) &&
+               (accepted_from_addr.sin_addr.s_addr == 
client_addr.sin_addr.s_addr) &&
+               (0 == ioctlsocket(client_s,
+                                 FIONBIO,
+                                 (u_long*) &opt)) &&
+               (0 == ioctlsocket(server_s,
+                                 FIONBIO,
+                                 (u_long*) &opt)) )
+            {
+              closesocket (listen_s);
+              sockets_pair[0] = client_s;
+              sockets_pair[1] = server_s;
+              return !0;
+            }
+          closesocket (server_s);
+          closesocket (client_s);
         }
       closesocket(listen_s);
     }
@@ -367,17 +403,22 @@
 #if defined(MHD_POSIX_SOCKETS)
   int flags;
 
-  flags = fcntl (sock, F_GETFL);
+  flags = fcntl (sock,
+                 F_GETFL);
   if (-1 == flags)
     return 0;
 
   if ( ((flags | O_NONBLOCK) != flags) &&
-       (0 != fcntl (sock, F_SETFL, flags | O_NONBLOCK)) )
+       (0 != fcntl (sock,
+                    F_SETFL,
+                    flags | O_NONBLOCK)) )
     return 0;
 #elif defined(MHD_WINSOCK_SOCKETS)
   unsigned long flags = 1;
 
-  if (0 != ioctlsocket (sock, FIONBIO, &flags))
+  if (0 != ioctlsocket (sock,
+                        FIONBIO,
+                        &flags))
     return 0;
 #endif /* MHD_WINSOCK_SOCKETS */
   return !0;
@@ -397,15 +438,20 @@
 #if defined(MHD_POSIX_SOCKETS)
   int flags;
 
-  flags = fcntl (sock, F_GETFD);
+  flags = fcntl (sock,
+                 F_GETFD);
   if (-1 == flags)
     return 0;
 
   if ( ((flags | FD_CLOEXEC) != flags) &&
-       (0 != fcntl (sock, F_SETFD, flags | FD_CLOEXEC)) )
+       (0 != fcntl (sock,
+                    F_SETFD,
+                    flags | FD_CLOEXEC)) )
     return 0;
 #elif defined(MHD_WINSOCK_SOCKETS)
-  if (!SetHandleInformation ((HANDLE)sock, HANDLE_FLAG_INHERIT, 0))
+  if (! SetHandleInformation ((HANDLE)sock,
+                              HANDLE_FLAG_INHERIT,
+                              0))
     return 0;
 #endif /* MHD_WINSOCK_SOCKETS */
   return !0;
@@ -437,10 +483,17 @@
 #endif /* ! HAVE_INET6 */
 
 #if defined(MHD_POSIX_SOCKETS) && defined(SOCK_CLOEXEC)
-  fd = socket (domain, SOCK_STREAM | SOCK_CLOEXEC, 0);
+  fd = socket (domain,
+               SOCK_STREAM | SOCK_CLOEXEC,
+               0);
   cloexec_set = !0;
 #elif defined(MHD_WINSOCK_SOCKETS) && defined (WSA_FLAG_NO_HANDLE_INHERIT)
-  fd = WSASocketW (domain, SOCK_STREAM, 0, NULL, 0, 
WSA_FLAG_NO_HANDLE_INHERIT);
+  fd = WSASocketW (domain,
+                   SOCK_STREAM,
+                   0,
+                   NULL,
+                   0,
+                   WSA_FLAG_NO_HANDLE_INHERIT);
   cloexec_set = !0;
 #else  /* !SOCK_CLOEXEC */
   fd = MHD_INVALID_SOCKET;
@@ -447,22 +500,28 @@
 #endif /* !SOCK_CLOEXEC */
   if (MHD_INVALID_SOCKET == fd)
     {
-      fd = socket (domain, SOCK_STREAM, 0);
+      fd = socket (domain,
+                   SOCK_STREAM,
+                   0);
       cloexec_set = 0;
     }
   if (MHD_INVALID_SOCKET == fd)
     return MHD_INVALID_SOCKET;
 #if defined(OSX) && defined(SOL_SOCKET) && defined(SO_NOSIGPIPE)
-  if(0 != setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &on_val, sizeof(on_val)))
+  if(0 != setsockopt(fd,
+                     SOL_SOCKET,
+                     SO_NOSIGPIPE,
+                     &on_val,
+                     sizeof (on_val)))
     {
-      int err = MHD_socket_get_error_();
-      MHD_socket_close_(fd);
-      MHD_socket_fset_error_(err);
+      int err = MHD_socket_get_error_ ();
+      MHD_socket_close_ (fd);
+      MHD_socket_fset_error_ (err);
       return MHD_INVALID_SOCKET;
     }
 #endif
-  if (!cloexec_set)
-    (void)MHD_socket_noninheritable_(fd);
+  if (! cloexec_set)
+    (void) MHD_socket_noninheritable_ (fd);
 
   return fd;
 }

Modified: libmicrohttpd/src/microhttpd/mhd_str.c
===================================================================
--- libmicrohttpd/src/microhttpd/mhd_str.c      2016-09-06 22:05:27 UTC (rev 
37901)
+++ libmicrohttpd/src/microhttpd/mhd_str.c      2016-09-06 22:29:11 UTC (rev 
37902)
@@ -35,7 +35,7 @@
 #ifdef _MHD_inline
 #undef _MHD_inline
 #endif /* _MHD_inline */
-/* Do not force inlining and do not use macro functions, use normal static 
+/* Do not force inlining and do not use macro functions, use normal static
    functions instead.
    This may give more flexibility for size optimizations. */
 #define _MHD_inline static
@@ -52,6 +52,7 @@
 #ifdef INLINE_FUNC
 /**
  * Check whether character is lower case letter in US-ASCII
+ *
  * @param c character to check
  * @return non-zero if character is lower case letter, zero otherwise
  */
@@ -58,11 +59,13 @@
 _MHD_inline _MHD_bool
 isasciilower (char c)
 {
-  return c >= 'a' && c <= 'z';
+  return (c >= 'a') && (c <= 'z');
 }
 
+
 /**
  * Check whether character is upper case letter in US-ASCII
+ *
  * @param c character to check
  * @return non-zero if character is upper case letter, zero otherwise
  */
@@ -69,11 +72,13 @@
 _MHD_inline _MHD_bool
 isasciiupper (char c)
 {
-  return c >= 'A' && c <= 'Z';
+  return (c >= 'A') && (c <= 'Z');
 }
 
+
 /**
  * Check whether character is letter in US-ASCII
+ *
  * @param c character to check
  * @return non-zero if character is letter in US-ASCII, zero otherwise
  */
@@ -83,8 +88,10 @@
   return isasciilower (c) || isasciiupper (c);
 }
 
+
 /**
  * Check whether character is decimal digit in US-ASCII
+ *
  * @param c character to check
  * @return non-zero if character is decimal digit, zero otherwise
  */
@@ -91,11 +98,13 @@
 _MHD_inline _MHD_bool
 isasciidigit (char c)
 {
-  return c >= '0' && c <= '9';
+  return (c >= '0') && (c <= '9');
 }
 
+
 /**
  * Check whether character is hexadecimal digit in US-ASCII
+ *
  * @param c character to check
  * @return non-zero if character is decimal digit, zero otherwise
  */
@@ -103,12 +112,14 @@
 isasciixdigit (char c)
 {
   return isasciidigit (c) ||
-         (c >= 'A' && c <= 'F') ||
-         (c >= 'a' && c <= 'f');
+    ( (c >= 'A') && (c <= 'F') ) ||
+    ( (c >= 'a') && (c <= 'f') );
 }
 
+
 /**
  * Check whether character is decimal digit or letter in US-ASCII
+ *
  * @param c character to check
  * @return non-zero if character is decimal digit or letter, zero otherwise
  */
@@ -118,11 +129,13 @@
   return isasciialpha (c) || isasciidigit (c);
 }
 
+
 /**
  * Convert US-ASCII character to lower case.
  * If character is upper case letter in US-ASCII than it's converted to lower
  * case analog. If character is NOT upper case letter than it's returned
  * unmodified.
+ *
  * @param c character to convert
  * @return converted to lower case character
  */
@@ -132,11 +145,13 @@
   return isasciiupper (c) ? (c - 'A' + 'a') : c;
 }
 
+
 /**
  * Convert US-ASCII character to upper case.
  * If character is lower case letter in US-ASCII than it's converted to upper
  * case analog. If character is NOT lower case letter than it's returned
  * unmodified.
+ *
  * @param c character to convert
  * @return converted to upper case character
  */
@@ -146,8 +161,10 @@
   return isasciilower (c) ? (c - 'a' + 'A') : c;
 }
 
+
 /**
  * Convert US-ASCII decimal digit to its value.
+ *
  * @param c character to convert
  * @return value of hexadecimal digit or -1 if @ c is not hexadecimal digit
  */
@@ -160,8 +177,10 @@
   return -1;
 }
 
+
 /**
  * Convert US-ASCII hexadecimal digit to its value.
+ *
  * @param c character to convert
  * @return value of hexadecimal digit or -1 if @ c is not hexadecimal digit
  */
@@ -170,9 +189,9 @@
 {
   if (isasciidigit (c))
     return (unsigned char)(c - '0');
-  if (c >= 'A' && c <= 'F')
+  if ( (c >= 'A') && (c <= 'F') )
     return (unsigned char)(c - 'A' + 10);
-  if (c >= 'a' && c <= 'f')
+  if ( (c >= 'a') && (c <= 'f') )
     return (unsigned char)(c - 'a' + 10);
 
   return -1;
@@ -179,8 +198,10 @@
 }
 #else  /* !INLINE_FUNC */
 
+
 /**
  * Checks whether character is lower case letter in US-ASCII
+ *
  * @param c character to check
  * @return boolean true if character is lower case letter,
  *         boolean false otherwise
@@ -187,8 +208,10 @@
  */
 #define isasciilower(c) (((char)(c)) >= 'a' && ((char)(c)) <= 'z')
 
+
 /**
  * Checks whether character is upper case letter in US-ASCII
+ *
  * @param c character to check
  * @return boolean true if character is upper case letter,
  *         boolean false otherwise
@@ -195,8 +218,10 @@
  */
 #define isasciiupper(c) (((char)(c)) >= 'A' && ((char)(c)) <= 'Z')
 
+
 /**
  * Checks whether character is letter in US-ASCII
+ *
  * @param c character to check
  * @return boolean true if character is letter, boolean false
  *         otherwise
@@ -203,8 +228,10 @@
  */
 #define isasciialpha(c) (isasciilower(c) || isasciiupper(c))
 
+
 /**
  * Check whether character is decimal digit in US-ASCII
+ *
  * @param c character to check
  * @return boolean true if character is decimal digit, boolean false
  *         otherwise
@@ -211,8 +238,10 @@
  */
 #define isasciidigit(c) (((char)(c)) >= '0' && ((char)(c)) <= '9')
 
+
 /**
  * Check whether character is hexadecimal digit in US-ASCII
+ *
  * @param c character to check
  * @return boolean true if character is hexadecimal digit,
  *         boolean false otherwise
@@ -221,8 +250,10 @@
                           (((char)(c)) >= 'A' && ((char)(c)) <= 'F') || \
                           (((char)(c)) >= 'a' && ((char)(c)) <= 'f') )
 
+
 /**
  * Check whether character is decimal digit or letter in US-ASCII
+ *
  * @param c character to check
  * @return boolean true if character is decimal digit or letter,
  *         boolean false otherwise
@@ -229,33 +260,40 @@
  */
 #define isasciialnum(c) (isasciialpha(c) || isasciidigit(c))
 
+
 /**
  * Convert US-ASCII character to lower case.
  * If character is upper case letter in US-ASCII than it's converted to lower
  * case analog. If character is NOT upper case letter than it's returned
  * unmodified.
+ *
  * @param c character to convert
  * @return converted to lower case character
  */
 #define toasciilower(c) ((isasciiupper(c)) ? (((char)(c)) - 'A' + 'a') : 
((char)(c)))
 
+
 /**
  * Convert US-ASCII character to upper case.
  * If character is lower case letter in US-ASCII than it's converted to upper
  * case analog. If character is NOT lower case letter than it's returned
  * unmodified.
+ *
  * @param c character to convert
  * @return converted to upper case character
  */
 #define toasciiupper(c) ((isasciilower(c)) ? (((char)(c)) - 'a' + 'A') : 
((char)(c)))
 
+
 /**
  * Convert US-ASCII decimal digit to its value.
+ *
  * @param c character to convert
  * @return value of hexadecimal digit or -1 if @ c is not hexadecimal digit
  */
 #define todigitvalue(c) (isasciidigit(c) ? (int)(((char)(c)) - '0') : 
(int)(-1))
 
+
 /**
  * Convert US-ASCII hexadecimal digit to its value.
  * @param c character to convert
@@ -268,21 +306,25 @@
                                (int)(((unsigned char)(c)) - 'a' + 10) : 
(int)(-1) )))
 #endif /* !INLINE_FUNC */
 
+
 #ifndef MHD_FAVOR_SMALL_CODE
 /**
  * Check two string for equality, ignoring case of US-ASCII letters.
+ *
  * @param str1 first string to compare
  * @param str2 second string to compare
  * @return non-zero if two strings are equal, zero otherwise.
  */
 int
-MHD_str_equal_caseless_ (const char * str1, const char * str2)
+MHD_str_equal_caseless_ (const char * str1,
+                         const char * str2)
 {
   while (0 != (*str1))
     {
       const char c1 = *str1;
       const char c2 = *str2;
-      if (c1 != c2 && toasciilower (c1) != toasciilower (c2))
+      if ( (c1 != c2) &&
+           (toasciilower (c1) != toasciilower (c2)) )
         return 0;
       str1++;
       str2++;
@@ -297,6 +339,7 @@
  * checking not more than @a maxlen characters.
  * Compares up to first terminating null character, but not more than
  * first @a maxlen characters.
+ *
  * @param str1 first string to compare
  * @param str2 second string to compare
  * @param maxlen maximum number of characters to compare
@@ -303,9 +346,12 @@
  * @return non-zero if two strings are equal, zero otherwise.
  */
 int
-MHD_str_equal_caseless_n_ (const char * const str1, const char * const str2, 
size_t maxlen)
+MHD_str_equal_caseless_n_ (const char * const str1,
+                           const char * const str2,
+                           size_t maxlen)
 {
   size_t i;
+
   for (i = 0; i < maxlen; ++i)
     {
       const char c1 = str1[i];
@@ -312,7 +358,8 @@
       const char c2 = str2[i];
       if (0 == c2)
         return 0 == c1;
-      if (c1 != c2 && toasciilower (c1) != toasciilower (c2))
+      if ( (c1 != c2) &&
+           (toasciilower (c1) != toasciilower (c2)) )
         return 0;
     }
   return !0;
@@ -324,17 +371,20 @@
 /**
  * Convert decimal US-ASCII digits in string to number in uint64_t.
  * Conversion stopped at first non-digit character.
+ *
  * @param str string to convert
- * @param out_val pointer to uint64_t to store result of conversion
+ * @param[out] out_val pointer to uint64_t to store result of conversion
  * @return non-zero number of characters processed on succeed,
  *         zero if no digit is found, resulting value is larger
  *         then possible to store in uint64_t or @a out_val is NULL
  */
-size_t 
-MHD_str_to_uint64_ (const char * str, uint64_t * out_val)
+size_t
+MHD_str_to_uint64_ (const char *str,
+                    uint64_t *out_val)
 {
   const char * const start = str;
   uint64_t res;
+
   if (!str || !out_val || !isasciidigit(str[0]))
     return 0;
 
@@ -343,7 +393,8 @@
     {
       const int digit = (unsigned char)(*str) - '0';
       if ( (res > (UINT64_MAX / 10)) ||
-           (res == (UINT64_MAX / 10) && (uint64_t)digit > (UINT64_MAX % 10)) )
+           ( (res == (UINT64_MAX / 10)) &&
+             ((uint64_t)digit > (UINT64_MAX % 10)) ) )
         return 0;
 
       res *= 10;
@@ -359,20 +410,24 @@
 /**
  * Convert not more then @a maxlen decimal US-ASCII digits in string to
  * number in uint64_t.
- * Conversion stopped at first non-digit character or after @a maxlen 
+ * Conversion stopped at first non-digit character or after @a maxlen
  * digits.
+ *
  * @param str string to convert
  * @param maxlen maximum number of characters to process
- * @param out_val pointer to uint64_t to store result of conversion
+ * @param[out] out_val pointer to uint64_t to store result of conversion
  * @return non-zero number of characters processed on succeed,
  *         zero if no digit is found, resulting value is larger
  *         then possible to store in uint64_t or @a out_val is NULL
  */
 size_t
-MHD_str_to_uint64_n_ (const char * str, size_t maxlen, uint64_t * out_val)
+MHD_str_to_uint64_n_ (const char * str,
+                      size_t maxlen,
+                      uint64_t *out_val)
 {
   uint64_t res;
   size_t i;
+
   if (!str || !maxlen || !out_val || !isasciidigit (str[0]))
     return 0;
 
@@ -381,14 +436,17 @@
   do
     {
       const int digit = (unsigned char)str[i] - '0';
+
       if ( (res > (UINT64_MAX / 10)) ||
-           (res == (UINT64_MAX / 10) && (uint64_t)digit > (UINT64_MAX % 10)) )
+           ( (res == (UINT64_MAX / 10)) &&
+             ((uint64_t)digit > (UINT64_MAX % 10)) ) )
         return 0;
 
       res *= 10;
       res += digit;
-      i++;      
-    } while(i < maxlen && isasciidigit(str[i]));
+      i++;
+    } while ( (i < maxlen) &&
+              isasciidigit (str[i]) );
 
   *out_val= res;
   return i;
@@ -398,18 +456,21 @@
 /**
  * Convert hexadecimal US-ASCII digits in string to number in size_t.
  * Conversion stopped at first non-digit character.
+ *
  * @param str string to convert
- * @param out_val pointer to size_t to store result of conversion
- * @return non-zero number of characters processed on succeed, 
+ * @param[out] out_val pointer to size_t to store result of conversion
+ * @return non-zero number of characters processed on succeed,
  *         zero if no digit is found, resulting value is larger
  *         then possible to store in size_t or @a out_val is NULL
  */
 size_t
-MHD_strx_to_sizet_ (const char * str, size_t * out_val)
+MHD_strx_to_sizet_ (const char *str,
+                    size_t *out_val)
 {
   const char * const start = str;
   size_t res;
   int digit;
+
   if (!str || !out_val)
     return 0;
 
@@ -418,7 +479,8 @@
   while (digit >= 0)
     {
       if ( (res < (SIZE_MAX / 16)) ||
-           (res == (SIZE_MAX / 16) && (size_t)digit <= (SIZE_MAX % 16)) )
+           ( (res == (SIZE_MAX / 16)) &&
+             ((size_t)digit <= (SIZE_MAX % 16)) ) )
         {
           res *= 16;
           res += digit;
@@ -438,17 +500,20 @@
 /**
  * Convert not more then @a maxlen hexadecimal US-ASCII digits in string
  * to number in size_t.
- * Conversion stopped at first non-digit character or after @a maxlen 
+ * Conversion stopped at first non-digit character or after @a maxlen
  * digits.
+ *
  * @param str string to convert
  * @param maxlen maximum number of characters to process
- * @param out_val pointer to size_t to store result of conversion
+ * @param[out] out_val pointer to size_t to store result of conversion
  * @return non-zero number of characters processed on succeed,
  *         zero if no digit is found, resulting value is larger
  *         then possible to store in size_t or @a out_val is NULL
  */
 size_t
-MHD_strx_to_sizet_n_ (const char * str, size_t maxlen, size_t * out_val)
+MHD_strx_to_sizet_n_ (const char * str,
+                      size_t maxlen,
+                      size_t *out_val)
 {
   size_t i;
   size_t res;
@@ -455,13 +520,15 @@
   int digit;
   if (!str || !out_val)
     return 0;
-  
+
   res = 0;
   i = 0;
-  while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0)
+  while ( (i < maxlen) &&
+          ((digit = toxdigitvalue (str[i])) >= 0) )
     {
       if ( (res > (SIZE_MAX / 16)) ||
-           (res == (SIZE_MAX / 16) && (size_t)digit > (SIZE_MAX % 16)) )
+           ( (res == (SIZE_MAX / 16)) &&
+             ((size_t)digit > (SIZE_MAX % 16)) ) )
         return 0;
 
       res *= 16;
@@ -478,18 +545,21 @@
 /**
  * Convert hexadecimal US-ASCII digits in string to number in uint32_t.
  * Conversion stopped at first non-digit character.
+ *
  * @param str string to convert
- * @param out_val pointer to uint32_t to store result of conversion
- * @return non-zero number of characters processed on succeed, 
+ * @param[out] out_val pointer to uint32_t to store result of conversion
+ * @return non-zero number of characters processed on succeed,
  *         zero if no digit is found, resulting value is larger
  *         then possible to store in uint32_t or @a out_val is NULL
  */
 size_t
-MHD_strx_to_uint32_ (const char * str, uint32_t * out_val)
+MHD_strx_to_uint32_ (const char * str,
+                     uint32_t *out_val)
 {
   const char * const start = str;
   uint32_t res;
   int digit;
+
   if (!str || !out_val)
     return 0;
 
@@ -518,17 +588,20 @@
 /**
  * Convert not more then @a maxlen hexadecimal US-ASCII digits in string
  * to number in uint32_t.
- * Conversion stopped at first non-digit character or after @a maxlen 
+ * Conversion stopped at first non-digit character or after @a maxlen
  * digits.
+ *
  * @param str string to convert
  * @param maxlen maximum number of characters to process
- * @param out_val pointer to uint32_t to store result of conversion
+ * @param[out] out_val pointer to uint32_t to store result of conversion
  * @return non-zero number of characters processed on succeed,
  *         zero if no digit is found, resulting value is larger
  *         then possible to store in uint32_t or @a out_val is NULL
  */
 size_t
-MHD_strx_to_uint32_n_ (const char * str, size_t maxlen, uint32_t * out_val)
+MHD_strx_to_uint32_n_ (const char *str,
+                       size_t maxlen,
+                       uint32_t *out_val)
 {
   size_t i;
   uint32_t res;
@@ -535,7 +608,7 @@
   int digit;
   if (!str || !out_val)
     return 0;
-  
+
   res = 0;
   i = 0;
   while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0)
@@ -558,14 +631,16 @@
 /**
  * Convert hexadecimal US-ASCII digits in string to number in uint64_t.
  * Conversion stopped at first non-digit character.
+ *
  * @param str string to convert
- * @param out_val pointer to uint64_t to store result of conversion
- * @return non-zero number of characters processed on succeed, 
+ * @param[out] out_val pointer to uint64_t to store result of conversion
+ * @return non-zero number of characters processed on succeed,
  *         zero if no digit is found, resulting value is larger
  *         then possible to store in uint64_t or @a out_val is NULL
  */
 size_t
-MHD_strx_to_uint64_ (const char * str, uint64_t * out_val)
+MHD_strx_to_uint64_ (const char *str,
+                     uint64_t *out_val)
 {
   const char * const start = str;
   uint64_t res;
@@ -598,17 +673,20 @@
 /**
  * Convert not more then @a maxlen hexadecimal US-ASCII digits in string
  * to number in uint64_t.
- * Conversion stopped at first non-digit character or after @a maxlen 
+ * Conversion stopped at first non-digit character or after @a maxlen
  * digits.
+ *
  * @param str string to convert
  * @param maxlen maximum number of characters to process
- * @param out_val pointer to uint64_t to store result of conversion
+ * @param[out] out_val pointer to uint64_t to store result of conversion
  * @return non-zero number of characters processed on succeed,
  *         zero if no digit is found, resulting value is larger
  *         then possible to store in uint64_t or @a out_val is NULL
  */
 size_t
-MHD_strx_to_uint64_n_ (const char * str, size_t maxlen, uint64_t * out_val)
+MHD_strx_to_uint64_n_ (const char * str,
+                       size_t maxlen,
+                       uint64_t *out_val)
 {
   size_t i;
   uint64_t res;
@@ -615,7 +693,7 @@
   int digit;
   if (!str || !out_val)
     return 0;
-  
+
   res = 0;
   i = 0;
   while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0)
@@ -639,9 +717,10 @@
 /**
  * Generic function for converting not more then @a maxlen
  * hexadecimal or decimal US-ASCII digits in string to number.
- * Conversion stopped at first non-digit character or after @a maxlen 
+ * Conversion stopped at first non-digit character or after @a maxlen
  * digits.
  * To be used only within macro.
+ *
  * @param str the string to convert
  * @param maxlen the maximum number of characters to process
  * @param out_val the pointer to variable to store result of conversion
@@ -653,8 +732,12 @@
  *         then @max_val, @val_size is not 16/32 or @a out_val is NULL
  */
 size_t
-MHD_str_to_uvalue_n_ (const char * str, size_t maxlen,
-                      void * out_val, size_t val_size, uint64_t max_val, int 
base)
+MHD_str_to_uvalue_n_ (const char *str,
+                      size_t maxlen,
+                      void * out_val,
+                      size_t val_size,
+                      uint64_t max_val,
+                      int base)
 {
   size_t i;
   uint64_t res;
@@ -664,6 +747,7 @@
   /* 'digit->value' must be function, not macro */
   int (*const dfunc)(char) = (base == 16) ?
                               toxdigitvalue : todigitvalue;
+
   if ( !str || !out_val ||
        (base != 16 && base != 10) )
     return 0;

Modified: libmicrohttpd/src/microhttpd/mhd_threads.c
===================================================================
--- libmicrohttpd/src/microhttpd/mhd_threads.c  2016-09-06 22:05:27 UTC (rev 
37901)
+++ libmicrohttpd/src/microhttpd/mhd_threads.c  2016-09-06 22:29:11 UTC (rev 
37902)
@@ -56,13 +56,17 @@
 #if defined(MHD_USE_POSIX_THREADS)
 #if defined(HAVE_PTHREAD_SETNAME_NP_GNU) || 
defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) \
     || defined(HAVE_PTHREAD_SETNAME_NP_NETBSD)
+
 /**
  * Set thread name
+ *
  * @param thread_id ID of thread
  * @param thread_name name to set
  * @return non-zero on success, zero otherwise
  */
-static int MHD_set_thread_name_(const MHD_thread_ID_ thread_id, const char 
*thread_name)
+static int
+MHD_set_thread_name_(const MHD_thread_ID_ thread_id,
+                     const char *thread_name)
 {
   if (NULL == thread_name)
     return 0;
@@ -110,11 +114,14 @@
 #else  /* _MSC_FULL_VER */
 /**
  * Set thread name
+ *
  * @param thread_id ID of thread, -1 for current thread
  * @param thread_name name to set
  * @return non-zero on success, zero otherwise
  */
-static int MHD_set_thread_name_(const MHD_thread_ID_ thread_id, const char 
*thread_name)
+static int
+MHD_set_thread_name_(const MHD_thread_ID_ thread_id,
+                     const char *thread_name)
 {
   static const DWORD VC_SETNAME_EXC = 0x406D1388;
 #pragma pack(push,8)
@@ -137,7 +144,10 @@
 
   __try
   { /* This exception is intercepted by debugger */
-    RaiseException(VC_SETNAME_EXC, 0, sizeof(thread_info) / sizeof(ULONG_PTR), 
(ULONG_PTR*)&thread_info);
+    RaiseException (VC_SETNAME_EXC,
+                    0,
+                    sizeof (thread_info) / sizeof(ULONG_PTR),
+                    (ULONG_PTR *) &thread_info);
   }
   __except (EXCEPTION_EXECUTE_HANDLER)
   {}
@@ -182,15 +192,21 @@
       res = pthread_attr_init (&attr);
       if (0 == res)
         {
-          res = pthread_attr_setstacksize (&attr, stack_size);
+          res = pthread_attr_setstacksize (&attr,
+                                           stack_size);
           if (0 == res)
-              res = pthread_create (thread, &attr,
-                                    start_routine, arg);
+              res = pthread_create (thread,
+                                    &attr,
+                                    start_routine,
+                                    arg);
           pthread_attr_destroy (&attr);
         }
     }
   else
-    res = pthread_create (thread, NULL, start_routine, arg);
+    res = pthread_create (thread,
+                          NULL,
+                          start_routine,
+                          arg);
 
   if (0 != res)
     errno = res;
@@ -205,8 +221,12 @@
     }
 #endif /* SIZE_MAX != UINT_MAX */
 
-  *thread = (HANDLE)_beginthreadex(NULL, (unsigned)stack_size, start_routine,
-                          arg, 0, NULL);
+  *thread = (HANDLE) _beginthreadex (NULL,
+                                     (unsigned int) stack_size,
+                                     start_routine,
+                                     arg,
+                                     0,
+                                     NULL);
   if ((MHD_thread_handle_)-1 == (*thread))
     return 0;
 
@@ -234,6 +254,7 @@
   const char *name;
 };
 
+
 static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_
 named_thread_starter (void *data)
 {
@@ -245,7 +266,7 @@
   if (NULL == data)
     return (MHD_THRD_RTRN_TYPE_)0;
 
-  MHD_set_cur_thread_name_(param->name);
+  MHD_set_cur_thread_name_ (param->name);
 
   arg = param->arg;
   thr_func = param->start_routine;
@@ -255,7 +276,6 @@
 }
 
 
-
 /**
  * Create a named thread and set the attributes according to our options.
  *
@@ -273,7 +293,7 @@
                           MHD_THREAD_START_ROUTINE_ start_routine,
                           void *arg)
 {
-  struct MHD_named_helper_param_ * param;
+  struct MHD_named_helper_param_ *param;
 
   if (NULL == thread_name)
     {
@@ -281,7 +301,7 @@
       return 0;
     }
 
-  param = malloc(sizeof(struct MHD_named_helper_param_));
+  param = malloc (sizeof (struct MHD_named_helper_param_));
   if (NULL == param)
     return 0;
 
@@ -292,9 +312,12 @@
   /* Set thread name in thread itself to avoid problems with
    * threads which terminated before name is set in other thread.
    */
-  if (!MHD_create_thread_(thread, stack_size, &named_thread_starter, 
(void*)param))
+  if (! MHD_create_thread_(thread,
+                           stack_size,
+                           &named_thread_starter,
+                           (void*)param))
     {
-      free(param);
+      free (param);
       return 0;
     }
 

Modified: libmicrohttpd/src/microhttpd/postprocessor.c
===================================================================
--- libmicrohttpd/src/microhttpd/postprocessor.c        2016-09-06 22:05:27 UTC 
(rev 37901)
+++ libmicrohttpd/src/microhttpd/postprocessor.c        2016-09-06 22:29:11 UTC 
(rev 37902)
@@ -187,7 +187,7 @@
   size_t buffer_pos;
 
   /**
-   * Current position in xbuf.
+   * Current position in @e xbuf.
    */
   size_t xbuf_pos;
 
@@ -272,7 +272,8 @@
 struct MHD_PostProcessor *
 MHD_create_post_processor (struct MHD_Connection *connection,
                            size_t buffer_size,
-                           MHD_PostDataIterator iter, void *iter_cls)
+                           MHD_PostDataIterator iter,
+                           void *iter_cls)
 {
   struct MHD_PostProcessor *ret;
   const char *encoding;
@@ -279,19 +280,26 @@
   const char *boundary;
   size_t blen;
 
-  if ((buffer_size < 256) || (connection == NULL) || (iter == NULL))
-    mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL);
+  if ( (buffer_size < 256) ||
+       (NULL == connection) ||
+       (NULL == iter))
+    mhd_panic (mhd_panic_cls,
+               __FILE__,
+               __LINE__,
+               NULL);
   encoding = MHD_lookup_connection_value (connection,
                                           MHD_HEADER_KIND,
                                           MHD_HTTP_HEADER_CONTENT_TYPE);
-  if (encoding == NULL)
+  if (NULL == encoding)
     return NULL;
   boundary = NULL;
-  if (!MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_FORM_URLENCODED, 
encoding,
-                        strlen (MHD_HTTP_POST_ENCODING_FORM_URLENCODED)))
+  if (! MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_FORM_URLENCODED,
+                                   encoding,
+                                   strlen 
(MHD_HTTP_POST_ENCODING_FORM_URLENCODED)))
     {
-      if (!MHD_str_equal_caseless_n_ 
(MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA, encoding,
-                       strlen (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA)))
+      if (! MHD_str_equal_caseless_n_ 
(MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA,
+                                       encoding,
+                                       strlen 
(MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA)))
         return NULL;
       boundary =
         &encoding[strlen (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA)];
@@ -301,9 +309,11 @@
        return NULL; /* failed to determine boundary */
       boundary += strlen ("boundary=");
       blen = strlen (boundary);
-      if ((blen == 0) || (blen * 2 + 2 > buffer_size))
+      if ( (blen == 0) ||
+           (blen * 2 + 2 > buffer_size) )
         return NULL;            /* (will be) out of memory or invalid boundary 
*/
-      if ( (boundary[0] == '"') && (boundary[blen - 1] == '"') )
+      if ( (boundary[0] == '"') &&
+           (boundary[blen - 1] == '"') )
        {
          /* remove enclosing quotes */
          ++boundary;
@@ -317,7 +327,9 @@
   /* add +1 to ensure we ALWAYS have a zero-termination at the end */
   if (NULL == (ret = malloc (sizeof (struct MHD_PostProcessor) + buffer_size + 
1)))
     return NULL;
-  memset (ret, 0, sizeof (struct MHD_PostProcessor) + buffer_size + 1);
+  memset (ret,
+          0,
+          sizeof (struct MHD_PostProcessor) + buffer_size + 1);
   ret->connection = connection;
   ret->ikvi = iter;
   ret->cls = iter_cls;
@@ -420,9 +432,11 @@
              if so, exclude those from processing (reduce delta to point at
              end of processed region) */
           delta = xoff;
-          if ((delta > 0) && (xbuf[delta - 1] == '%'))
+          if ((delta > 0) &&
+              ('%' == xbuf[delta - 1]))
             delta--;
-          else if ((delta > 1) && (xbuf[delta - 2] == '%'))
+          else if ((delta > 1) &&
+                   ('%' == xbuf[delta - 2]))
             delta -= 2;
 
           /* if we have an incomplete escape sequence, save it to
@@ -429,7 +443,9 @@
              pp->xbuf for later */
           if (delta < xoff)
             {
-              memcpy (pp->xbuf, &xbuf[delta], xoff - delta);
+              memcpy (pp->xbuf,
+                      &xbuf[delta],
+                      xoff - delta);
               pp->xbuf_pos = xoff - delta;
               xoff = delta;
             }
@@ -437,7 +453,8 @@
           /* If we have nothing to do (delta == 0) and
              not just because the value is empty (are
              waiting for more data), go for next iteration */
-          if ((xoff == 0) && (poff == post_data_len))
+          if ( (0 == xoff) &&
+               (poff == post_data_len))
             continue;
 
           /* unescape */
@@ -446,8 +463,14 @@
           xoff = MHD_http_unescape (xbuf);
           /* finally: call application! */
          pp->must_ikvi = MHD_NO;
-          if (MHD_NO == pp->ikvi (pp->cls, MHD_POSTDATA_KIND, (const char *) 
&pp[1],    /* key */
-                                  NULL, NULL, NULL, xbuf, pp->value_offset,
+          if (MHD_NO == pp->ikvi (pp->cls,
+                                  MHD_POSTDATA_KIND,
+                                  (const char *) &pp[1],    /* key */
+                                  NULL,
+                                  NULL,
+                                  NULL,
+                                  xbuf,
+                                  pp->value_offset,
                                   xoff))
             {
               pp->state = PP_Error;
@@ -459,11 +482,12 @@
           if (end_of_value_found)
             {
               /* we found the end of the value! */
-              if ((post_data[poff] == '\n') || (post_data[poff] == '\r'))
+              if ( ('\n' == post_data[poff]) ||
+                   ('\r' == post_data[poff]) )
                 {
                   pp->state = PP_ExpectNewLine;
                 }
-              else if (post_data[poff] == '&')
+              else if ('&' == post_data[poff])
                 {
                   poff++;       /* skip '&' */
                   pp->state = PP_Init;
@@ -471,7 +495,8 @@
             }
           break;
         case PP_ExpectNewLine:
-          if ((post_data[poff] == '\n') || (post_data[poff] == '\r'))
+          if ( ('\n' == post_data[poff]) ||
+               ('\r' == post_data[poff]) )
             {
               poff++;
               /* we are done, report error if we receive any more... */
@@ -480,7 +505,10 @@
             }
           return MHD_NO;
         default:
-          mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL);          /* 
should never happen! */
+          mhd_panic (mhd_panic_cls,
+                     __FILE__,
+                     __LINE__,
+                     NULL);          /* should never happen! */
         }
     }
   return MHD_YES;
@@ -497,13 +525,17 @@
  * @return #MHD_YES if there was a match, #MHD_NO if not
  */
 static int
-try_match_header (const char *prefix, char *line, char **suffix)
+try_match_header (const char *prefix,
+                  char *line,
+                  char **suffix)
 {
   if (NULL != *suffix)
     return MHD_NO;
-  while (*line != 0)
+  while (0 != *line)
     {
-      if (MHD_str_equal_caseless_n_ (prefix, line, strlen (prefix)))
+      if (MHD_str_equal_caseless_n_ (prefix,
+                                     line,
+                                     strlen (prefix)))
         {
           *suffix = strdup (&line[strlen (prefix)]);
           return MHD_YES;
@@ -532,7 +564,8 @@
                const char *boundary,
                size_t blen,
                size_t *ioffptr,
-               enum PP_State next_state, enum PP_State next_dash_state)
+               enum PP_State next_state,
+               enum PP_State next_dash_state)
 {
   char *buf = (char *) &pp[1];
   const char *dash;
@@ -544,7 +577,12 @@
       /* ++(*ioffptr); */
       return MHD_NO;            /* not enough data */
     }
-  if ((0 != memcmp ("--", buf, 2)) || (0 != memcmp (&buf[2], boundary, blen)))
+  if ( (0 != memcmp ("--",
+                     buf,
+                     2)) ||
+       (0 != memcmp (&buf[2],
+                     boundary,
+                     blen)))
     {
       if (pp->state != PP_Init)
         {
@@ -554,7 +592,9 @@
       else
         {
           /* skip over garbage (RFC 2046, 5.1.1) */
-          dash = memchr (buf, '-', pp->buffer_pos);
+          dash = memchr (buf,
+                         '-',
+                         pp->buffer_pos);
           if (NULL == dash)
             (*ioffptr) += pp->buffer_pos; /* skip entire buffer */
           else
@@ -598,7 +638,9 @@
   klen = strlen (key);
   while (NULL != (spos = strstr (bpos, key)))
     {
-      if ((spos[klen] != '=') || ((spos != buf) && (spos[-1] != ' ')))
+      if ( (spos[klen] != '=') ||
+           ( (spos != buf) &&
+             (spos[-1] != ' ') ) )
         {
           /* no match */
           bpos = spos + 1;
@@ -606,7 +648,8 @@
         }
       if (spos[klen + 1] != '"')
         return;                 /* not quoted */
-      if (NULL == (endv = strchr (&spos[klen + 2], '\"')))
+      if (NULL == (endv = strchr (&spos[klen + 2],
+                                  '\"')))
         return;                 /* no end-quote */
       vlen = endv - spos - klen - 1;
       *destination = malloc (vlen);
@@ -613,7 +656,9 @@
       if (NULL == *destination)
         return;                 /* out of memory */
       (*destination)[vlen - 1] = '\0';
-      memcpy (*destination, &spos[klen + 2], vlen - 1);
+      memcpy (*destination,
+              &spos[klen + 2],
+              vlen - 1);
       return;                   /* success */
     }
 }
@@ -636,14 +681,16 @@
  */
 static int
 process_multipart_headers (struct MHD_PostProcessor *pp,
-                           size_t *ioffptr, enum PP_State next_state)
+                           size_t *ioffptr,
+                           enum PP_State next_state)
 {
   char *buf = (char *) &pp[1];
   size_t newline;
 
   newline = 0;
-  while ((newline < pp->buffer_pos) &&
-         (buf[newline] != '\r') && (buf[newline] != '\n'))
+  while ( (newline < pp->buffer_pos) &&
+          (buf[newline] != '\r') &&
+          (buf[newline] != '\n') )
     newline++;
   if (newline == pp->buffer_size)
     {
@@ -664,18 +711,24 @@
     pp->skip_rn = RN_OptN;
   buf[newline] = '\0';
   if (MHD_str_equal_caseless_n_ ("Content-disposition: ",
-                        buf, strlen ("Content-disposition: ")))
+                                 buf,
+                                 strlen ("Content-disposition: ")))
     {
       try_get_value (&buf[strlen ("Content-disposition: ")],
-                     "name", &pp->content_name);
+                     "name",
+                     &pp->content_name);
       try_get_value (&buf[strlen ("Content-disposition: ")],
-                     "filename", &pp->content_filename);
+                     "filename",
+                     &pp->content_filename);
     }
   else
     {
-      try_match_header ("Content-type: ", buf, &pp->content_type);
+      try_match_header ("Content-type: ",
+                        buf,
+                        &pp->content_type);
       try_match_header ("Content-Transfer-Encoding: ",
-                        buf, &pp->content_transfer_encoding);
+                        buf,
+                        &pp->content_transfer_encoding);
     }
   (*ioffptr) += newline + 1;
   return MHD_YES;
@@ -717,7 +770,9 @@
     {
       while (newline + 4 < pp->buffer_pos)
         {
-          r = memchr (&buf[newline], '\r', pp->buffer_pos - newline - 4);
+          r = memchr (&buf[newline],
+                      '\r',
+                      pp->buffer_pos - newline - 4);
           if (NULL == r)
           {
             newline = pp->buffer_pos - 4;
@@ -724,7 +779,9 @@
             break;
           }
           newline = r - buf;
-          if (0 == memcmp ("\r\n--", &buf[newline], 4))
+          if (0 == memcmp ("\r\n--",
+                           &buf[newline],
+                           4))
             break;
           newline++;
         }
@@ -731,7 +788,9 @@
       if (newline + pp->blen + 4 <= pp->buffer_pos)
         {
           /* can check boundary */
-          if (0 != memcmp (&buf[newline + 4], boundary, pp->blen))
+          if (0 != memcmp (&buf[newline + 4],
+                           boundary,
+                           pp->blen))
             {
               /* no boundary, "\r\n--" is part of content, skip */
               newline += 4;
@@ -754,7 +813,8 @@
           /* cannot check for boundary, process content that
              we have and check again later; except, if we have
              no content, abort (out of memory) */
-          if ((0 == newline) && (pp->buffer_pos == pp->buffer_size))
+          if ( (0 == newline) &&
+               (pp->buffer_pos == pp->buffer_size) )
             {
               pp->state = PP_Error;
               return MHD_NO;
@@ -773,7 +833,9 @@
                            pp->content_filename,
                            pp->content_type,
                            pp->content_transfer_encoding,
-                           buf, pp->value_offset, newline)) )
+                           buf,
+                            pp->value_offset,
+                            newline)) )
     {
       pp->state = PP_Error;
       return MHD_NO;
@@ -792,24 +854,26 @@
 static void
 free_unmarked (struct MHD_PostProcessor *pp)
 {
-  if ((NULL != pp->content_name) && (0 == (pp->have & NE_content_name)))
+  if ( (NULL != pp->content_name) &&
+       (0 == (pp->have & NE_content_name)) )
     {
       free (pp->content_name);
       pp->content_name = NULL;
     }
-  if ((NULL != pp->content_type) && (0 == (pp->have & NE_content_type)))
+  if ( (NULL != pp->content_type) &&
+       (0 == (pp->have & NE_content_type)) )
     {
       free (pp->content_type);
       pp->content_type = NULL;
     }
-  if ((NULL != pp->content_filename) &&
-      (0 == (pp->have & NE_content_filename)))
+  if ( (NULL != pp->content_filename) &&
+       (0 == (pp->have & NE_content_filename)) )
     {
       free (pp->content_filename);
       pp->content_filename = NULL;
     }
-  if ((NULL != pp->content_transfer_encoding) &&
-      (0 == (pp->have & NE_content_transfer_encoding)))
+  if ( (NULL != pp->content_transfer_encoding) &&
+       (0 == (pp->have & NE_content_transfer_encoding)) )
     {
       free (pp->content_transfer_encoding);
       pp->content_transfer_encoding = NULL;
@@ -840,8 +904,9 @@
   ioff = 0;
   poff = 0;
   state_changed = 1;
-  while ((poff < post_data_len) ||
-         ((pp->buffer_pos > 0) && (state_changed != 0)))
+  while ( (poff < post_data_len) ||
+          ( (pp->buffer_pos > 0) &&
+            (0 != state_changed) ) )
     {
       /* first, move as much input data
          as possible to our internal buffer */
@@ -848,10 +913,14 @@
       max = pp->buffer_size - pp->buffer_pos;
       if (max > post_data_len - poff)
         max = post_data_len - poff;
-      memcpy (&buf[pp->buffer_pos], &post_data[poff], max);
+      memcpy (&buf[pp->buffer_pos],
+              &post_data[poff],
+              max);
       poff += max;
       pp->buffer_pos += max;
-      if ((max == 0) && (state_changed == 0) && (poff < post_data_len))
+      if ( (0 == max) &&
+           (0 == state_changed) &&
+           (poff < post_data_len) )
         {
           pp->state = PP_Error;
           return MHD_NO;        /* out of memory */
@@ -883,7 +952,8 @@
         case RN_Full:
           if (buf[0] == '\r')
             {
-              if ((pp->buffer_pos > 1) && (buf[1] == '\n'))
+              if ( (pp->buffer_pos > 1) &&
+                   ('\n' == buf[1]) )
                 {
                   pp->skip_rn = RN_Inactive;
                   ioff += 2;
@@ -941,7 +1011,8 @@
                                pp->boundary,
                                pp->blen,
                                &ioff,
-                               PP_ProcessEntryHeaders, PP_Done);
+                               PP_ProcessEntryHeaders,
+                                PP_Done);
           break;
         case PP_NextBoundary:
           if (MHD_NO == find_boundary (pp,
@@ -948,7 +1019,8 @@
                                        pp->boundary,
                                        pp->blen,
                                        &ioff,
-                                       PP_ProcessEntryHeaders, PP_Done))
+                                       PP_ProcessEntryHeaders,
+                                       PP_Done))
             {
               if (pp->state == PP_Error)
                 return MHD_NO;
@@ -958,7 +1030,9 @@
         case PP_ProcessEntryHeaders:
          pp->must_ikvi = MHD_YES;
           if (MHD_NO ==
-              process_multipart_headers (pp, &ioff, PP_PerformCheckMultipart))
+              process_multipart_headers (pp,
+                                         &ioff,
+                                         PP_PerformCheckMultipart))
             {
               if (pp->state == PP_Error)
                 return MHD_NO;
@@ -968,13 +1042,14 @@
           state_changed = 1;
           break;
         case PP_PerformCheckMultipart:
-          if ((pp->content_type != NULL) &&
-              (MHD_str_equal_caseless_n_ (pp->content_type,
-                                 "multipart/mixed",
-                                 strlen ("multipart/mixed"))))
+          if ( (NULL != pp->content_type) &&
+               (MHD_str_equal_caseless_n_ (pp->content_type,
+                                           "multipart/mixed",
+                                           strlen ("multipart/mixed"))))
             {
-              pp->nested_boundary = strstr (pp->content_type, "boundary=");
-              if (pp->nested_boundary == NULL)
+              pp->nested_boundary = strstr (pp->content_type,
+                                            "boundary=");
+              if (NULL == pp->nested_boundary)
                 {
                   pp->state = PP_Error;
                   return MHD_NO;
@@ -981,7 +1056,7 @@
                 }
               pp->nested_boundary =
                 strdup (&pp->nested_boundary[strlen ("boundary=")]);
-              if (pp->nested_boundary == NULL)
+              if (NULL == pp->nested_boundary)
                 {
                   /* out of memory */
                   pp->state = PP_Error;
@@ -1017,7 +1092,7 @@
           /* clean up state of one multipart form-data element! */
           pp->have = NE_none;
           free_unmarked (pp);
-          if (pp->nested_boundary != NULL)
+          if (NULL != pp->nested_boundary)
             {
               free (pp->nested_boundary);
               pp->nested_boundary = NULL;
@@ -1026,7 +1101,7 @@
           state_changed = 1;
           break;
         case PP_Nested_Init:
-          if (pp->nested_boundary == NULL)
+          if (NULL == pp->nested_boundary)
             {
               pp->state = PP_Error;
               return MHD_NO;
@@ -1047,13 +1122,13 @@
           /* remember what headers were given
              globally */
           pp->have = NE_none;
-          if (pp->content_name != NULL)
+          if (NULL != pp->content_name)
             pp->have |= NE_content_name;
-          if (pp->content_type != NULL)
+          if (NULL != pp->content_type)
             pp->have |= NE_content_type;
-          if (pp->content_filename != NULL)
+          if (NULL != pp->content_filename)
             pp->have |= NE_content_filename;
-          if (pp->content_transfer_encoding != NULL)
+          if (NULL != pp->content_transfer_encoding)
             pp->have |= NE_content_transfer_encoding;
           pp->state = PP_Nested_ProcessEntryHeaders;
           state_changed = 1;
@@ -1061,7 +1136,8 @@
         case PP_Nested_ProcessEntryHeaders:
           pp->value_offset = 0;
           if (MHD_NO ==
-              process_multipart_headers (pp, &ioff,
+              process_multipart_headers (pp,
+                                         &ioff,
                                          PP_Nested_ProcessValueToBoundary))
             {
               if (pp->state == PP_Error)
@@ -1090,12 +1166,17 @@
           state_changed = 1;
           break;
         default:
-          mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL);          /* 
should never happen! */
+          mhd_panic (mhd_panic_cls,
+                     __FILE__,
+                     __LINE__,
+                     NULL);          /* should never happen! */
         }
     AGAIN:
       if (ioff > 0)
         {
-          memmove (buf, &buf[ioff], pp->buffer_pos - ioff);
+          memmove (buf,
+                   &buf[ioff],
+                   pp->buffer_pos - ioff);
           pp->buffer_pos -= ioff;
           ioff = 0;
           state_changed = 1;
@@ -1102,9 +1183,11 @@
         }
     }
 END:
-  if (ioff != 0)
+  if (0 != ioff)
     {
-      memmove (buf, &buf[ioff], pp->buffer_pos - ioff);
+      memmove (buf,
+               &buf[ioff],
+               pp->buffer_pos - ioff);
       pp->buffer_pos -= ioff;
     }
   if (poff < post_data_len)
@@ -1131,18 +1214,25 @@
  */
 int
 MHD_post_process (struct MHD_PostProcessor *pp,
-                  const char *post_data, size_t post_data_len)
+                  const char *post_data,
+                  size_t post_data_len)
 {
   if (0 == post_data_len)
     return MHD_YES;
   if (NULL == pp)
     return MHD_NO;
-  if (MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_FORM_URLENCODED, 
pp->encoding,
-                         strlen(MHD_HTTP_POST_ENCODING_FORM_URLENCODED)))
-    return post_process_urlencoded (pp, post_data, post_data_len);
-  if (MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA, 
pp->encoding,
-                   strlen (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA)))
-    return post_process_multipart (pp, post_data, post_data_len);
+  if (MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_FORM_URLENCODED,
+                                 pp->encoding,
+                                 
strlen(MHD_HTTP_POST_ENCODING_FORM_URLENCODED)))
+    return post_process_urlencoded (pp,
+                                    post_data,
+                                    post_data_len);
+  if (MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA,
+                                 pp->encoding,
+                                 strlen 
(MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA)))
+    return post_process_multipart (pp,
+                                   post_data,
+                                   post_data_len);
   /* this should never be reached */
   return MHD_NO;
 }
@@ -1170,20 +1260,22 @@
     /* key without terminated value left at the end of the
        buffer; fake receiving a termination character to
        ensure it is also processed */
-    post_process_urlencoded (pp, "\n", 1);
+    post_process_urlencoded (pp,
+                             "\n",
+                             1);
   }
   /* These internal strings need cleaning up since
      the post-processing may have been interrupted
      at any stage */
-  if ((pp->xbuf_pos > 0) ||
-      ( (pp->state != PP_Done) &&
-       (pp->state != PP_ExpectNewLine)))
+  if ( (pp->xbuf_pos > 0) ||
+       ( (pp->state != PP_Done) &&
+         (pp->state != PP_ExpectNewLine) ) )
     ret = MHD_NO;
   else
     ret = MHD_YES;
   pp->have = NE_none;
   free_unmarked (pp);
-  if (pp->nested_boundary != NULL)
+  if (NULL != pp->nested_boundary)
     free (pp->nested_boundary);
   free (pp);
   return ret;

Modified: libmicrohttpd/src/microhttpd/reason_phrase.c
===================================================================
--- libmicrohttpd/src/microhttpd/reason_phrase.c        2016-09-06 22:05:27 UTC 
(rev 37901)
+++ libmicrohttpd/src/microhttpd/reason_phrase.c        2016-09-06 22:29:11 UTC 
(rev 37902)
@@ -30,7 +30,9 @@
 #define NULL (void*)0
 #endif
 
-static const char *invalid_hundred[] = { NULL };
+static const char *invalid_hundred[] = {
+  NULL
+};
 
 static const char *const one_hundred[] = {
   "Continue",

Modified: libmicrohttpd/src/microhttpd/response.c
===================================================================
--- libmicrohttpd/src/microhttpd/response.c     2016-09-06 22:05:27 UTC (rev 
37901)
+++ libmicrohttpd/src/microhttpd/response.c     2016-09-06 22:29:11 UTC (rev 
37902)
@@ -154,14 +154,17 @@
   struct MHD_HTTP_Header *pos;
   struct MHD_HTTP_Header *prev;
 
-  if ( (NULL == header) || (NULL == content) )
+  if ( (NULL == header) ||
+  (NULL == content) )
     return MHD_NO;
   prev = NULL;
   pos = response->first_header;
   while (pos != NULL)
     {
-      if ((0 == strcmp (header, pos->header)) &&
-          (0 == strcmp (content, pos->value)))
+      if ((0 == strcmp (header,
+                        pos->header)) &&
+          (0 == strcmp (content,
+                        pos->value)))
         {
           free (pos->header);
           free (pos->value);
@@ -228,7 +231,8 @@
   if (NULL == key)
     return NULL;
   for (pos = response->first_header; NULL != pos; pos = pos->next)
-    if (0 == strcmp (key, pos->header))
+    if (0 == strcmp (key,
+                     pos->header))
       return pos->value;
   return NULL;
 }
@@ -263,11 +267,13 @@
     return NULL;
   if (NULL == (response = malloc (sizeof (struct MHD_Response) + block_size)))
     return NULL;
-  memset (response, 0, sizeof (struct MHD_Response));
+  memset (response,
+          0,
+          sizeof (struct MHD_Response));
   response->fd = -1;
   response->data = (void *) &response[1];
   response->data_buffer_size = block_size;
-  if (!MHD_mutex_init_ (&response->mutex))
+  if (! MHD_mutex_init_ (&response->mutex))
     {
       free (response);
       return NULL;
@@ -372,7 +378,7 @@
 
   n = read (response->fd,
             buf,
-            (unsigned int)max);
+            (unsigned int) max);
 #endif /* _WIN32 */
 
   if (0 == n)
@@ -646,7 +652,7 @@
         if (MHD_INVALID_SOCKET != urh->app.socket)
           {
             if (0 != MHD_socket_close_ (urh->app.socket))
-              MHD_PANIC ("close failed\n");
+              MHD_PANIC (_("close failed\n"));
             urh->app.socket = MHD_INVALID_SOCKET;
           }
         return MHD_YES;
@@ -688,7 +694,7 @@
     {
 #ifdef HAVE_MESSAGES
       MHD_DLOG (daemon,
-                "Invalid response for upgrade: application failed to set the 
'Upgrade' header!\n");
+                _("Invalid response for upgrade: application failed to set the 
'Upgrade' header!\n"));
 #endif
       return MHD_NO;
     }
@@ -720,7 +726,7 @@
       {
 #ifdef HAVE_MESSAGES
         MHD_DLOG (daemon,
-                 "Failed to make read side of inter-thread control channel 
non-blocking: %s\n",
+                 _("Failed to make read side of inter-thread control channel 
non-blocking: %s\n"),
                  MHD_pipe_last_strerror_ ());
 #endif
       }
@@ -729,14 +735,14 @@
       {
 #ifdef HAVE_MESSAGES
         MHD_DLOG (daemon,
-                  "Socketpair descriptor larger than FD_SETSIZE: %d > %d\n",
+                  _("Socketpair descriptor larger than FD_SETSIZE: %d > %d\n"),
                   (int) sv[1],
                   (int) FD_SETSIZE);
 #endif
         if (0 != MHD_socket_close_ (sv[0]))
-          MHD_PANIC ("close failed\n");
+          MHD_PANIC (_("close failed\n"));
         if (0 != MHD_socket_close_ (sv[1]))
-          MHD_PANIC ("close failed\n");
+          MHD_PANIC (_("close failed\n"));
         free (urh);
         return MHD_NO;
       }
@@ -803,13 +809,13 @@
        {
 #ifdef HAVE_MESSAGES
           MHD_DLOG (daemon,
-                    "Call to epoll_ctl failed: %s\n",
+                    _("Call to epoll_ctl failed: %s\n"),
                     MHD_socket_last_strerr_ ());
 #endif
           if (0 != MHD_socket_close_ (sv[0]))
-            MHD_PANIC ("close failed\n");
+            MHD_PANIC (_("close failed\n"));
           if (0 != MHD_socket_close_ (sv[1]))
-            MHD_PANIC ("close failed\n");
+            MHD_PANIC (_("close failed\n"));
           free (urh);
           return MHD_NO;
        }
@@ -828,16 +834,16 @@
                               EPOLL_CTL_DEL,
                               connection->socket_fd,
                               &event))
-            MHD_PANIC ("Error cleaning up while handling epoll error");
+            MHD_PANIC (_("Error cleaning up while handling epoll error"));
 #ifdef HAVE_MESSAGES
           MHD_DLOG (daemon,
-                    "Call to epoll_ctl failed: %s\n",
+                    _("Call to epoll_ctl failed: %s\n"),
                     MHD_socket_last_strerr_ ());
 #endif
           if (0 != MHD_socket_close_ (sv[0]))
-            MHD_PANIC ("close failed\n");
+            MHD_PANIC (_("close failed\n"));
           if (0 != MHD_socket_close_ (sv[1]))
-            MHD_PANIC ("close failed\n");
+            MHD_PANIC (_("close failed\n"));
           free (urh);
           return MHD_NO;
        }
@@ -875,7 +881,7 @@
         {
 #ifdef HAVE_MESSAGES
           MHD_DLOG (daemon,
-                    "Failed to create semaphore for upgrade handling\n");
+                    _("Failed to create semaphore for upgrade handling\n"));
 #endif
           MHD_connection_close_ (connection,
                                  MHD_REQUEST_TERMINATED_WITH_ERROR);
@@ -989,7 +995,7 @@
     }
   (void) MHD_mutex_unlock_ (&response->mutex);
   (void) MHD_mutex_destroy_ (&response->mutex);
-  if (response->crfc != NULL)
+  if (NULL != response->crfc)
     response->crfc (response->crc_cls);
   while (NULL != response->first_header)
     {

Modified: libmicrohttpd/src/microhttpd/tsearch.c
===================================================================
--- libmicrohttpd/src/microhttpd/tsearch.c      2016-09-06 22:05:27 UTC (rev 
37901)
+++ libmicrohttpd/src/microhttpd/tsearch.c      2016-09-06 22:29:11 UTC (rev 
37902)
@@ -12,68 +12,77 @@
 #include "tsearch.h"
 #include <stdlib.h>
 
-typedef        struct node {
+
+typedef        struct node
+{
   const void   *key;
-  struct node  *llink, *rlink;
+  struct node  *llink;
+  struct node  *rlink;
 } node_t;
 
+
 /*     $NetBSD: tsearch.c,v 1.5 2005/11/29 03:12:00 christos Exp $     */
 /* find or insert datum into search tree */
 void *
-tsearch(const void *vkey,              /* key to be located */
-       void **vrootp,                  /* address of tree root */
-       int (*compar)(const void *, const void *))
+tsearch (const void *vkey,             /* key to be located */
+         void **vrootp,                        /* address of tree root */
+         int (*compar)(const void *, const void *))
 {
-       node_t *q;
-       node_t **rootp = (node_t **)vrootp;
+  node_t *q;
+  node_t **rootp = (node_t **)vrootp;
 
-       if (rootp == NULL)
-               return NULL;
+  if (NULL == rootp)
+    return NULL;
 
-       while (*rootp != NULL) {        /* Knuth's T1: */
-               int r;
+  while (*rootp != NULL)
+    {  /* Knuth's T1: */
+      int r;
 
-               if ((r = (*compar)(vkey, (*rootp)->key)) == 0)  /* T2: */
-                       return *rootp;          /* we found it! */
+      if ((r = (*compar)(vkey, (*rootp)->key)) == 0)   /* T2: */
+        return *rootp;         /* we found it! */
 
-               rootp = (r < 0) ?
-                   &(*rootp)->llink :          /* T3: follow left branch */
-                   &(*rootp)->rlink;           /* T4: follow right branch */
-       }
+      rootp = (r < 0) ?
+        &(*rootp)->llink :             /* T3: follow left branch */
+        &(*rootp)->rlink;              /* T4: follow right branch */
+    }
 
-       q = malloc(sizeof(node_t));             /* T5: key not found */
-       if (q) {                                /* make new node */
-               *rootp = q;                     /* link new node to old */
-               q->key = vkey;          /* initialize new node */
-               q->llink = q->rlink = NULL;
-       }
-       return q;
+  q = malloc (sizeof(node_t));         /* T5: key not found */
+  if (q)
+    {                          /* make new node */
+      *rootp = q;                      /* link new node to old */
+      q->key = vkey;           /* initialize new node */
+      q->llink = q->rlink = NULL;
+    }
+  return q;
 }
 
+
 /*     $NetBSD: tfind.c,v 1.5 2005/03/23 08:16:53 kleink Exp $ */
 /* find a node, or return NULL */
 void *
-tfind(const void *vkey,         /* key to be found */
-      void * const *vrootp,     /* address of the tree root */
-      int (*compar)(const void *, const void *))
+tfind (const void *vkey,         /* key to be found */
+       void * const *vrootp,     /* address of the tree root */
+       int (*compar)(const void *, const void *))
 {
-       node_t * const *rootp = (node_t * const*)vrootp;
+  node_t * const *rootp = (node_t * const*)vrootp;
 
-       if (rootp == NULL)
-               return NULL;
+  if (NULL == rootp)
+    return NULL;
 
-       while (*rootp != NULL) {                /* T1: */
-               int r;
+  while (*rootp != NULL)
+    {          /* T1: */
+      int r;
 
-               if ((r = (*compar)(vkey, (*rootp)->key)) == 0)  /* T2: */
-                       return *rootp;          /* key found */
-               rootp = (r < 0) ?
-                   &(*rootp)->llink :          /* T3: follow left branch */
-                   &(*rootp)->rlink;           /* T4: follow right branch */
-       }
-       return NULL;
+      if ((r = (*compar)(vkey, (*rootp)->key)) == 0)   /* T2: */
+        return *rootp;         /* key found */
+      rootp = (r < 0) ?
+        &(*rootp)->llink :             /* T3: follow left branch */
+        &(*rootp)->rlink;              /* T4: follow right branch */
+    }
+  return NULL;
 }
 
+
 /*     $NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $        */
 /*
  * delete node with given key
@@ -83,42 +92,52 @@
  * compar: function to carry out node comparisons
  */
 void *
-tdelete(const void * __restrict vkey, void ** __restrict vrootp,
-    int (*compar)(const void *, const void *))
+tdelete (const void * __restrict vkey,
+         void ** __restrict vrootp,
+         int (*compar)(const void *, const void *))
 {
-       node_t **rootp = (node_t **)vrootp;
-       node_t *p, *q, *r;
-       int cmp;
+  node_t **rootp = (node_t **)vrootp;
+  node_t *p;
+  node_t *q;
+  node_t *r;
+  int cmp;
 
-       if (rootp == NULL || (p = *rootp) == NULL)
-               return NULL;
+  if (rootp == NULL || (p = *rootp) == NULL)
+    return NULL;
 
-       while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0) {
-               p = *rootp;
-               rootp = (cmp < 0) ?
-                   &(*rootp)->llink :          /* follow llink branch */
-                   &(*rootp)->rlink;           /* follow rlink branch */
-               if (*rootp == NULL)
-                       return NULL;            /* key not found */
-       }
-       r = (*rootp)->rlink;                    /* D1: */
-       if ((q = (*rootp)->llink) == NULL)      /* Left NULL? */
-               q = r;
-       else if (r != NULL) {                   /* Right link is NULL? */
-               if (r->llink == NULL) {         /* D2: Find successor */
-                       r->llink = q;
-                       q = r;
-               } else {                        /* D3: Find NULL link */
-                       for (q = r->llink; q->llink != NULL; q = r->llink)
-                               r = q;
-                       r->llink = q->rlink;
-                       q->llink = (*rootp)->llink;
-                       q->rlink = (*rootp)->rlink;
-               }
-       }
-       free(*rootp);                           /* D4: Free node */
-       *rootp = q;                             /* link parent to new node */
-       return p;
+  while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0)
+    {
+      p = *rootp;
+      rootp = (cmp < 0) ?
+        &(*rootp)->llink :             /* follow llink branch */
+        &(*rootp)->rlink;              /* follow rlink branch */
+      if (*rootp == NULL)
+        return NULL;           /* key not found */
+    }
+  r = (*rootp)->rlink;                 /* D1: */
+  if ((q = (*rootp)->llink) == NULL)   /* Left NULL? */
+    {
+      q = r;
+    }
+  else if (r != NULL)
+    {                  /* Right link is NULL? */
+      if (r->llink == NULL)
+        {              /* D2: Find successor */
+          r->llink = q;
+          q = r;
+        }
+      else
+        {                      /* D3: Find NULL link */
+          for (q = r->llink; q->llink != NULL; q = r->llink)
+            r = q;
+          r->llink = q->rlink;
+          q->llink = (*rootp)->llink;
+          q->rlink = (*rootp)->rlink;
+        }
+    }
+  free(*rootp);                                /* D4: Free node */
+  *rootp = q;                          /* link parent to new node */
+  return p;
 }
 
 /* end of tsearch.c */

Modified: libmicrohttpd/src/microhttpd/tsearch.h
===================================================================
--- libmicrohttpd/src/microhttpd/tsearch.h      2016-09-06 22:05:27 UTC (rev 
37901)
+++ libmicrohttpd/src/microhttpd/tsearch.h      2016-09-06 22:29:11 UTC (rev 
37902)
@@ -12,11 +12,25 @@
 #if defined(__cplusplus)
 extern "C" {
 #endif /* __cplusplus */
-void   *tdelete(const void * __restrict, void ** __restrict,
-           int (*)(const void *, const void *));
-void   *tfind(const void *, void * const *,
-           int (*)(const void *, const void *));
-void   *tsearch(const void *, void **, int (*)(const void *, const void *));
+
+
+void   *
+tdelete (const void * __restrict,
+         void ** __restrict,
+         int (*)(const void *, const void *));
+
+
+void   *
+tfind (const void *,
+       void * const *,
+       int (*)(const void *, const void *));
+
+
+void   *
+tsearch (const void *,
+         void **,
+         int (*)(const void *, const void *));
+
 #if defined(__cplusplus)
 };
 #endif /* __cplusplus */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]