diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-31 13:06:08 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-31 13:06:08 +0100 |
commit | 7389c3452884ad29faf5a2d6856aebd364ffae6b (patch) | |
tree | 71246e22c8513c0dcbf79b837cb9c084c29e434c /src/microhttpd | |
parent | e0a076284525eaf2ec4cb356a40cccc25e24f2b1 (diff) | |
download | libmicrohttpd-7389c3452884ad29faf5a2d6856aebd364ffae6b.tar.gz libmicrohttpd-7389c3452884ad29faf5a2d6856aebd364ffae6b.zip |
tighten formatting rules
Diffstat (limited to 'src/microhttpd')
41 files changed, 375 insertions, 202 deletions
diff --git a/src/microhttpd/basicauth.c b/src/microhttpd/basicauth.c index f1e38af4..4fba487b 100644 --- a/src/microhttpd/basicauth.c +++ b/src/microhttpd/basicauth.c | |||
@@ -143,7 +143,7 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, | |||
143 | hlen, | 143 | hlen, |
144 | "Basic realm=\"%s\"", | 144 | "Basic realm=\"%s\"", |
145 | realm); | 145 | realm); |
146 | if ((res > 0)&&((size_t) res < hlen)) | 146 | if ((res > 0) && ((size_t) res < hlen)) |
147 | ret = MHD_add_response_header (response, | 147 | ret = MHD_add_response_header (response, |
148 | MHD_HTTP_HEADER_WWW_AUTHENTICATE, | 148 | MHD_HTTP_HEADER_WWW_AUTHENTICATE, |
149 | header); | 149 | header); |
@@ -167,4 +167,5 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, | |||
167 | return ret; | 167 | return ret; |
168 | } | 168 | } |
169 | 169 | ||
170 | |||
170 | /* end of basicauth.c */ | 171 | /* end of basicauth.c */ |
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index c63b8d24..fe5efff4 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -175,6 +175,8 @@ MHD_conn_init_static_ (void) | |||
175 | } | 175 | } |
176 | #endif /* SF_FLAGS */ | 176 | #endif /* SF_FLAGS */ |
177 | } | 177 | } |
178 | |||
179 | |||
178 | #endif /* HAVE_FREEBSD_SENDFILE */ | 180 | #endif /* HAVE_FREEBSD_SENDFILE */ |
179 | /** | 181 | /** |
180 | * Callback for receiving data from the socket. | 182 | * Callback for receiving data from the socket. |
@@ -634,10 +636,12 @@ MHD_lookup_header_token_ci (const struct MHD_Connection *connection, | |||
634 | { | 636 | { |
635 | struct MHD_HTTP_Header *pos; | 637 | struct MHD_HTTP_Header *pos; |
636 | 638 | ||
637 | if ((NULL == connection)||(NULL == header)||(0 == header[0])||(NULL == | 639 | if ((NULL == connection) || (NULL == header) || (0 == header[0]) || (NULL == |
638 | token) ||(0 == | 640 | token) || |
639 | token | 641 | (0 == |
640 | [0]) ) | 642 | token |
643 | [ | ||
644 | 0]) ) | ||
641 | return false; | 645 | return false; |
642 | 646 | ||
643 | for (pos = connection->headers_received; NULL != pos; pos = pos->next) | 647 | for (pos = connection->headers_received; NULL != pos; pos = pos->next) |
@@ -721,8 +725,7 @@ MHD_connection_mark_closed_ (struct MHD_Connection *connection) | |||
721 | * and do not shutdown TCP socket. This give more | 725 | * and do not shutdown TCP socket. This give more |
722 | * chances to send TLS closure data to remote side. | 726 | * chances to send TLS closure data to remote side. |
723 | * Closure of TLS layer will be interpreted by | 727 | * Closure of TLS layer will be interpreted by |
724 | * remote side as end of transmission. */ | 728 | * remote side as end of transmission. */if (0 != (daemon->options & MHD_USE_TLS)) |
725 | if (0 != (daemon->options & MHD_USE_TLS)) | ||
726 | { | 729 | { |
727 | if (! MHD_tls_connection_shutdown (connection)) | 730 | if (! MHD_tls_connection_shutdown (connection)) |
728 | shutdown (connection->socket_fd, | 731 | shutdown (connection->socket_fd, |
@@ -829,8 +832,9 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection) | |||
829 | * used with MHD_UPGRADE_ACTION_CLOSE. They will be | 832 | * used with MHD_UPGRADE_ACTION_CLOSE. They will be |
830 | * closed by MHD_cleanup_upgraded_connection_() during | 833 | * closed by MHD_cleanup_upgraded_connection_() during |
831 | * connection's final cleanup. | 834 | * connection's final cleanup. |
832 | */ | 835 | */} |
833 | } | 836 | |
837 | |||
834 | #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT*/ | 838 | #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT*/ |
835 | 839 | ||
836 | 840 | ||
@@ -999,7 +1003,7 @@ try_ready_chunked_body (struct MHD_Connection *connection) | |||
999 | = (size_t) (connection->response_write_position - response->data_start); | 1003 | = (size_t) (connection->response_write_position - response->data_start); |
1000 | /* buffer already ready, use what is there for the chunk */ | 1004 | /* buffer already ready, use what is there for the chunk */ |
1001 | ret = response->data_size - data_write_offset; | 1005 | ret = response->data_size - data_write_offset; |
1002 | if ( ((size_t) ret) > connection->write_buffer_size - sizeof (cbuf) - 2 ) | 1006 | if ( ((size_t) ret) > connection->write_buffer_size - sizeof (cbuf) - 2) |
1003 | ret = connection->write_buffer_size - sizeof (cbuf) - 2; | 1007 | ret = connection->write_buffer_size - sizeof (cbuf) - 2; |
1004 | memcpy (&connection->write_buffer[sizeof (cbuf)], | 1008 | memcpy (&connection->write_buffer[sizeof (cbuf)], |
1005 | &response->data[data_write_offset], | 1009 | &response->data[data_write_offset], |
@@ -1454,8 +1458,7 @@ build_header_response (struct MHD_Connection *connection) | |||
1454 | 1458 | ||
1455 | Note that the change from 'SHOULD NOT' to 'MUST NOT' is | 1459 | Note that the change from 'SHOULD NOT' to 'MUST NOT' is |
1456 | a recent development of the HTTP 1.1 specification. | 1460 | a recent development of the HTTP 1.1 specification. |
1457 | */ | 1461 | */content_length_len |
1458 | content_length_len | ||
1459 | = MHD_snprintf_ (content_length_buf, | 1462 | = MHD_snprintf_ (content_length_buf, |
1460 | sizeof (content_length_buf), | 1463 | sizeof (content_length_buf), |
1461 | MHD_HTTP_HEADER_CONTENT_LENGTH ": " | 1464 | MHD_HTTP_HEADER_CONTENT_LENGTH ": " |
@@ -1788,8 +1791,7 @@ MHD_connection_update_event_loop_info (struct MHD_Connection *connection) | |||
1788 | or if we do nothing, we would just timeout | 1791 | or if we do nothing, we would just timeout |
1789 | on the connection (if a timeout is even | 1792 | on the connection (if a timeout is even |
1790 | set!). | 1793 | set!). |
1791 | Solution: we kill the connection with an error */ | 1794 | Solution: we kill the connection with an error */transmit_error_response (connection, |
1792 | transmit_error_response (connection, | ||
1793 | MHD_HTTP_INTERNAL_SERVER_ERROR, | 1795 | MHD_HTTP_INTERNAL_SERVER_ERROR, |
1794 | INTERNAL_ERROR); | 1796 | INTERNAL_ERROR); |
1795 | continue; | 1797 | continue; |
@@ -2559,8 +2561,7 @@ process_header_line (struct MHD_Connection *connection, | |||
2559 | header at the beginning of the while | 2561 | header at the beginning of the while |
2560 | loop since we need to be able to inspect | 2562 | loop since we need to be able to inspect |
2561 | the *next* header line (in case it starts | 2563 | the *next* header line (in case it starts |
2562 | with a space...) */ | 2564 | with a space...) */connection->last = line; |
2563 | connection->last = line; | ||
2564 | connection->colon = colon; | 2565 | connection->colon = colon; |
2565 | return MHD_YES; | 2566 | return MHD_YES; |
2566 | } | 2567 | } |
@@ -2607,8 +2608,7 @@ process_broken_line (struct MHD_Connection *connection, | |||
2607 | adjacency); also, in the case where these are not adjacent | 2608 | adjacency); also, in the case where these are not adjacent |
2608 | (not sure how it can happen!), we would want to allocate from | 2609 | (not sure how it can happen!), we would want to allocate from |
2609 | the end of the pool, so as to not destroy the read-buffer's | 2610 | the end of the pool, so as to not destroy the read-buffer's |
2610 | ability to grow nicely. */ | 2611 | ability to grow nicely. */last = MHD_pool_reallocate (connection->pool, |
2611 | last = MHD_pool_reallocate (connection->pool, | ||
2612 | last, | 2612 | last, |
2613 | last_len + 1, | 2613 | last_len + 1, |
2614 | last_len + tmp_len + 1); | 2614 | last_len + tmp_len + 1); |
@@ -3804,6 +3804,8 @@ MHD_connection_epoll_update_ (struct MHD_Connection *connection) | |||
3804 | } | 3804 | } |
3805 | return MHD_YES; | 3805 | return MHD_YES; |
3806 | } | 3806 | } |
3807 | |||
3808 | |||
3807 | #endif | 3809 | #endif |
3808 | 3810 | ||
3809 | 3811 | ||
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h index 74ebafcb..88f31dbd 100644 --- a/src/microhttpd/connection.h +++ b/src/microhttpd/connection.h | |||
@@ -68,6 +68,7 @@ | |||
68 | */ | 68 | */ |
69 | void | 69 | void |
70 | MHD_conn_init_static_ (void); | 70 | MHD_conn_init_static_ (void); |
71 | |||
71 | #endif /* HAVE_FREEBSD_SENDFILE */ | 72 | #endif /* HAVE_FREEBSD_SENDFILE */ |
72 | 73 | ||
73 | 74 | ||
@@ -152,6 +153,7 @@ MHD_connection_close_ (struct MHD_Connection *connection, | |||
152 | */ | 153 | */ |
153 | void | 154 | void |
154 | MHD_connection_finish_forward_ (struct MHD_Connection *connection); | 155 | MHD_connection_finish_forward_ (struct MHD_Connection *connection); |
156 | |||
155 | #else /* ! HTTPS_SUPPORT */ | 157 | #else /* ! HTTPS_SUPPORT */ |
156 | #define MHD_connection_finish_forward_(conn) (void) conn | 158 | #define MHD_connection_finish_forward_(conn) (void) conn |
157 | #endif /* ! HTTPS_SUPPORT */ | 159 | #endif /* ! HTTPS_SUPPORT */ |
@@ -168,6 +170,7 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection); | |||
168 | */ | 170 | */ |
169 | int | 171 | int |
170 | MHD_connection_epoll_update_ (struct MHD_Connection *connection); | 172 | MHD_connection_epoll_update_ (struct MHD_Connection *connection); |
173 | |||
171 | #endif | 174 | #endif |
172 | 175 | ||
173 | /** | 176 | /** |
diff --git a/src/microhttpd/connection_https.c b/src/microhttpd/connection_https.c index 108e1fc6..fb07deca 100644 --- a/src/microhttpd/connection_https.c +++ b/src/microhttpd/connection_https.c | |||
@@ -226,4 +226,5 @@ MHD_tls_connection_shutdown (struct MHD_Connection *connection) | |||
226 | return false; | 226 | return false; |
227 | } | 227 | } |
228 | 228 | ||
229 | |||
229 | /* end of connection_https.c */ | 230 | /* end of connection_https.c */ |
diff --git a/src/microhttpd/connection_https.h b/src/microhttpd/connection_https.h index 142c8da8..58b7f619 100644 --- a/src/microhttpd/connection_https.h +++ b/src/microhttpd/connection_https.h | |||
@@ -74,6 +74,7 @@ ssize_t | |||
74 | send_tls_adapter (struct MHD_Connection *connection, | 74 | send_tls_adapter (struct MHD_Connection *connection, |
75 | const void *other, | 75 | const void *other, |
76 | size_t i); | 76 | size_t i); |
77 | |||
77 | #endif /* HTTPS_SUPPORT */ | 78 | #endif /* HTTPS_SUPPORT */ |
78 | 79 | ||
79 | #endif | 80 | #endif |
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index aec6aa86..c879a2df 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -216,6 +216,8 @@ MHD_check_global_init_ (void) | |||
216 | #endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */ | 216 | #endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */ |
217 | #endif | 217 | #endif |
218 | } | 218 | } |
219 | |||
220 | |||
219 | #endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */ | 221 | #endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */ |
220 | 222 | ||
221 | 223 | ||
@@ -654,6 +656,7 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon) | |||
654 | return -1; | 656 | return -1; |
655 | } | 657 | } |
656 | 658 | ||
659 | |||
657 | /** | 660 | /** |
658 | * Initialize security aspects of the HTTPS daemon | 661 | * Initialize security aspects of the HTTPS daemon |
659 | * | 662 | * |
@@ -684,6 +687,8 @@ MHD_TLS_init (struct MHD_Daemon *daemon) | |||
684 | return -1; | 687 | return -1; |
685 | } | 688 | } |
686 | } | 689 | } |
690 | |||
691 | |||
687 | #endif /* HTTPS_SUPPORT */ | 692 | #endif /* HTTPS_SUPPORT */ |
688 | 693 | ||
689 | 694 | ||
@@ -858,6 +863,7 @@ urh_from_fdset (struct MHD_UpgradeResponseHandle *urh, | |||
858 | } | 863 | } |
859 | } | 864 | } |
860 | 865 | ||
866 | |||
861 | #ifdef HAVE_POLL | 867 | #ifdef HAVE_POLL |
862 | 868 | ||
863 | /** | 869 | /** |
@@ -950,6 +956,8 @@ urh_from_pollfd (struct MHD_UpgradeResponseHandle *urh, | |||
950 | if (0 != (p[1].revents & MHD_POLL_REVENTS_ERRROR)) | 956 | if (0 != (p[1].revents & MHD_POLL_REVENTS_ERRROR)) |
951 | urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; | 957 | urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; |
952 | } | 958 | } |
959 | |||
960 | |||
953 | #endif /* HAVE_POLL */ | 961 | #endif /* HAVE_POLL */ |
954 | #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ | 962 | #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ |
955 | 963 | ||
@@ -1236,10 +1244,8 @@ call_handlers (struct MHD_Connection *con, | |||
1236 | immediately. | 1244 | immediately. |
1237 | As writeability of socket was not checked and it may have | 1245 | As writeability of socket was not checked and it may have |
1238 | some data pending in system buffers, use this optimization | 1246 | some data pending in system buffers, use this optimization |
1239 | only for non-blocking sockets. */ | 1247 | only for non-blocking sockets. *//* No need to check 'ret' as connection is always in |
1240 | /* No need to check 'ret' as connection is always in | 1248 | * MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */else if (on_fasttrack && con->sk_nonblck) |
1241 | * MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */ | ||
1242 | else if (on_fasttrack && con->sk_nonblck) | ||
1243 | { | 1249 | { |
1244 | if (MHD_CONNECTION_HEADERS_SENDING == con->state) | 1250 | if (MHD_CONNECTION_HEADERS_SENDING == con->state) |
1245 | { | 1251 | { |
@@ -1312,6 +1318,8 @@ cleanup_upgraded_connection (struct MHD_Connection *connection) | |||
1312 | connection->urh = NULL; | 1318 | connection->urh = NULL; |
1313 | free (urh); | 1319 | free (urh); |
1314 | } | 1320 | } |
1321 | |||
1322 | |||
1315 | #endif /* UPGRADE_SUPPORT */ | 1323 | #endif /* UPGRADE_SUPPORT */ |
1316 | 1324 | ||
1317 | 1325 | ||
@@ -1371,8 +1379,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh) | |||
1371 | * check for any pending data even if socket is not marked | 1379 | * check for any pending data even if socket is not marked |
1372 | * as 'ready' (signal may arrive after poll()/select()). | 1380 | * as 'ready' (signal may arrive after poll()/select()). |
1373 | * Socketpair for forwarding is always in non-blocking mode | 1381 | * Socketpair for forwarding is always in non-blocking mode |
1374 | * so no risk that recv() will block the thread. */ | 1382 | * so no risk that recv() will block the thread. */if (0 != urh->out_buffer_size) |
1375 | if (0 != urh->out_buffer_size) | ||
1376 | urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; | 1383 | urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; |
1377 | /* Discard any data received form remote. */ | 1384 | /* Discard any data received form remote. */ |
1378 | urh->in_buffer_used = 0; | 1385 | urh->in_buffer_used = 0; |
@@ -1388,11 +1395,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh) | |||
1388 | * fail after remote disconnect was detected) may discard data in system | 1395 | * fail after remote disconnect was detected) may discard data in system |
1389 | * buffers received by system but not yet read by recv(). | 1396 | * buffers received by system but not yet read by recv(). |
1390 | * So, before trying send() on any socket, recv() must be performed at first | 1397 | * So, before trying send() on any socket, recv() must be performed at first |
1391 | * otherwise last part of incoming data may be lost. */ | 1398 | * otherwise last part of incoming data may be lost. *//* If disconnect or error was detected - try to read from socket |
1392 | 1399 | * to dry data possibly pending is system buffers. */if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi)) | |
1393 | /* If disconnect or error was detected - try to read from socket | ||
1394 | * to dry data possibly pending is system buffers. */ | ||
1395 | if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi)) | ||
1396 | urh->app.celi |= MHD_EPOLL_STATE_READ_READY; | 1400 | urh->app.celi |= MHD_EPOLL_STATE_READ_READY; |
1397 | if (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) | 1401 | if (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) |
1398 | urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; | 1402 | urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; |
@@ -1669,6 +1673,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh) | |||
1669 | urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; | 1673 | urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; |
1670 | } | 1674 | } |
1671 | } | 1675 | } |
1676 | |||
1677 | |||
1672 | #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ | 1678 | #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ |
1673 | 1679 | ||
1674 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) | 1680 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) |
@@ -1823,6 +1829,8 @@ thread_main_connection_upgrade (struct MHD_Connection *con) | |||
1823 | /* Do not set 'urh->clean_ready' yet as 'urh' will be used | 1829 | /* Do not set 'urh->clean_ready' yet as 'urh' will be used |
1824 | * in connection thread for a little while. */ | 1830 | * in connection thread for a little while. */ |
1825 | } | 1831 | } |
1832 | |||
1833 | |||
1826 | #endif /* UPGRADE_SUPPORT */ | 1834 | #endif /* UPGRADE_SUPPORT */ |
1827 | 1835 | ||
1828 | 1836 | ||
@@ -2182,7 +2190,7 @@ thread_main_handle_connection (void *data) | |||
2182 | MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN : | 2190 | MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN : |
2183 | MHD_REQUEST_TERMINATED_WITH_ERROR); | 2191 | MHD_REQUEST_TERMINATED_WITH_ERROR); |
2184 | MHD_connection_handle_idle (con); | 2192 | MHD_connection_handle_idle (con); |
2185 | exit: | 2193 | exit: |
2186 | if (NULL != con->response) | 2194 | if (NULL != con->response) |
2187 | { | 2195 | { |
2188 | MHD_destroy_response (con->response); | 2196 | MHD_destroy_response (con->response); |
@@ -2208,6 +2216,8 @@ thread_main_handle_connection (void *data) | |||
2208 | } | 2216 | } |
2209 | return (MHD_THRD_RTRN_TYPE_) 0; | 2217 | return (MHD_THRD_RTRN_TYPE_) 0; |
2210 | } | 2218 | } |
2219 | |||
2220 | |||
2211 | #endif | 2221 | #endif |
2212 | 2222 | ||
2213 | 2223 | ||
@@ -2248,6 +2258,8 @@ MHD_tls_push_func_ (gnutls_transport_ptr_t trnsp, | |||
2248 | #endif /* (MHD_SCKT_SEND_MAX_SIZE_ < SSIZE_MAX) || (0 == SSIZE_MAX) */ | 2258 | #endif /* (MHD_SCKT_SEND_MAX_SIZE_ < SSIZE_MAX) || (0 == SSIZE_MAX) */ |
2249 | return MHD_send_ ((MHD_socket) (intptr_t) (trnsp), data, data_size); | 2259 | return MHD_send_ ((MHD_socket) (intptr_t) (trnsp), data, data_size); |
2250 | } | 2260 | } |
2261 | |||
2262 | |||
2251 | #endif /* MHD_TLSLIB_DONT_SUPPRESS_SIGPIPE */ | 2263 | #endif /* MHD_TLSLIB_DONT_SUPPRESS_SIGPIPE */ |
2252 | 2264 | ||
2253 | 2265 | ||
@@ -2327,6 +2339,8 @@ psk_gnutls_adapter (gnutls_session_t session, | |||
2327 | return -1; | 2339 | return -1; |
2328 | #endif | 2340 | #endif |
2329 | } | 2341 | } |
2342 | |||
2343 | |||
2330 | #endif /* HTTPS_SUPPORT */ | 2344 | #endif /* HTTPS_SUPPORT */ |
2331 | 2345 | ||
2332 | 2346 | ||
@@ -2742,7 +2756,7 @@ internal_add_connection (struct MHD_Daemon *daemon, | |||
2742 | #endif | 2756 | #endif |
2743 | } | 2757 | } |
2744 | return MHD_YES; | 2758 | return MHD_YES; |
2745 | cleanup: | 2759 | cleanup: |
2746 | if (NULL != daemon->notify_connection) | 2760 | if (NULL != daemon->notify_connection) |
2747 | daemon->notify_connection (daemon->notify_connection_cls, | 2761 | daemon->notify_connection (daemon->notify_connection_cls, |
2748 | connection, | 2762 | connection, |
@@ -3223,7 +3237,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon) | |||
3223 | { | 3237 | { |
3224 | MHD_socket_close_chk_ (s); | 3238 | MHD_socket_close_chk_ (s); |
3225 | } | 3239 | } |
3226 | if ( MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) ) | 3240 | if (MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) ) |
3227 | { | 3241 | { |
3228 | /* system/process out of resources */ | 3242 | /* system/process out of resources */ |
3229 | if (0 == daemon->connections) | 3243 | if (0 == daemon->connections) |
@@ -3375,8 +3389,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) | |||
3375 | this is not true as if we fail to do manually remove it, | 3389 | this is not true as if we fail to do manually remove it, |
3376 | we are still seeing an event for this fd in epoll, | 3390 | we are still seeing an event for this fd in epoll, |
3377 | causing grief (use-after-free...) --- at least on my | 3391 | causing grief (use-after-free...) --- at least on my |
3378 | system. */ | 3392 | system. */if (0 != epoll_ctl (daemon->epoll_fd, |
3379 | if (0 != epoll_ctl (daemon->epoll_fd, | ||
3380 | EPOLL_CTL_DEL, | 3393 | EPOLL_CTL_DEL, |
3381 | pos->socket_fd, | 3394 | pos->socket_fd, |
3382 | NULL)) | 3395 | NULL)) |
@@ -3632,7 +3645,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon, | |||
3632 | if (0 != (daemon->options | 3645 | if (0 != (daemon->options |
3633 | & (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_POLL)) ) | 3646 | & (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_POLL)) ) |
3634 | return MHD_NO; | 3647 | return MHD_NO; |
3635 | if ((NULL == read_fd_set)||(NULL == write_fd_set)) | 3648 | if ((NULL == read_fd_set) || (NULL == write_fd_set)) |
3636 | return MHD_NO; | 3649 | return MHD_NO; |
3637 | if (NULL == except_fd_set) | 3650 | if (NULL == except_fd_set) |
3638 | { /* Workaround to maintain backward compatibility. */ | 3651 | { /* Workaround to maintain backward compatibility. */ |
@@ -3770,6 +3783,8 @@ MHD_select (struct MHD_Daemon *daemon, | |||
3770 | #if defined(MHD_WINSOCK_SOCKETS) | 3783 | #if defined(MHD_WINSOCK_SOCKETS) |
3771 | } | 3784 | } |
3772 | } | 3785 | } |
3786 | |||
3787 | |||
3773 | #endif /* MHD_WINSOCK_SOCKETS */ | 3788 | #endif /* MHD_WINSOCK_SOCKETS */ |
3774 | } | 3789 | } |
3775 | /* Stop listening if we are at the configured connection limit */ | 3790 | /* Stop listening if we are at the configured connection limit */ |
@@ -4130,6 +4145,8 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon, | |||
4130 | (void) MHD_accept_connection (daemon); | 4145 | (void) MHD_accept_connection (daemon); |
4131 | return MHD_YES; | 4146 | return MHD_YES; |
4132 | } | 4147 | } |
4148 | |||
4149 | |||
4133 | #endif | 4150 | #endif |
4134 | 4151 | ||
4135 | 4152 | ||
@@ -4319,6 +4336,8 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon) | |||
4319 | 4336 | ||
4320 | return MHD_YES; | 4337 | return MHD_YES; |
4321 | } | 4338 | } |
4339 | |||
4340 | |||
4322 | #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ | 4341 | #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ |
4323 | 4342 | ||
4324 | 4343 | ||
@@ -4607,8 +4626,7 @@ MHD_epoll (struct MHD_Daemon *daemon, | |||
4607 | here. | 4626 | here. |
4608 | 4627 | ||
4609 | Connections with custom timeouts must all be looked at, as we | 4628 | Connections with custom timeouts must all be looked at, as we |
4610 | do not bother to sort that (presumably very short) list. */ | 4629 | do not bother to sort that (presumably very short) list. */prev = daemon->manual_timeout_tail; |
4611 | prev = daemon->manual_timeout_tail; | ||
4612 | while (NULL != (pos = prev)) | 4630 | while (NULL != (pos = prev)) |
4613 | { | 4631 | { |
4614 | prev = pos->prevX; | 4632 | prev = pos->prevX; |
@@ -4628,6 +4646,8 @@ MHD_epoll (struct MHD_Daemon *daemon, | |||
4628 | } | 4646 | } |
4629 | return MHD_YES; | 4647 | return MHD_YES; |
4630 | } | 4648 | } |
4649 | |||
4650 | |||
4631 | #endif | 4651 | #endif |
4632 | 4652 | ||
4633 | 4653 | ||
@@ -4759,6 +4779,8 @@ MHD_polling_thread (void *cls) | |||
4759 | 4779 | ||
4760 | return (MHD_THRD_RTRN_TYPE_) 0; | 4780 | return (MHD_THRD_RTRN_TYPE_) 0; |
4761 | } | 4781 | } |
4782 | |||
4783 | |||
4762 | #endif | 4784 | #endif |
4763 | 4785 | ||
4764 | 4786 | ||
@@ -5644,6 +5666,8 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon) | |||
5644 | } | 5666 | } |
5645 | return MHD_YES; | 5667 | return MHD_YES; |
5646 | } | 5668 | } |
5669 | |||
5670 | |||
5647 | #endif | 5671 | #endif |
5648 | 5672 | ||
5649 | 5673 | ||
@@ -6553,7 +6577,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
6553 | return daemon; | 6577 | return daemon; |
6554 | 6578 | ||
6555 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) | 6579 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) |
6556 | thread_failed: | 6580 | thread_failed: |
6557 | /* If no worker threads created, then shut down normally. Calling | 6581 | /* If no worker threads created, then shut down normally. Calling |
6558 | MHD_stop_daemon (as we do below) doesn't work here since it | 6582 | MHD_stop_daemon (as we do below) doesn't work here since it |
6559 | assumes a 0-sized thread pool means we had been in the default | 6583 | assumes a 0-sized thread pool means we had been in the default |
@@ -6577,7 +6601,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
6577 | return NULL; | 6601 | return NULL; |
6578 | #endif | 6602 | #endif |
6579 | 6603 | ||
6580 | free_and_fail: | 6604 | free_and_fail: |
6581 | /* clean up basic memory state in 'daemon' and return NULL to | 6605 | /* clean up basic memory state in 'daemon' and return NULL to |
6582 | indicate failure */ | 6606 | indicate failure */ |
6583 | #ifdef EPOLL_SUPPORT | 6607 | #ifdef EPOLL_SUPPORT |
@@ -7053,7 +7077,7 @@ MHD_get_version (void) | |||
7053 | (((int) MHD_VERSION >> 24) & 0xFF), | 7077 | (((int) MHD_VERSION >> 24) & 0xFF), |
7054 | (((int) MHD_VERSION >> 16) & 0xFF), | 7078 | (((int) MHD_VERSION >> 16) & 0xFF), |
7055 | (((int) MHD_VERSION >> 8) & 0xFF)); | 7079 | (((int) MHD_VERSION >> 8) & 0xFF)); |
7056 | if ((0 >= res)||(sizeof(ver) <= res)) | 7080 | if ((0 >= res) || (sizeof(ver) <= res)) |
7057 | return "0.0.0"; /* Can't return real version*/ | 7081 | return "0.0.0"; /* Can't return real version*/ |
7058 | } | 7082 | } |
7059 | return ver; | 7083 | return ver; |
@@ -7301,7 +7325,7 @@ MHD_init (void) | |||
7301 | if (0 != WSAStartup (MAKEWORD (2, 2), &wsd)) | 7325 | if (0 != WSAStartup (MAKEWORD (2, 2), &wsd)) |
7302 | MHD_PANIC (_ ("Failed to initialize winsock\n")); | 7326 | MHD_PANIC (_ ("Failed to initialize winsock\n")); |
7303 | mhd_winsock_inited_ = 1; | 7327 | mhd_winsock_inited_ = 1; |
7304 | if ((2 != LOBYTE (wsd.wVersion))&&(2 != HIBYTE (wsd.wVersion))) | 7328 | if ((2 != LOBYTE (wsd.wVersion)) && (2 != HIBYTE (wsd.wVersion))) |
7305 | MHD_PANIC (_ ("Winsock version 2.2 is not available\n")); | 7329 | MHD_PANIC (_ ("Winsock version 2.2 is not available\n")); |
7306 | #endif /* MHD_WINSOCK_SOCKETS */ | 7330 | #endif /* MHD_WINSOCK_SOCKETS */ |
7307 | #ifdef HTTPS_SUPPORT | 7331 | #ifdef HTTPS_SUPPORT |
@@ -7346,6 +7370,7 @@ MHD_fini (void) | |||
7346 | MHD_monotonic_sec_counter_finish (); | 7370 | MHD_monotonic_sec_counter_finish (); |
7347 | } | 7371 | } |
7348 | 7372 | ||
7373 | |||
7349 | #ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED | 7374 | #ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED |
7350 | _SET_INIT_AND_DEINIT_FUNCS (MHD_init, MHD_fini); | 7375 | _SET_INIT_AND_DEINIT_FUNCS (MHD_init, MHD_fini); |
7351 | #endif /* _AUTOINIT_FUNCS_ARE_SUPPORTED */ | 7376 | #endif /* _AUTOINIT_FUNCS_ARE_SUPPORTED */ |
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c index 95aee7b4..fe078009 100644 --- a/src/microhttpd/digestauth.c +++ b/src/microhttpd/digestauth.c | |||
@@ -555,8 +555,7 @@ check_nonce_nc (struct MHD_Connection *connection, | |||
555 | * Look for the nonce, if it does exist and its corresponding | 555 | * Look for the nonce, if it does exist and its corresponding |
556 | * nonce counter is less than the current nonce counter by 1, | 556 | * nonce counter is less than the current nonce counter by 1, |
557 | * then only increase the nonce counter by one. | 557 | * then only increase the nonce counter by one. |
558 | */ | 558 | */nn = &daemon->nnc[off]; |
559 | nn = &daemon->nnc[off]; | ||
560 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) | 559 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) |
561 | MHD_mutex_lock_chk_ (&daemon->nnc_lock); | 560 | MHD_mutex_lock_chk_ (&daemon->nnc_lock); |
562 | #endif | 561 | #endif |
@@ -938,8 +937,7 @@ digest_auth_check_all (struct MHD_Connection *connection, | |||
938 | large, but of course in theory the | 937 | large, but of course in theory the |
939 | #MHD_OPTION_CONNECTION_MEMORY_LIMIT might be very large | 938 | #MHD_OPTION_CONNECTION_MEMORY_LIMIT might be very large |
940 | and would thus permit sending a >32k authorization | 939 | and would thus permit sending a >32k authorization |
941 | header value. */ | 940 | header value. */return MHD_NO; |
942 | return MHD_NO; | ||
943 | } | 941 | } |
944 | if (TIMESTAMP_BIN_SIZE * 2 != | 942 | if (TIMESTAMP_BIN_SIZE * 2 != |
945 | MHD_strx_to_uint32_n_ (nonce + len - TIMESTAMP_BIN_SIZE * 2, | 943 | MHD_strx_to_uint32_n_ (nonce + len - TIMESTAMP_BIN_SIZE * 2, |
@@ -957,8 +955,7 @@ digest_auth_check_all (struct MHD_Connection *connection, | |||
957 | * First level vetting for the nonce validity: if the timestamp | 955 | * First level vetting for the nonce validity: if the timestamp |
958 | * attached to the nonce exceeds `nonce_timeout', then the nonce is | 956 | * attached to the nonce exceeds `nonce_timeout', then the nonce is |
959 | * invalid. | 957 | * invalid. |
960 | */ | 958 | */if ( (t > nonce_time + nonce_timeout) || |
961 | if ( (t > nonce_time + nonce_timeout) || | ||
962 | (nonce_time + nonce_timeout < nonce_time) ) | 959 | (nonce_time + nonce_timeout < nonce_time) ) |
963 | { | 960 | { |
964 | /* too old */ | 961 | /* too old */ |
@@ -981,9 +978,7 @@ digest_auth_check_all (struct MHD_Connection *connection, | |||
981 | * able to generate a "sane" nonce, which if he does | 978 | * able to generate a "sane" nonce, which if he does |
982 | * not, the nonce fabrication process going to be | 979 | * not, the nonce fabrication process going to be |
983 | * very hard to achieve. | 980 | * very hard to achieve. |
984 | */ | 981 | */if (0 != strcmp (nonce, |
985 | |||
986 | if (0 != strcmp (nonce, | ||
987 | noncehashexp)) | 982 | noncehashexp)) |
988 | { | 983 | { |
989 | return MHD_INVALID_NONCE; | 984 | return MHD_INVALID_NONCE; |
@@ -1003,7 +998,7 @@ digest_auth_check_all (struct MHD_Connection *connection, | |||
1003 | (0 == (len = lookup_sub_value (nc, | 998 | (0 == (len = lookup_sub_value (nc, |
1004 | sizeof (nc), | 999 | sizeof (nc), |
1005 | header, | 1000 | header, |
1006 | "nc")) ) || | 1001 | "nc")) ) || |
1007 | (0 == lookup_sub_value (response, | 1002 | (0 == lookup_sub_value (response, |
1008 | sizeof (response), | 1003 | sizeof (response), |
1009 | header, | 1004 | header, |
@@ -1030,8 +1025,7 @@ digest_auth_check_all (struct MHD_Connection *connection, | |||
1030 | * Checking if that combination of nonce and nc is sound | 1025 | * Checking if that combination of nonce and nc is sound |
1031 | * and not a replay attack attempt. Also adds the nonce | 1026 | * and not a replay attack attempt. Also adds the nonce |
1032 | * to the nonce-nc map if it does not exist there. | 1027 | * to the nonce-nc map if it does not exist there. |
1033 | */ | 1028 | */if (MHD_YES != |
1034 | if (MHD_YES != | ||
1035 | check_nonce_nc (connection, | 1029 | check_nonce_nc (connection, |
1036 | nonce, | 1030 | nonce, |
1037 | nci)) | 1031 | nci)) |
@@ -1219,7 +1213,6 @@ MHD_digest_auth_check (struct MHD_Connection *connection, | |||
1219 | } while (0) | 1213 | } while (0) |
1220 | 1214 | ||
1221 | 1215 | ||
1222 | |||
1223 | /** | 1216 | /** |
1224 | * Authenticates the authorization header sent by the client. | 1217 | * Authenticates the authorization header sent by the client. |
1225 | * | 1218 | * |
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c index 109ebfe2..b8d8f540 100644 --- a/src/microhttpd/internal.c +++ b/src/microhttpd/internal.c | |||
@@ -81,6 +81,8 @@ MHD_state_to_string (enum MHD_CONNECTION_STATE state) | |||
81 | return "unrecognized connection state"; | 81 | return "unrecognized connection state"; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | |||
85 | |||
84 | #endif | 86 | #endif |
85 | #endif | 87 | #endif |
86 | 88 | ||
@@ -105,6 +107,8 @@ MHD_DLOG (const struct MHD_Daemon *daemon, | |||
105 | va); | 107 | va); |
106 | va_end (va); | 108 | va_end (va); |
107 | } | 109 | } |
110 | |||
111 | |||
108 | #endif | 112 | #endif |
109 | 113 | ||
110 | 114 | ||
@@ -288,4 +292,5 @@ MHD_parse_arguments_ (struct MHD_Connection *connection, | |||
288 | return MHD_YES; | 292 | return MHD_YES; |
289 | } | 293 | } |
290 | 294 | ||
295 | |||
291 | /* end of internal.c */ | 296 | /* end of internal.c */ |
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h index 8f7192e7..211eed9f 100644 --- a/src/microhttpd/internal.h +++ b/src/microhttpd/internal.h | |||
@@ -255,6 +255,7 @@ void | |||
255 | MHD_DLOG (const struct MHD_Daemon *daemon, | 255 | MHD_DLOG (const struct MHD_Daemon *daemon, |
256 | const char *format, | 256 | const char *format, |
257 | ...); | 257 | ...); |
258 | |||
258 | #endif | 259 | #endif |
259 | 260 | ||
260 | 261 | ||
@@ -562,6 +563,7 @@ enum MHD_TLS_CONN_STATE | |||
562 | #if DEBUG_STATES | 563 | #if DEBUG_STATES |
563 | const char * | 564 | const char * |
564 | MHD_state_to_string (enum MHD_CONNECTION_STATE state); | 565 | MHD_state_to_string (enum MHD_CONNECTION_STATE state); |
566 | |||
565 | #endif | 567 | #endif |
566 | #endif | 568 | #endif |
567 | 569 | ||
@@ -1802,7 +1804,6 @@ struct MHD_Daemon | |||
1802 | (element)->prev = NULL; } while (0) | 1804 | (element)->prev = NULL; } while (0) |
1803 | 1805 | ||
1804 | 1806 | ||
1805 | |||
1806 | /** | 1807 | /** |
1807 | * Insert an element at the head of a XDLL. Assumes that head, tail and | 1808 | * Insert an element at the head of a XDLL. Assumes that head, tail and |
1808 | * element are structs with prevX and nextX fields. | 1809 | * element are structs with prevX and nextX fields. |
diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c index 39b66185..05a2c9e6 100644 --- a/src/microhttpd/md5.c +++ b/src/microhttpd/md5.c | |||
@@ -46,6 +46,7 @@ MHD_MD5Init (void *ctx_) | |||
46 | ctx->state[3] = 0x10325476; | 46 | ctx->state[3] = 0x10325476; |
47 | } | 47 | } |
48 | 48 | ||
49 | |||
49 | static void | 50 | static void |
50 | MD5Transform (uint32_t state[4], | 51 | MD5Transform (uint32_t state[4], |
51 | const uint8_t block[MD5_BLOCK_SIZE]); | 52 | const uint8_t block[MD5_BLOCK_SIZE]); |
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c index ddfd08d3..57e49cf0 100644 --- a/src/microhttpd/memorypool.c +++ b/src/microhttpd/memorypool.c | |||
@@ -100,6 +100,7 @@ MHD_init_mem_pools_ (void) | |||
100 | #endif /* _WIN32 */ | 100 | #endif /* _WIN32 */ |
101 | } | 101 | } |
102 | 102 | ||
103 | |||
103 | /** | 104 | /** |
104 | * Handle for a memory pool. Pools are not reentrant and must not be | 105 | * Handle for a memory pool. Pools are not reentrant and must not be |
105 | * used by multiple threads. | 106 | * used by multiple threads. |
diff --git a/src/microhttpd/mhd_byteorder.h b/src/microhttpd/mhd_byteorder.h index f1f03f44..73c14240 100644 --- a/src/microhttpd/mhd_byteorder.h +++ b/src/microhttpd/mhd_byteorder.h | |||
@@ -125,7 +125,7 @@ | |||
125 | defined(_M_IX86) || defined(_X86_) || defined (__THW_INTEL__) | 125 | defined(_M_IX86) || defined(_X86_) || defined (__THW_INTEL__) |
126 | /* x86 family is little endian */ | 126 | /* x86 family is little endian */ |
127 | #define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN | 127 | #define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN |
128 | #elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \ | 128 | #elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \ |
129 | defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) | 129 | defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) |
130 | /* Looks like we are on ARM/MIPS in big endian mode */ | 130 | /* Looks like we are on ARM/MIPS in big endian mode */ |
131 | #define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN | 131 | #define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN |
diff --git a/src/microhttpd/mhd_compat.c b/src/microhttpd/mhd_compat.c index 6f6c6f9c..fd8132ac 100644 --- a/src/microhttpd/mhd_compat.c +++ b/src/microhttpd/mhd_compat.c | |||
@@ -79,6 +79,7 @@ W32_snprintf (char *__restrict s, | |||
79 | return ret; | 79 | return ret; |
80 | } | 80 | } |
81 | 81 | ||
82 | |||
82 | #endif /* HAVE_SNPRINTF */ | 83 | #endif /* HAVE_SNPRINTF */ |
83 | #endif /* _WIN32 && !__CYGWIN__ */ | 84 | #endif /* _WIN32 && !__CYGWIN__ */ |
84 | 85 | ||
@@ -93,16 +94,17 @@ W32_snprintf (char *__restrict s, | |||
93 | #endif /* __GNUC__ >= 5 */ | 94 | #endif /* __GNUC__ >= 5 */ |
94 | 95 | ||
95 | 96 | ||
96 | void *MHD_calloc_ (size_t nelem, size_t elsize) | 97 | void * |
98 | MHD_calloc_ (size_t nelem, size_t elsize) | ||
97 | { | 99 | { |
98 | size_t alloc_size; | 100 | size_t alloc_size; |
99 | void *ptr; | 101 | void *ptr; |
100 | #ifdef MHD_HAVE_NUL_OVERFLOW | 102 | #ifdef MHD_HAVE_NUL_OVERFLOW |
101 | if (__builtin_mul_overflow (nelem, elsize, &alloc_size) ||(0 == alloc_size)) | 103 | if (__builtin_mul_overflow (nelem, elsize, &alloc_size) || (0 == alloc_size)) |
102 | return NULL; | 104 | return NULL; |
103 | #else /* ! MHD_HAVE_NUL_OVERFLOW */ | 105 | #else /* ! MHD_HAVE_NUL_OVERFLOW */ |
104 | alloc_size = nelem * elsize; | 106 | alloc_size = nelem * elsize; |
105 | if ((0 == alloc_size)||(elsize != alloc_size / nelem)) | 107 | if ((0 == alloc_size) || (elsize != alloc_size / nelem)) |
106 | return NULL; | 108 | return NULL; |
107 | #endif /* ! MHD_HAVE_NUL_OVERFLOW */ | 109 | #endif /* ! MHD_HAVE_NUL_OVERFLOW */ |
108 | ptr = malloc (alloc_size); | 110 | ptr = malloc (alloc_size); |
@@ -111,4 +113,6 @@ void *MHD_calloc_ (size_t nelem, size_t elsize) | |||
111 | memset (ptr, 0, alloc_size); | 113 | memset (ptr, 0, alloc_size); |
112 | return ptr; | 114 | return ptr; |
113 | } | 115 | } |
116 | |||
117 | |||
114 | #endif /* ! HAVE_CALLOC */ | 118 | #endif /* ! HAVE_CALLOC */ |
diff --git a/src/microhttpd/mhd_compat.h b/src/microhttpd/mhd_compat.h index 6b38a03e..4062c101 100644 --- a/src/microhttpd/mhd_compat.h +++ b/src/microhttpd/mhd_compat.h | |||
@@ -51,6 +51,7 @@ | |||
51 | /* Emulate snprintf function on W32 */ | 51 | /* Emulate snprintf function on W32 */ |
52 | int W32_snprintf (char *__restrict s, size_t n, const char *__restrict format, | 52 | int W32_snprintf (char *__restrict s, size_t n, const char *__restrict format, |
53 | ...); | 53 | ...); |
54 | |||
54 | #define MHD_snprintf_ W32_snprintf | 55 | #define MHD_snprintf_ W32_snprintf |
55 | #else /* ! _WIN32 || __CYGWIN__ */ | 56 | #else /* ! _WIN32 || __CYGWIN__ */ |
56 | #error \ | 57 | #error \ |
@@ -84,6 +85,7 @@ int W32_snprintf (char *__restrict s, size_t n, const char *__restrict format, | |||
84 | * MHD_calloc_ is platform-independent calloc() | 85 | * MHD_calloc_ is platform-independent calloc() |
85 | */ | 86 | */ |
86 | void *MHD_calloc_ (size_t nelem, size_t elsize); | 87 | void *MHD_calloc_ (size_t nelem, size_t elsize); |
88 | |||
87 | #endif /* ! HAVE_CALLOC */ | 89 | #endif /* ! HAVE_CALLOC */ |
88 | 90 | ||
89 | #endif /* MHD_COMPAT_H */ | 91 | #endif /* MHD_COMPAT_H */ |
diff --git a/src/microhttpd/mhd_itc.c b/src/microhttpd/mhd_itc.c index 6c81ef62..ef5e49bd 100644 --- a/src/microhttpd/mhd_itc.c +++ b/src/microhttpd/mhd_itc.c | |||
@@ -65,6 +65,8 @@ MHD_itc_nonblocking_ (struct MHD_itc_ itc) | |||
65 | } | 65 | } |
66 | return ! 0; | 66 | return ! 0; |
67 | } | 67 | } |
68 | |||
69 | |||
68 | #endif /* ! HAVE_PIPE2_FUNC */ | 70 | #endif /* ! HAVE_PIPE2_FUNC */ |
69 | #endif /* !_WIN32 || __CYGWIN__ */ | 71 | #endif /* !_WIN32 || __CYGWIN__ */ |
70 | #endif /* _MHD_ITC_EVENTFD || _MHD_ITC_PIPE */ | 72 | #endif /* _MHD_ITC_EVENTFD || _MHD_ITC_PIPE */ |
diff --git a/src/microhttpd/mhd_itc.h b/src/microhttpd/mhd_itc.h index 8e303ef9..a7cad0e1 100644 --- a/src/microhttpd/mhd_itc.h +++ b/src/microhttpd/mhd_itc.h | |||
@@ -242,6 +242,7 @@ static const uint64_t _MHD_itc_wr_data = 1; | |||
242 | */ | 242 | */ |
243 | int | 243 | int |
244 | MHD_itc_nonblocking_ (struct MHD_itc_ itc); | 244 | MHD_itc_nonblocking_ (struct MHD_itc_ itc); |
245 | |||
245 | #endif /* ! HAVE_PIPE2_FUNC */ | 246 | #endif /* ! HAVE_PIPE2_FUNC */ |
246 | 247 | ||
247 | 248 | ||
diff --git a/src/microhttpd/mhd_mono_clock.c b/src/microhttpd/mhd_mono_clock.c index eee911fb..fa548f6e 100644 --- a/src/microhttpd/mhd_mono_clock.c +++ b/src/microhttpd/mhd_mono_clock.c | |||
@@ -94,7 +94,6 @@ static int64_t perf_start; | |||
94 | #endif /* _WIN32 */ | 94 | #endif /* _WIN32 */ |
95 | 95 | ||
96 | 96 | ||
97 | |||
98 | /** | 97 | /** |
99 | * Type of monotonic clock source | 98 | * Type of monotonic clock source |
100 | */ | 99 | */ |
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c index db621cb2..371da6c0 100644 --- a/src/microhttpd/mhd_send.c +++ b/src/microhttpd/mhd_send.c | |||
@@ -448,6 +448,7 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection, | |||
448 | #endif | 448 | #endif |
449 | } | 449 | } |
450 | 450 | ||
451 | |||
451 | /** | 452 | /** |
452 | * sendfile() chuck size | 453 | * sendfile() chuck size |
453 | */ | 454 | */ |
@@ -561,8 +562,7 @@ MHD_send_sendfile_ (struct MHD_Connection *connection) | |||
561 | supported for FD or other 'unusual' errors occurred, so we should try | 562 | supported for FD or other 'unusual' errors occurred, so we should try |
562 | to fall back to 'SEND'; see also this thread for info on | 563 | to fall back to 'SEND'; see also this thread for info on |
563 | odd libc/Linux behavior with sendfile: | 564 | odd libc/Linux behavior with sendfile: |
564 | http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */ | 565 | http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */connection->resp_sender = MHD_resp_sender_std; |
565 | connection->resp_sender = MHD_resp_sender_std; | ||
566 | return MHD_ERR_AGAIN_; | 566 | return MHD_ERR_AGAIN_; |
567 | #else /* HAVE_SOLARIS_SENDFILE */ | 567 | #else /* HAVE_SOLARIS_SENDFILE */ |
568 | if ( (EAFNOSUPPORT == err) || | 568 | if ( (EAFNOSUPPORT == err) || |
@@ -662,4 +662,6 @@ MHD_send_sendfile_ (struct MHD_Connection *connection) | |||
662 | 662 | ||
663 | return ret; | 663 | return ret; |
664 | } | 664 | } |
665 | |||
666 | |||
665 | #endif /* _MHD_HAVE_SENDFILE */ | 667 | #endif /* _MHD_HAVE_SENDFILE */ |
diff --git a/src/microhttpd/mhd_send.h b/src/microhttpd/mhd_send.h index 87e584a8..22d934b3 100644 --- a/src/microhttpd/mhd_send.h +++ b/src/microhttpd/mhd_send.h | |||
@@ -94,6 +94,7 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection, | |||
94 | #if defined(_MHD_HAVE_SENDFILE) | 94 | #if defined(_MHD_HAVE_SENDFILE) |
95 | ssize_t | 95 | ssize_t |
96 | MHD_send_sendfile_ (struct MHD_Connection *connection); | 96 | MHD_send_sendfile_ (struct MHD_Connection *connection); |
97 | |||
97 | #endif | 98 | #endif |
98 | 99 | ||
99 | #endif /* MHD_SEND_H */ | 100 | #endif /* MHD_SEND_H */ |
diff --git a/src/microhttpd/mhd_sockets.c b/src/microhttpd/mhd_sockets.c index ad2f91bc..7172f8ee 100644 --- a/src/microhttpd/mhd_sockets.c +++ b/src/microhttpd/mhd_sockets.c | |||
@@ -37,7 +37,8 @@ | |||
37 | * @param err the WinSock error code. | 37 | * @param err the WinSock error code. |
38 | * @return pointer to string description of specified WinSock error. | 38 | * @return pointer to string description of specified WinSock error. |
39 | */ | 39 | */ |
40 | const char*MHD_W32_strerror_winsock_ (int err) | 40 | const char* |
41 | MHD_W32_strerror_winsock_ (int err) | ||
41 | { | 42 | { |
42 | switch (err) | 43 | switch (err) |
43 | { | 44 | { |
@@ -358,6 +359,7 @@ MHD_W32_socket_pair_ (SOCKET sockets_pair[2], int non_blk) | |||
358 | return 0; | 359 | return 0; |
359 | } | 360 | } |
360 | 361 | ||
362 | |||
361 | #endif /* MHD_WINSOCK_SOCKETS */ | 363 | #endif /* MHD_WINSOCK_SOCKETS */ |
362 | 364 | ||
363 | 365 | ||
@@ -515,7 +517,7 @@ MHD_socket_cork_ (MHD_socket sock, | |||
515 | (const void *) (on ? &on_val : &off_val), | 517 | (const void *) (on ? &on_val : &off_val), |
516 | sizeof (off_val))) | 518 | sizeof (off_val))) |
517 | return 0; /* failed */ | 519 | return 0; /* failed */ |
518 | #if defined(__FreeBSD__) && __FreeBSD__ + 0 >= 9 | 520 | #if defined(__FreeBSD__) && __FreeBSD__ + 0 >= 9 |
519 | /* FreeBSD do not need zero-send for flushing starting from version 9 */ | 521 | /* FreeBSD do not need zero-send for flushing starting from version 9 */ |
520 | return 1; | 522 | return 1; |
521 | #elif defined(TCP_NOPUSH) && ! defined(TCP_CORK) | 523 | #elif defined(TCP_NOPUSH) && ! defined(TCP_CORK) |
diff --git a/src/microhttpd/mhd_sockets.h b/src/microhttpd/mhd_sockets.h index 3099357b..aaf58e4a 100644 --- a/src/microhttpd/mhd_sockets.h +++ b/src/microhttpd/mhd_sockets.h | |||
@@ -554,6 +554,7 @@ typedef int MHD_SCKT_SEND_SIZE_; | |||
554 | * @return pointer to string description of specified WinSock error. | 554 | * @return pointer to string description of specified WinSock error. |
555 | */ | 555 | */ |
556 | const char*MHD_W32_strerror_winsock_ (int err); | 556 | const char*MHD_W32_strerror_winsock_ (int err); |
557 | |||
557 | #endif /* MHD_WINSOCK_SOCKETS */ | 558 | #endif /* MHD_WINSOCK_SOCKETS */ |
558 | 559 | ||
559 | /* MHD_socket_last_strerr_ is description string of specified socket error code */ | 560 | /* MHD_socket_last_strerr_ is description string of specified socket error code */ |
diff --git a/src/microhttpd/mhd_str.c b/src/microhttpd/mhd_str.c index 80f0b82e..08162fb2 100644 --- a/src/microhttpd/mhd_str.c +++ b/src/microhttpd/mhd_str.c | |||
@@ -63,6 +63,8 @@ isasciilower (char c) | |||
63 | { | 63 | { |
64 | return (c >= 'a') && (c <= 'z'); | 64 | return (c >= 'a') && (c <= 'z'); |
65 | } | 65 | } |
66 | |||
67 | |||
66 | #endif /* Disable unused functions. */ | 68 | #endif /* Disable unused functions. */ |
67 | 69 | ||
68 | 70 | ||
@@ -91,6 +93,8 @@ isasciialpha (char c) | |||
91 | { | 93 | { |
92 | return isasciilower (c) || isasciiupper (c); | 94 | return isasciilower (c) || isasciiupper (c); |
93 | } | 95 | } |
96 | |||
97 | |||
94 | #endif /* Disable unused functions. */ | 98 | #endif /* Disable unused functions. */ |
95 | 99 | ||
96 | 100 | ||
@@ -106,6 +110,7 @@ isasciidigit (char c) | |||
106 | return (c >= '0') && (c <= '9'); | 110 | return (c >= '0') && (c <= '9'); |
107 | } | 111 | } |
108 | 112 | ||
113 | |||
109 | #if 0 /* Disable unused functions. */ | 114 | #if 0 /* Disable unused functions. */ |
110 | /** | 115 | /** |
111 | * Check whether character is hexadecimal digit in US-ASCII | 116 | * Check whether character is hexadecimal digit in US-ASCII |
@@ -133,6 +138,8 @@ isasciialnum (char c) | |||
133 | { | 138 | { |
134 | return isasciialpha (c) || isasciidigit (c); | 139 | return isasciialpha (c) || isasciidigit (c); |
135 | } | 140 | } |
141 | |||
142 | |||
136 | #endif /* Disable unused functions. */ | 143 | #endif /* Disable unused functions. */ |
137 | 144 | ||
138 | 145 | ||
@@ -167,6 +174,8 @@ toasciiupper (char c) | |||
167 | { | 174 | { |
168 | return isasciilower (c) ? (c - 'a' + 'A') : c; | 175 | return isasciilower (c) ? (c - 'a' + 'A') : c; |
169 | } | 176 | } |
177 | |||
178 | |||
170 | #endif /* Disable unused functions. */ | 179 | #endif /* Disable unused functions. */ |
171 | 180 | ||
172 | 181 | ||
@@ -185,6 +194,8 @@ todigitvalue (char c) | |||
185 | 194 | ||
186 | return -1; | 195 | return -1; |
187 | } | 196 | } |
197 | |||
198 | |||
188 | #endif /* MHD_FAVOR_SMALL_CODE */ | 199 | #endif /* MHD_FAVOR_SMALL_CODE */ |
189 | 200 | ||
190 | 201 | ||
@@ -206,6 +217,8 @@ toxdigitvalue (char c) | |||
206 | 217 | ||
207 | return -1; | 218 | return -1; |
208 | } | 219 | } |
220 | |||
221 | |||
209 | #else /* !INLINE_FUNC */ | 222 | #else /* !INLINE_FUNC */ |
210 | 223 | ||
211 | 224 | ||
@@ -345,6 +358,8 @@ MHD_str_equal_caseless_ (const char *str1, | |||
345 | } | 358 | } |
346 | return 0 == (*str2); | 359 | return 0 == (*str2); |
347 | } | 360 | } |
361 | |||
362 | |||
348 | #endif /* ! MHD_FAVOR_SMALL_CODE */ | 363 | #endif /* ! MHD_FAVOR_SMALL_CODE */ |
349 | 364 | ||
350 | 365 | ||
@@ -408,7 +423,6 @@ MHD_str_equal_caseless_bin_n_ (const char *const str1, | |||
408 | } | 423 | } |
409 | 424 | ||
410 | 425 | ||
411 | |||
412 | /** | 426 | /** |
413 | * Check whether @a str has case-insensitive @a token. | 427 | * Check whether @a str has case-insensitive @a token. |
414 | * Token could be surrounded by spaces and tabs and delimited by comma. | 428 | * Token could be surrounded by spaces and tabs and delimited by comma. |
@@ -456,7 +470,7 @@ MHD_str_has_token_caseless_ (const char *str, | |||
456 | while (' ' == *str || '\t' == *str) | 470 | while (' ' == *str || '\t' == *str) |
457 | str++; | 471 | str++; |
458 | /* End of (sub)string? */ | 472 | /* End of (sub)string? */ |
459 | if ((0 == *str) ||(',' == *str) ) | 473 | if ((0 == *str) || (',' == *str) ) |
460 | return true; | 474 | return true; |
461 | /* Unmatched chars at end of substring. */ | 475 | /* Unmatched chars at end of substring. */ |
462 | break; | 476 | break; |
@@ -469,6 +483,7 @@ MHD_str_has_token_caseless_ (const char *str, | |||
469 | return false; | 483 | return false; |
470 | } | 484 | } |
471 | 485 | ||
486 | |||
472 | #ifndef MHD_FAVOR_SMALL_CODE | 487 | #ifndef MHD_FAVOR_SMALL_CODE |
473 | /* Use individual function for each case */ | 488 | /* Use individual function for each case */ |
474 | 489 | ||
@@ -583,8 +598,8 @@ MHD_strx_to_uint32_ (const char *str, | |||
583 | while (digit >= 0) | 598 | while (digit >= 0) |
584 | { | 599 | { |
585 | if ( (res < (UINT32_MAX / 16)) || | 600 | if ( (res < (UINT32_MAX / 16)) || |
586 | ((res == (UINT32_MAX / 16)) &&( (uint32_t) digit <= (UINT32_MAX | 601 | ((res == (UINT32_MAX / 16)) && ( (uint32_t) digit <= (UINT32_MAX |
587 | % 16)) ) ) | 602 | % 16)) ) ) |
588 | { | 603 | { |
589 | res *= 16; | 604 | res *= 16; |
590 | res += digit; | 605 | res += digit; |
@@ -630,8 +645,8 @@ MHD_strx_to_uint32_n_ (const char *str, | |||
630 | while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0) | 645 | while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0) |
631 | { | 646 | { |
632 | if ( (res > (UINT32_MAX / 16)) || | 647 | if ( (res > (UINT32_MAX / 16)) || |
633 | ((res == (UINT32_MAX / 16)) &&( (uint32_t) digit > (UINT32_MAX | 648 | ((res == (UINT32_MAX / 16)) && ( (uint32_t) digit > (UINT32_MAX |
634 | % 16)) ) ) | 649 | % 16)) ) ) |
635 | return 0; | 650 | return 0; |
636 | 651 | ||
637 | res *= 16; | 652 | res *= 16; |
@@ -670,8 +685,8 @@ MHD_strx_to_uint64_ (const char *str, | |||
670 | while (digit >= 0) | 685 | while (digit >= 0) |
671 | { | 686 | { |
672 | if ( (res < (UINT64_MAX / 16)) || | 687 | if ( (res < (UINT64_MAX / 16)) || |
673 | ((res == (UINT64_MAX / 16)) &&( (uint64_t) digit <= (UINT64_MAX | 688 | ((res == (UINT64_MAX / 16)) && ( (uint64_t) digit <= (UINT64_MAX |
674 | % 16)) ) ) | 689 | % 16)) ) ) |
675 | { | 690 | { |
676 | res *= 16; | 691 | res *= 16; |
677 | res += digit; | 692 | res += digit; |
@@ -717,8 +732,8 @@ MHD_strx_to_uint64_n_ (const char *str, | |||
717 | while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0) | 732 | while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0) |
718 | { | 733 | { |
719 | if ( (res > (UINT64_MAX / 16)) || | 734 | if ( (res > (UINT64_MAX / 16)) || |
720 | ((res == (UINT64_MAX / 16)) &&( (uint64_t) digit > (UINT64_MAX | 735 | ((res == (UINT64_MAX / 16)) && ( (uint64_t) digit > (UINT64_MAX |
721 | % 16)) ) ) | 736 | % 16)) ) ) |
722 | return 0; | 737 | return 0; |
723 | 738 | ||
724 | res *= 16; | 739 | res *= 16; |
@@ -731,6 +746,7 @@ MHD_strx_to_uint64_n_ (const char *str, | |||
731 | return i; | 746 | return i; |
732 | } | 747 | } |
733 | 748 | ||
749 | |||
734 | #else /* MHD_FAVOR_SMALL_CODE */ | 750 | #else /* MHD_FAVOR_SMALL_CODE */ |
735 | 751 | ||
736 | /** | 752 | /** |
@@ -767,8 +783,8 @@ MHD_str_to_uvalue_n_ (const char *str, | |||
767 | int (*const dfunc)(char) = (base == 16) ? | 783 | int (*const dfunc)(char) = (base == 16) ? |
768 | toxdigitvalue : todigitvalue; | 784 | toxdigitvalue : todigitvalue; |
769 | 785 | ||
770 | if ( ! str || ! out_val || | 786 | if (! str || ! out_val || |
771 | ((base != 16)&&(base != 10)) ) | 787 | ((base != 16) && (base != 10)) ) |
772 | return 0; | 788 | return 0; |
773 | 789 | ||
774 | res = 0; | 790 | res = 0; |
@@ -776,7 +792,7 @@ MHD_str_to_uvalue_n_ (const char *str, | |||
776 | while (maxlen > i && 0 <= (digit = dfunc (str[i]))) | 792 | while (maxlen > i && 0 <= (digit = dfunc (str[i]))) |
777 | { | 793 | { |
778 | if ( ((max_v_div_b) < res) || | 794 | if ( ((max_v_div_b) < res) || |
779 | (( (max_v_div_b) == res) &&( (max_v_mod_b) < (uint64_t) digit) ) ) | 795 | (( (max_v_div_b) == res) && ( (max_v_mod_b) < (uint64_t) digit) ) ) |
780 | return 0; | 796 | return 0; |
781 | 797 | ||
782 | res *= base; | 798 | res *= base; |
@@ -795,4 +811,6 @@ MHD_str_to_uvalue_n_ (const char *str, | |||
795 | } | 811 | } |
796 | return i; | 812 | return i; |
797 | } | 813 | } |
814 | |||
815 | |||
798 | #endif /* MHD_FAVOR_SMALL_CODE */ | 816 | #endif /* MHD_FAVOR_SMALL_CODE */ |
diff --git a/src/microhttpd/mhd_str.h b/src/microhttpd/mhd_str.h index dd379f52..25eeb05e 100644 --- a/src/microhttpd/mhd_str.h +++ b/src/microhttpd/mhd_str.h | |||
@@ -60,6 +60,7 @@ | |||
60 | int | 60 | int |
61 | MHD_str_equal_caseless_ (const char *str1, | 61 | MHD_str_equal_caseless_ (const char *str1, |
62 | const char *str2); | 62 | const char *str2); |
63 | |||
63 | #else /* MHD_FAVOR_SMALL_CODE */ | 64 | #else /* MHD_FAVOR_SMALL_CODE */ |
64 | /* Reuse MHD_str_equal_caseless_n_() to reduce size */ | 65 | /* Reuse MHD_str_equal_caseless_n_() to reduce size */ |
65 | #define MHD_str_equal_caseless_(s1,s2) MHD_str_equal_caseless_n_ ((s1),(s2), \ | 66 | #define MHD_str_equal_caseless_(s1,s2) MHD_str_equal_caseless_n_ ((s1),(s2), \ |
diff --git a/src/microhttpd/mhd_threads.c b/src/microhttpd/mhd_threads.c index 6be4cb44..6e96f860 100644 --- a/src/microhttpd/mhd_threads.c +++ b/src/microhttpd/mhd_threads.c | |||
@@ -80,8 +80,7 @@ MHD_set_thread_name_ (const MHD_thread_ID_ thread_id, | |||
80 | * third argument is single argument for printf; | 80 | * third argument is single argument for printf; |
81 | * OSF1 use 3 arguments too, but last one always must be zero (NULL). | 81 | * OSF1 use 3 arguments too, but last one always must be zero (NULL). |
82 | * MHD doesn't use '%' in thread names, so both form are used in same way. | 82 | * MHD doesn't use '%' in thread names, so both form are used in same way. |
83 | */ | 83 | */return ! pthread_setname_np (thread_id, thread_name, 0); |
84 | return ! pthread_setname_np (thread_id, thread_name, 0); | ||
85 | #endif /* HAVE_PTHREAD_SETNAME_NP_NETBSD */ | 84 | #endif /* HAVE_PTHREAD_SETNAME_NP_NETBSD */ |
86 | } | 85 | } |
87 | 86 | ||
@@ -235,6 +234,7 @@ MHD_create_thread_ (MHD_thread_handle_ID_ *thread, | |||
235 | #endif | 234 | #endif |
236 | } | 235 | } |
237 | 236 | ||
237 | |||
238 | #ifdef MHD_USE_THREAD_NAME_ | 238 | #ifdef MHD_USE_THREAD_NAME_ |
239 | 239 | ||
240 | #ifndef MHD_USE_THREAD_ATTR_SETNAME | 240 | #ifndef MHD_USE_THREAD_ATTR_SETNAME |
@@ -276,6 +276,8 @@ named_thread_starter (void *data) | |||
276 | 276 | ||
277 | return thr_func (arg); | 277 | return thr_func (arg); |
278 | } | 278 | } |
279 | |||
280 | |||
279 | #endif /* ! MHD_USE_THREAD_ATTR_SETNAME */ | 281 | #endif /* ! MHD_USE_THREAD_ATTR_SETNAME */ |
280 | 282 | ||
281 | 283 | ||
@@ -308,8 +310,7 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread, | |||
308 | * third argument is single argument for printf; | 310 | * third argument is single argument for printf; |
309 | * OSF1 use 3 arguments too, but last one always must be zero (NULL). | 311 | * OSF1 use 3 arguments too, but last one always must be zero (NULL). |
310 | * MHD doesn't use '%' in thread names, so both form are used in same way. | 312 | * MHD doesn't use '%' in thread names, so both form are used in same way. |
311 | */ | 313 | */res = pthread_attr_setname_np (&attr, |
312 | res = pthread_attr_setname_np (&attr, | ||
313 | thread_name, | 314 | thread_name, |
314 | 0); | 315 | 0); |
315 | #elif defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) | 316 | #elif defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) |
@@ -318,7 +319,7 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread, | |||
318 | #else | 319 | #else |
319 | #error No pthread_attr_setname_np() function. | 320 | #error No pthread_attr_setname_np() function. |
320 | #endif | 321 | #endif |
321 | if ((res == 0) &&(0 != stack_size) ) | 322 | if ((res == 0) && (0 != stack_size) ) |
322 | res = pthread_attr_setstacksize (&attr, | 323 | res = pthread_attr_setstacksize (&attr, |
323 | stack_size); | 324 | stack_size); |
324 | if (0 == res) | 325 | if (0 == res) |
@@ -365,4 +366,5 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread, | |||
365 | #endif /* ! MHD_USE_THREAD_ATTR_SETNAME */ | 366 | #endif /* ! MHD_USE_THREAD_ATTR_SETNAME */ |
366 | } | 367 | } |
367 | 368 | ||
369 | |||
368 | #endif /* MHD_USE_THREAD_NAME_ */ | 370 | #endif /* MHD_USE_THREAD_NAME_ */ |
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c index 8b6a33ea..a7548ae3 100644 --- a/src/microhttpd/postprocessor.c +++ b/src/microhttpd/postprocessor.c | |||
@@ -1013,8 +1013,7 @@ post_process_multipart (struct MHD_PostProcessor *pp, | |||
1013 | * > generally be left blank, and implementations must ignore | 1013 | * > generally be left blank, and implementations must ignore |
1014 | * > anything that appears before the first boundary delimiter | 1014 | * > anything that appears before the first boundary delimiter |
1015 | * > line or after the last one. | 1015 | * > line or after the last one. |
1016 | */ | 1016 | */(void) find_boundary (pp, |
1017 | (void) find_boundary (pp, | ||
1018 | pp->boundary, | 1017 | pp->boundary, |
1019 | pp->blen, | 1018 | pp->blen, |
1020 | &ioff, | 1019 | &ioff, |
@@ -1290,4 +1289,5 @@ MHD_destroy_post_processor (struct MHD_PostProcessor *pp) | |||
1290 | return ret; | 1289 | return ret; |
1291 | } | 1290 | } |
1292 | 1291 | ||
1292 | |||
1293 | /* end of postprocessor.c */ | 1293 | /* end of postprocessor.c */ |
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c index 968fc8c9..5adfdfa9 100644 --- a/src/microhttpd/response.c +++ b/src/microhttpd/response.c | |||
@@ -541,6 +541,7 @@ free_callback (void *cls) | |||
541 | response->fd = -1; | 541 | response->fd = -1; |
542 | } | 542 | } |
543 | 543 | ||
544 | |||
544 | #undef MHD_create_response_from_fd_at_offset | 545 | #undef MHD_create_response_from_fd_at_offset |
545 | 546 | ||
546 | /** | 547 | /** |
@@ -1195,6 +1196,8 @@ MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, | |||
1195 | } | 1196 | } |
1196 | return response; | 1197 | return response; |
1197 | } | 1198 | } |
1199 | |||
1200 | |||
1198 | #endif /* UPGRADE_SUPPORT */ | 1201 | #endif /* UPGRADE_SUPPORT */ |
1199 | 1202 | ||
1200 | 1203 | ||
diff --git a/src/microhttpd/sha256.c b/src/microhttpd/sha256.c index 846a43b7..908bbda2 100644 --- a/src/microhttpd/sha256.c +++ b/src/microhttpd/sha256.c | |||
@@ -62,6 +62,7 @@ MHD_SHA256_init (void *ctx_) | |||
62 | ctx->count = 0; | 62 | ctx->count = 0; |
63 | } | 63 | } |
64 | 64 | ||
65 | |||
65 | /** | 66 | /** |
66 | * Number of bytes in single SHA-256 word | 67 | * Number of bytes in single SHA-256 word |
67 | * used to process data | 68 | * used to process data |
@@ -246,6 +247,7 @@ sha256_transform (uint32_t H[_SHA256_DIGEST_LENGTH], | |||
246 | H[7] += h; | 247 | H[7] += h; |
247 | } | 248 | } |
248 | 249 | ||
250 | |||
249 | /** | 251 | /** |
250 | * Process portion of bytes. | 252 | * Process portion of bytes. |
251 | * | 253 | * |
diff --git a/src/microhttpd/test_helpers.h b/src/microhttpd/test_helpers.h index d47f7168..993d0718 100644 --- a/src/microhttpd/test_helpers.h +++ b/src/microhttpd/test_helpers.h | |||
@@ -64,6 +64,7 @@ has_in_name (const char *prog_name, const char *marker) | |||
64 | return strstr (prog_name + name_pos, marker) != (char*) 0; | 64 | return strstr (prog_name + name_pos, marker) != (char*) 0; |
65 | } | 65 | } |
66 | 66 | ||
67 | |||
67 | /** | 68 | /** |
68 | * Check whether one of strings in array is equal to @a param. | 69 | * Check whether one of strings in array is equal to @a param. |
69 | * String @a argv[0] is ignored. | 70 | * String @a argv[0] is ignored. |
@@ -83,7 +84,7 @@ has_param (int argc, char *const argv[], const char *param) | |||
83 | 84 | ||
84 | for (i = 1; i < argc; i++) | 85 | for (i = 1; i < argc; i++) |
85 | { | 86 | { |
86 | if (argv[i] &&(strcmp (argv[i], param) == 0) ) | 87 | if (argv[i] && (strcmp (argv[i], param) == 0) ) |
87 | return ! 0; | 88 | return ! 0; |
88 | } | 89 | } |
89 | 90 | ||
diff --git a/src/microhttpd/test_http_reasons.c b/src/microhttpd/test_http_reasons.c index 4d0484ad..7c2c3efd 100644 --- a/src/microhttpd/test_http_reasons.c +++ b/src/microhttpd/test_http_reasons.c | |||
@@ -28,7 +28,8 @@ | |||
28 | #include "microhttpd.h" | 28 | #include "microhttpd.h" |
29 | #include "mhd_str.h" | 29 | #include "mhd_str.h" |
30 | 30 | ||
31 | static int expect_result (int code, const char*expected) | 31 | static int |
32 | expect_result (int code, const char*expected) | ||
32 | { | 33 | { |
33 | const char*const reason = MHD_get_reason_phrase_for (code); | 34 | const char*const reason = MHD_get_reason_phrase_for (code); |
34 | if (MHD_str_equal_caseless_ (reason, expected)) | 35 | if (MHD_str_equal_caseless_ (reason, expected)) |
@@ -39,12 +40,16 @@ static int expect_result (int code, const char*expected) | |||
39 | return 1; | 40 | return 1; |
40 | } | 41 | } |
41 | 42 | ||
42 | static int expect_absent (int code) | 43 | |
44 | static int | ||
45 | expect_absent (int code) | ||
43 | { | 46 | { |
44 | return expect_result (code, "unknown"); | 47 | return expect_result (code, "unknown"); |
45 | } | 48 | } |
46 | 49 | ||
47 | static int test_absent_codes (void) | 50 | |
51 | static int | ||
52 | test_absent_codes (void) | ||
48 | { | 53 | { |
49 | int errcount = 0; | 54 | int errcount = 0; |
50 | errcount += expect_absent (0); | 55 | errcount += expect_absent (0); |
@@ -58,7 +63,9 @@ static int test_absent_codes (void) | |||
58 | return errcount; | 63 | return errcount; |
59 | } | 64 | } |
60 | 65 | ||
61 | static int test_1xx (void) | 66 | |
67 | static int | ||
68 | test_1xx (void) | ||
62 | { | 69 | { |
63 | int errcount = 0; | 70 | int errcount = 0; |
64 | errcount += expect_result (MHD_HTTP_CONTINUE, "continue"); | 71 | errcount += expect_result (MHD_HTTP_CONTINUE, "continue"); |
@@ -68,7 +75,9 @@ static int test_1xx (void) | |||
68 | return errcount; | 75 | return errcount; |
69 | } | 76 | } |
70 | 77 | ||
71 | static int test_2xx (void) | 78 | |
79 | static int | ||
80 | test_2xx (void) | ||
72 | { | 81 | { |
73 | int errcount = 0; | 82 | int errcount = 0; |
74 | errcount += expect_result (MHD_HTTP_OK, "ok"); | 83 | errcount += expect_result (MHD_HTTP_OK, "ok"); |
@@ -80,7 +89,9 @@ static int test_2xx (void) | |||
80 | return errcount; | 89 | return errcount; |
81 | } | 90 | } |
82 | 91 | ||
83 | static int test_3xx (void) | 92 | |
93 | static int | ||
94 | test_3xx (void) | ||
84 | { | 95 | { |
85 | int errcount = 0; | 96 | int errcount = 0; |
86 | errcount += expect_result (MHD_HTTP_MULTIPLE_CHOICES, "multiple choices"); | 97 | errcount += expect_result (MHD_HTTP_MULTIPLE_CHOICES, "multiple choices"); |
@@ -91,7 +102,9 @@ static int test_3xx (void) | |||
91 | return errcount; | 102 | return errcount; |
92 | } | 103 | } |
93 | 104 | ||
94 | static int test_4xx (void) | 105 | |
106 | static int | ||
107 | test_4xx (void) | ||
95 | { | 108 | { |
96 | int errcount = 0; | 109 | int errcount = 0; |
97 | errcount += expect_result (MHD_HTTP_BAD_REQUEST, "bad request"); | 110 | errcount += expect_result (MHD_HTTP_BAD_REQUEST, "bad request"); |
@@ -108,7 +121,9 @@ static int test_4xx (void) | |||
108 | return errcount; | 121 | return errcount; |
109 | } | 122 | } |
110 | 123 | ||
111 | static int test_5xx (void) | 124 | |
125 | static int | ||
126 | test_5xx (void) | ||
112 | { | 127 | { |
113 | int errcount = 0; | 128 | int errcount = 0; |
114 | errcount += expect_result (MHD_HTTP_INTERNAL_SERVER_ERROR, | 129 | errcount += expect_result (MHD_HTTP_INTERNAL_SERVER_ERROR, |
@@ -123,7 +138,9 @@ static int test_5xx (void) | |||
123 | return errcount; | 138 | return errcount; |
124 | } | 139 | } |
125 | 140 | ||
126 | int main (int argc, char *argv[]) | 141 | |
142 | int | ||
143 | main (int argc, char *argv[]) | ||
127 | { | 144 | { |
128 | int errcount = 0; | 145 | int errcount = 0; |
129 | (void) argc; (void) argv; /* Unused. Silent compiler warning. */ | 146 | (void) argc; (void) argv; /* Unused. Silent compiler warning. */ |
diff --git a/src/microhttpd/test_options.c b/src/microhttpd/test_options.c index be033ae8..0c0825f1 100644 --- a/src/microhttpd/test_options.c +++ b/src/microhttpd/test_options.c | |||
@@ -56,6 +56,7 @@ ahc_echo (void *cls, | |||
56 | return 0; | 56 | return 0; |
57 | } | 57 | } |
58 | 58 | ||
59 | |||
59 | static int | 60 | static int |
60 | test_wrap_loc (char *test_name, int (*test)(void)) | 61 | test_wrap_loc (char *test_name, int (*test)(void)) |
61 | { | 62 | { |
@@ -122,6 +123,7 @@ test_ip_addr_option () | |||
122 | return 0; | 123 | return 0; |
123 | } | 124 | } |
124 | 125 | ||
126 | |||
125 | /* setup a temporary transfer test file */ | 127 | /* setup a temporary transfer test file */ |
126 | int | 128 | int |
127 | main (int argc, char *const *argv) | 129 | main (int argc, char *const *argv) |
diff --git a/src/microhttpd/test_postprocessor.c b/src/microhttpd/test_postprocessor.c index e1a167e7..75b5ba33 100644 --- a/src/microhttpd/test_postprocessor.c +++ b/src/microhttpd/test_postprocessor.c | |||
@@ -82,6 +82,7 @@ mismatch (const char *a, const char *b) | |||
82 | return 0 != strcmp (a, b); | 82 | return 0 != strcmp (a, b); |
83 | } | 83 | } |
84 | 84 | ||
85 | |||
85 | static int | 86 | static int |
86 | value_checker (void *cls, | 87 | value_checker (void *cls, |
87 | enum MHD_ValueKind kind, | 88 | enum MHD_ValueKind kind, |
@@ -347,8 +348,6 @@ test_empty_value (void) | |||
347 | } | 348 | } |
348 | 349 | ||
349 | 350 | ||
350 | |||
351 | |||
352 | int | 351 | int |
353 | main (int argc, char *const *argv) | 352 | main (int argc, char *const *argv) |
354 | { | 353 | { |
diff --git a/src/microhttpd/test_postprocessor_amp.c b/src/microhttpd/test_postprocessor_amp.c index e2ea4a54..54936979 100644 --- a/src/microhttpd/test_postprocessor_amp.c +++ b/src/microhttpd/test_postprocessor_amp.c | |||
@@ -7,10 +7,11 @@ | |||
7 | 7 | ||
8 | uint64_t num_errors; | 8 | uint64_t num_errors; |
9 | 9 | ||
10 | int check_post (void *cls, enum MHD_ValueKind kind, const char*key, | 10 | int |
11 | const char*filename, const char*content_type, | 11 | check_post (void *cls, enum MHD_ValueKind kind, const char*key, |
12 | const char*content_encoding, const char*data, | 12 | const char*filename, const char*content_type, |
13 | uint64_t off, size_t size) | 13 | const char*content_encoding, const char*data, |
14 | uint64_t off, size_t size) | ||
14 | { | 15 | { |
15 | (void) cls; (void) kind; (void) filename; (void) content_type; /* Unused. Silent compiler warning. */ | 16 | (void) cls; (void) kind; (void) filename; (void) content_type; /* Unused. Silent compiler warning. */ |
16 | (void) content_encoding; (void) data; (void) off; (void) size; /* Unused. Silent compiler warning. */ | 17 | (void) content_encoding; (void) data; (void) off; (void) size; /* Unused. Silent compiler warning. */ |
diff --git a/src/microhttpd/test_postprocessor_large.c b/src/microhttpd/test_postprocessor_large.c index 68e5f671..0e2a10d2 100644 --- a/src/microhttpd/test_postprocessor_large.c +++ b/src/microhttpd/test_postprocessor_large.c | |||
@@ -98,6 +98,7 @@ test_simple_large () | |||
98 | return 0; | 98 | return 0; |
99 | } | 99 | } |
100 | 100 | ||
101 | |||
101 | int | 102 | int |
102 | main (int argc, char *const *argv) | 103 | main (int argc, char *const *argv) |
103 | { | 104 | { |
diff --git a/src/microhttpd/test_sha256.c b/src/microhttpd/test_sha256.c index da6f6e1f..54cdf027 100644 --- a/src/microhttpd/test_sha256.c +++ b/src/microhttpd/test_sha256.c | |||
@@ -285,6 +285,7 @@ bin2hex (const uint8_t *bin, | |||
285 | *hex = 0; | 285 | *hex = 0; |
286 | } | 286 | } |
287 | 287 | ||
288 | |||
288 | static int | 289 | static int |
289 | check_result (const char *test_name, | 290 | check_result (const char *test_name, |
290 | unsigned int check_num, | 291 | unsigned int check_num, |
@@ -365,6 +366,7 @@ test1_bin (void) | |||
365 | return num_failed; | 366 | return num_failed; |
366 | } | 367 | } |
367 | 368 | ||
369 | |||
368 | /* Calculated SHA-256 as two iterations for whole data */ | 370 | /* Calculated SHA-256 as two iterations for whole data */ |
369 | static int | 371 | static int |
370 | test2_str (void) | 372 | test2_str (void) |
diff --git a/src/microhttpd/test_shutdown_select.c b/src/microhttpd/test_shutdown_select.c index ae88658d..121c38cc 100644 --- a/src/microhttpd/test_shutdown_select.c +++ b/src/microhttpd/test_shutdown_select.c | |||
@@ -255,6 +255,8 @@ poll_thread (void*data) | |||
255 | 255 | ||
256 | return (MHD_THRD_RTRN_TYPE_) 0; | 256 | return (MHD_THRD_RTRN_TYPE_) 0; |
257 | } | 257 | } |
258 | |||
259 | |||
258 | #endif /* HAVE_POLL */ | 260 | #endif /* HAVE_POLL */ |
259 | 261 | ||
260 | 262 | ||
@@ -306,7 +308,7 @@ main (int argc, char *const *argv) | |||
306 | ver_req = MAKEWORD (2, 2); | 308 | ver_req = MAKEWORD (2, 2); |
307 | 309 | ||
308 | err = WSAStartup (ver_req, &wsa_data); | 310 | err = WSAStartup (ver_req, &wsa_data); |
309 | if ((err != 0)||(MAKEWORD (2, 2) != wsa_data.wVersion)) | 311 | if ((err != 0) || (MAKEWORD (2, 2) != wsa_data.wVersion)) |
310 | { | 312 | { |
311 | printf ("WSAStartup() failed\n"); | 313 | printf ("WSAStartup() failed\n"); |
312 | WSACleanup (); | 314 | WSACleanup (); |
@@ -370,7 +372,7 @@ main (int argc, char *const *argv) | |||
370 | /* fprintf (stdout, "Thread finished.\n"); */ | 372 | /* fprintf (stdout, "Thread finished.\n"); */ |
371 | MHD_socket_close_chk_ (listen_socket); | 373 | MHD_socket_close_chk_ (listen_socket); |
372 | 374 | ||
373 | if ((start_t == (time_t) -1) ||(end_t == (time_t) -1) ) | 375 | if ((start_t == (time_t) -1) || (end_t == (time_t) -1) ) |
374 | { | 376 | { |
375 | MHD_socket_close_chk_ (listen_socket); | 377 | MHD_socket_close_chk_ (listen_socket); |
376 | fprintf (stderr, "Can't get current time\n"); | 378 | fprintf (stderr, "Can't get current time\n"); |
diff --git a/src/microhttpd/test_start_stop.c b/src/microhttpd/test_start_stop.c index 541cc5c5..c2f1781b 100644 --- a/src/microhttpd/test_start_stop.c +++ b/src/microhttpd/test_start_stop.c | |||
@@ -67,6 +67,7 @@ testInternalGet (int poll_flag) | |||
67 | return 0; | 67 | return 0; |
68 | } | 68 | } |
69 | 69 | ||
70 | |||
70 | static int | 71 | static int |
71 | testMultithreadedGet (int poll_flag) | 72 | testMultithreadedGet (int poll_flag) |
72 | { | 73 | { |
@@ -97,6 +98,8 @@ testMultithreadedPoolGet (int poll_flag) | |||
97 | MHD_stop_daemon (d); | 98 | MHD_stop_daemon (d); |
98 | return 0; | 99 | return 0; |
99 | } | 100 | } |
101 | |||
102 | |||
100 | #endif | 103 | #endif |
101 | 104 | ||
102 | 105 | ||
diff --git a/src/microhttpd/test_str.c b/src/microhttpd/test_str.c index 8739a23a..a2f357b4 100644 --- a/src/microhttpd/test_str.c +++ b/src/microhttpd/test_str.c | |||
@@ -208,7 +208,8 @@ static const unsigned int locale_name_count = sizeof(locale_names) | |||
208 | * Helper functions | 208 | * Helper functions |
209 | */ | 209 | */ |
210 | 210 | ||
211 | int set_test_locale (unsigned int num) | 211 | int |
212 | set_test_locale (unsigned int num) | ||
212 | { | 213 | { |
213 | if (num >= locale_name_count) | 214 | if (num >= locale_name_count) |
214 | return -1; | 215 | return -1; |
@@ -225,17 +226,21 @@ int set_test_locale (unsigned int num) | |||
225 | return 0; | 226 | return 0; |
226 | } | 227 | } |
227 | 228 | ||
228 | const char *get_current_locale_str (void) | 229 | |
230 | const char * | ||
231 | get_current_locale_str (void) | ||
229 | { | 232 | { |
230 | char const *loc_str = setlocale (LC_ALL, NULL); | 233 | char const *loc_str = setlocale (LC_ALL, NULL); |
231 | return loc_str ? loc_str : "unknown"; | 234 | return loc_str ? loc_str : "unknown"; |
232 | } | 235 | } |
233 | 236 | ||
237 | |||
234 | static char tmp_bufs[4][4 * 1024]; /* should be enough for testing */ | 238 | static char tmp_bufs[4][4 * 1024]; /* should be enough for testing */ |
235 | static size_t buf_idx = 0; | 239 | static size_t buf_idx = 0; |
236 | 240 | ||
237 | /* print non-printable chars as char codes */ | 241 | /* print non-printable chars as char codes */ |
238 | char *n_prnt (const char *str) | 242 | char * |
243 | n_prnt (const char *str) | ||
239 | { | 244 | { |
240 | static char *buf; /* should be enough for testing */ | 245 | static char *buf; /* should be enough for testing */ |
241 | static const size_t buf_size = sizeof(tmp_bufs[0]); | 246 | static const size_t buf_size = sizeof(tmp_bufs[0]); |
@@ -248,14 +253,14 @@ char *n_prnt (const char *str) | |||
248 | while (*p && w_pos + 1 < buf_size) | 253 | while (*p && w_pos + 1 < buf_size) |
249 | { | 254 | { |
250 | const unsigned char c = *p; | 255 | const unsigned char c = *p; |
251 | if ((c == '\\') ||(c == '"') ) | 256 | if ((c == '\\') || (c == '"') ) |
252 | { | 257 | { |
253 | if (w_pos + 2 >= buf_size) | 258 | if (w_pos + 2 >= buf_size) |
254 | break; | 259 | break; |
255 | buf[w_pos++] = '\\'; | 260 | buf[w_pos++] = '\\'; |
256 | buf[w_pos++] = c; | 261 | buf[w_pos++] = c; |
257 | } | 262 | } |
258 | else if ((c >= 0x20) &&(c <= 0x7E) ) | 263 | else if ((c >= 0x20) && (c <= 0x7E) ) |
259 | buf[w_pos++] = c; | 264 | buf[w_pos++] = c; |
260 | else | 265 | else |
261 | { | 266 | { |
@@ -497,7 +502,8 @@ static const struct two_neq_strs neq_strings[] = { | |||
497 | }; | 502 | }; |
498 | 503 | ||
499 | 504 | ||
500 | int check_eq_strings (void) | 505 | int |
506 | check_eq_strings (void) | ||
501 | { | 507 | { |
502 | size_t t_failed = 0; | 508 | size_t t_failed = 0; |
503 | size_t i, j; | 509 | size_t i, j; |
@@ -532,7 +538,7 @@ int check_eq_strings (void) | |||
532 | " Locale: %s\n", n_prnt (t->s2.str), n_prnt (t->s1.str), | 538 | " Locale: %s\n", n_prnt (t->s2.str), n_prnt (t->s1.str), |
533 | get_current_locale_str ()); | 539 | get_current_locale_str ()); |
534 | } | 540 | } |
535 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 541 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
536 | printf ("PASSED: MHD_str_equal_caseless_(\"%s\", \"%s\") != 0 && \\\n" | 542 | printf ("PASSED: MHD_str_equal_caseless_(\"%s\", \"%s\") != 0 && \\\n" |
537 | " MHD_str_equal_caseless_(\"%s\", \"%s\") != 0\n", | 543 | " MHD_str_equal_caseless_(\"%s\", \"%s\") != 0\n", |
538 | n_prnt (t->s1.str), n_prnt (t->s2.str), | 544 | n_prnt (t->s1.str), n_prnt (t->s2.str), |
@@ -542,7 +548,9 @@ int check_eq_strings (void) | |||
542 | return t_failed; | 548 | return t_failed; |
543 | } | 549 | } |
544 | 550 | ||
545 | int check_neq_strings (void) | 551 | |
552 | int | ||
553 | check_neq_strings (void) | ||
546 | { | 554 | { |
547 | size_t t_failed = 0; | 555 | size_t t_failed = 0; |
548 | size_t i, j; | 556 | size_t i, j; |
@@ -577,7 +585,7 @@ int check_neq_strings (void) | |||
577 | " Locale: %s\n", n_prnt (t->s2.str), n_prnt (t->s1.str), | 585 | " Locale: %s\n", n_prnt (t->s2.str), n_prnt (t->s1.str), |
578 | get_current_locale_str ()); | 586 | get_current_locale_str ()); |
579 | } | 587 | } |
580 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 588 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
581 | printf ("PASSED: MHD_str_equal_caseless_(\"%s\", \"%s\") == 0 && \\\n" | 589 | printf ("PASSED: MHD_str_equal_caseless_(\"%s\", \"%s\") == 0 && \\\n" |
582 | " MHD_str_equal_caseless_(\"%s\", \"%s\") == 0\n", | 590 | " MHD_str_equal_caseless_(\"%s\", \"%s\") == 0\n", |
583 | n_prnt (t->s1.str), n_prnt (t->s2.str), | 591 | n_prnt (t->s1.str), n_prnt (t->s2.str), |
@@ -587,7 +595,9 @@ int check_neq_strings (void) | |||
587 | return t_failed; | 595 | return t_failed; |
588 | } | 596 | } |
589 | 597 | ||
590 | int check_eq_strings_n (void) | 598 | |
599 | int | ||
600 | check_eq_strings_n (void) | ||
591 | { | 601 | { |
592 | size_t t_failed = 0; | 602 | size_t t_failed = 0; |
593 | size_t i, j, k; | 603 | size_t i, j, k; |
@@ -627,7 +637,7 @@ int check_eq_strings_n (void) | |||
627 | get_current_locale_str ()); | 637 | get_current_locale_str ()); |
628 | } | 638 | } |
629 | } | 639 | } |
630 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 640 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
631 | printf ( | 641 | printf ( |
632 | "PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0 && \\\n" | 642 | "PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0 && \\\n" |
633 | " MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0, where N is 0..%u\n", | 643 | " MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0, where N is 0..%u\n", |
@@ -638,7 +648,9 @@ int check_eq_strings_n (void) | |||
638 | return t_failed; | 648 | return t_failed; |
639 | } | 649 | } |
640 | 650 | ||
641 | int check_neq_strings_n (void) | 651 | |
652 | int | ||
653 | check_neq_strings_n (void) | ||
642 | { | 654 | { |
643 | size_t t_failed = 0; | 655 | size_t t_failed = 0; |
644 | size_t i, j, k; | 656 | size_t i, j, k; |
@@ -732,7 +744,7 @@ int check_neq_strings_n (void) | |||
732 | } | 744 | } |
733 | } | 745 | } |
734 | } | 746 | } |
735 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 747 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
736 | { | 748 | { |
737 | printf ( | 749 | printf ( |
738 | "PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0 && \\\n" | 750 | "PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0 && \\\n" |
@@ -753,10 +765,12 @@ int check_neq_strings_n (void) | |||
753 | return t_failed; | 765 | return t_failed; |
754 | } | 766 | } |
755 | 767 | ||
768 | |||
756 | /* | 769 | /* |
757 | * Run eq/neq strings tests | 770 | * Run eq/neq strings tests |
758 | */ | 771 | */ |
759 | int run_eq_neq_str_tests (void) | 772 | int |
773 | run_eq_neq_str_tests (void) | ||
760 | { | 774 | { |
761 | int str_equal_caseless_fails = 0; | 775 | int str_equal_caseless_fails = 0; |
762 | int str_equal_caseless_n_fails = 0; | 776 | int str_equal_caseless_n_fails = 0; |
@@ -851,6 +865,7 @@ int run_eq_neq_str_tests (void) | |||
851 | return 0; | 865 | return 0; |
852 | } | 866 | } |
853 | 867 | ||
868 | |||
854 | /* | 869 | /* |
855 | * Digits in string -> value tests | 870 | * Digits in string -> value tests |
856 | */ | 871 | */ |
@@ -1118,7 +1133,8 @@ const struct str_with_len strx_ovflw[] = { | |||
1118 | }; | 1133 | }; |
1119 | 1134 | ||
1120 | 1135 | ||
1121 | int check_str_to_uint64_valid (void) | 1136 | int |
1137 | check_str_to_uint64_valid (void) | ||
1122 | { | 1138 | { |
1123 | size_t t_failed = 0; | 1139 | size_t t_failed = 0; |
1124 | size_t i, j; | 1140 | size_t i, j; |
@@ -1175,7 +1191,7 @@ int check_str_to_uint64_valid (void) | |||
1175 | t->str.str), rv, rv, | 1191 | t->str.str), rv, rv, |
1176 | t->val, get_current_locale_str ()); | 1192 | t->val, get_current_locale_str ()); |
1177 | } | 1193 | } |
1178 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 1194 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
1179 | printf ( | 1195 | printf ( |
1180 | "PASSED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") == %" PRIuPTR "\n", | 1196 | "PASSED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") == %" PRIuPTR "\n", |
1181 | n_prnt (t->str.str), rv, rs); | 1197 | n_prnt (t->str.str), rv, rs); |
@@ -1185,7 +1201,8 @@ int check_str_to_uint64_valid (void) | |||
1185 | } | 1201 | } |
1186 | 1202 | ||
1187 | 1203 | ||
1188 | int check_str_to_uint64_all_chars (void) | 1204 | int |
1205 | check_str_to_uint64_all_chars (void) | ||
1189 | { | 1206 | { |
1190 | static const size_t n_checks = 256; /* from 0 to 255 */ | 1207 | static const size_t n_checks = 256; /* from 0 to 255 */ |
1191 | int c_failed[n_checks]; | 1208 | int c_failed[n_checks]; |
@@ -1204,9 +1221,9 @@ int check_str_to_uint64_all_chars (void) | |||
1204 | { | 1221 | { |
1205 | static const uint64_t rnd_val = 24941852; | 1222 | static const uint64_t rnd_val = 24941852; |
1206 | size_t rs; | 1223 | size_t rs; |
1207 | if ((c >= '0') &&(c <= '9') ) | 1224 | if ((c >= '0') && (c <= '9') ) |
1208 | continue; /* skip digits */ | 1225 | continue; /* skip digits */ |
1209 | for (test_val = 0; test_val <= rnd_val&& ! c_failed[c]; test_val += | 1226 | for (test_val = 0; test_val <= rnd_val && ! c_failed[c]; test_val += |
1210 | rnd_val) | 1227 | rnd_val) |
1211 | { | 1228 | { |
1212 | char test_str[] = "0123"; | 1229 | char test_str[] = "0123"; |
@@ -1236,7 +1253,7 @@ int check_str_to_uint64_all_chars (void) | |||
1236 | n_prnt (test_str), test_val, rv, get_current_locale_str ()); | 1253 | n_prnt (test_str), test_val, rv, get_current_locale_str ()); |
1237 | } | 1254 | } |
1238 | } | 1255 | } |
1239 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[c]) | 1256 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[c]) |
1240 | { | 1257 | { |
1241 | char test_str[] = "0123"; | 1258 | char test_str[] = "0123"; |
1242 | test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ | 1259 | test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ |
@@ -1251,7 +1268,8 @@ int check_str_to_uint64_all_chars (void) | |||
1251 | } | 1268 | } |
1252 | 1269 | ||
1253 | 1270 | ||
1254 | int check_str_to_uint64_overflow (void) | 1271 | int |
1272 | check_str_to_uint64_overflow (void) | ||
1255 | { | 1273 | { |
1256 | size_t t_failed = 0; | 1274 | size_t t_failed = 0; |
1257 | size_t i, j; | 1275 | size_t i, j; |
@@ -1298,7 +1316,7 @@ int check_str_to_uint64_overflow (void) | |||
1298 | n_prnt (t->str), test_val, rv, get_current_locale_str ()); | 1316 | n_prnt (t->str), test_val, rv, get_current_locale_str ()); |
1299 | } | 1317 | } |
1300 | } | 1318 | } |
1301 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 1319 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
1302 | printf ( | 1320 | printf ( |
1303 | "PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", | 1321 | "PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", |
1304 | n_prnt (t->str)); | 1322 | n_prnt (t->str)); |
@@ -1308,7 +1326,8 @@ int check_str_to_uint64_overflow (void) | |||
1308 | } | 1326 | } |
1309 | 1327 | ||
1310 | 1328 | ||
1311 | int check_str_to_uint64_no_val (void) | 1329 | int |
1330 | check_str_to_uint64_no_val (void) | ||
1312 | { | 1331 | { |
1313 | size_t t_failed = 0; | 1332 | size_t t_failed = 0; |
1314 | size_t i, j; | 1333 | size_t i, j; |
@@ -1355,7 +1374,7 @@ int check_str_to_uint64_no_val (void) | |||
1355 | n_prnt (t->str), test_val, rv, get_current_locale_str ()); | 1374 | n_prnt (t->str), test_val, rv, get_current_locale_str ()); |
1356 | } | 1375 | } |
1357 | } | 1376 | } |
1358 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 1377 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
1359 | printf ( | 1378 | printf ( |
1360 | "PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", | 1379 | "PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", |
1361 | n_prnt (t->str)); | 1380 | n_prnt (t->str)); |
@@ -1365,7 +1384,8 @@ int check_str_to_uint64_no_val (void) | |||
1365 | } | 1384 | } |
1366 | 1385 | ||
1367 | 1386 | ||
1368 | int check_str_to_uint64_n_valid (void) | 1387 | int |
1388 | check_str_to_uint64_n_valid (void) | ||
1369 | { | 1389 | { |
1370 | size_t t_failed = 0; | 1390 | size_t t_failed = 0; |
1371 | size_t i, j; | 1391 | size_t i, j; |
@@ -1423,7 +1443,7 @@ int check_str_to_uint64_n_valid (void) | |||
1423 | t->val, get_current_locale_str ()); | 1443 | t->val, get_current_locale_str ()); |
1424 | } | 1444 | } |
1425 | } | 1445 | } |
1426 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 1446 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
1427 | printf ( | 1447 | printf ( |
1428 | "PASSED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", ->%" | 1448 | "PASSED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", ->%" |
1429 | PRIu64 ")" | 1449 | PRIu64 ")" |
@@ -1436,7 +1456,8 @@ int check_str_to_uint64_n_valid (void) | |||
1436 | } | 1456 | } |
1437 | 1457 | ||
1438 | 1458 | ||
1439 | int check_str_to_uint64_n_all_chars (void) | 1459 | int |
1460 | check_str_to_uint64_n_all_chars (void) | ||
1440 | { | 1461 | { |
1441 | static const size_t n_checks = 256; /* from 0 to 255 */ | 1462 | static const size_t n_checks = 256; /* from 0 to 255 */ |
1442 | int c_failed[n_checks]; | 1463 | int c_failed[n_checks]; |
@@ -1457,12 +1478,12 @@ int check_str_to_uint64_n_all_chars (void) | |||
1457 | size_t rs; | 1478 | size_t rs; |
1458 | size_t len; | 1479 | size_t len; |
1459 | 1480 | ||
1460 | if ((c >= '0') &&(c <= '9') ) | 1481 | if ((c >= '0') && (c <= '9') ) |
1461 | continue; /* skip digits */ | 1482 | continue; /* skip digits */ |
1462 | 1483 | ||
1463 | for (len = 0; len <= 5; len++) | 1484 | for (len = 0; len <= 5; len++) |
1464 | { | 1485 | { |
1465 | for (test_val = 0; test_val <= rnd_val&& ! c_failed[c]; test_val += | 1486 | for (test_val = 0; test_val <= rnd_val && ! c_failed[c]; test_val += |
1466 | rnd_val) | 1487 | rnd_val) |
1467 | { | 1488 | { |
1468 | char test_str[] = "0123"; | 1489 | char test_str[] = "0123"; |
@@ -1497,7 +1518,7 @@ int check_str_to_uint64_n_all_chars (void) | |||
1497 | } | 1518 | } |
1498 | } | 1519 | } |
1499 | } | 1520 | } |
1500 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[c]) | 1521 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[c]) |
1501 | { | 1522 | { |
1502 | char test_str[] = "0123"; | 1523 | char test_str[] = "0123"; |
1503 | test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ | 1524 | test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ |
@@ -1512,7 +1533,8 @@ int check_str_to_uint64_n_all_chars (void) | |||
1512 | } | 1533 | } |
1513 | 1534 | ||
1514 | 1535 | ||
1515 | int check_str_to_uint64_n_overflow (void) | 1536 | int |
1537 | check_str_to_uint64_n_overflow (void) | ||
1516 | { | 1538 | { |
1517 | size_t t_failed = 0; | 1539 | size_t t_failed = 0; |
1518 | size_t i, j; | 1540 | size_t i, j; |
@@ -1567,7 +1589,7 @@ int check_str_to_uint64_n_overflow (void) | |||
1567 | } | 1589 | } |
1568 | } | 1590 | } |
1569 | } | 1591 | } |
1570 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 1592 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
1571 | printf ( | 1593 | printf ( |
1572 | "PASSED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR | 1594 | "PASSED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR |
1573 | ", &ret_val) == 0," | 1595 | ", &ret_val) == 0," |
@@ -1580,7 +1602,8 @@ int check_str_to_uint64_n_overflow (void) | |||
1580 | } | 1602 | } |
1581 | 1603 | ||
1582 | 1604 | ||
1583 | int check_str_to_uint64_n_no_val (void) | 1605 | int |
1606 | check_str_to_uint64_n_no_val (void) | ||
1584 | { | 1607 | { |
1585 | size_t t_failed = 0; | 1608 | size_t t_failed = 0; |
1586 | size_t i, j; | 1609 | size_t i, j; |
@@ -1635,7 +1658,7 @@ int check_str_to_uint64_n_no_val (void) | |||
1635 | } | 1658 | } |
1636 | } | 1659 | } |
1637 | } | 1660 | } |
1638 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 1661 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
1639 | printf ( | 1662 | printf ( |
1640 | "PASSED: MHD_str_to_uint64_n_(\"%s\", 0..%" PRIuPTR | 1663 | "PASSED: MHD_str_to_uint64_n_(\"%s\", 0..%" PRIuPTR |
1641 | ", &ret_val) == 0," | 1664 | ", &ret_val) == 0," |
@@ -1647,7 +1670,8 @@ int check_str_to_uint64_n_no_val (void) | |||
1647 | } | 1670 | } |
1648 | 1671 | ||
1649 | 1672 | ||
1650 | int check_strx_to_uint32_valid (void) | 1673 | int |
1674 | check_strx_to_uint32_valid (void) | ||
1651 | { | 1675 | { |
1652 | size_t t_failed = 0; | 1676 | size_t t_failed = 0; |
1653 | size_t i, j; | 1677 | size_t i, j; |
@@ -1708,7 +1732,7 @@ int check_strx_to_uint32_valid (void) | |||
1708 | t->str.str), (uint64_t) rv, (uint64_t) rv, | 1732 | t->str.str), (uint64_t) rv, (uint64_t) rv, |
1709 | t->val, get_current_locale_str ()); | 1733 | t->val, get_current_locale_str ()); |
1710 | } | 1734 | } |
1711 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 1735 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
1712 | printf ( | 1736 | printf ( |
1713 | "PASSED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") == %" PRIuPTR | 1737 | "PASSED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") == %" PRIuPTR |
1714 | "\n", | 1738 | "\n", |
@@ -1719,7 +1743,8 @@ int check_strx_to_uint32_valid (void) | |||
1719 | } | 1743 | } |
1720 | 1744 | ||
1721 | 1745 | ||
1722 | int check_strx_to_uint32_all_chars (void) | 1746 | int |
1747 | check_strx_to_uint32_all_chars (void) | ||
1723 | { | 1748 | { |
1724 | static const size_t n_checks = 256; /* from 0 to 255 */ | 1749 | static const size_t n_checks = 256; /* from 0 to 255 */ |
1725 | int c_failed[n_checks]; | 1750 | int c_failed[n_checks]; |
@@ -1738,12 +1763,13 @@ int check_strx_to_uint32_all_chars (void) | |||
1738 | { | 1763 | { |
1739 | static const uint32_t rnd_val = 234234; | 1764 | static const uint32_t rnd_val = 234234; |
1740 | size_t rs; | 1765 | size_t rs; |
1741 | if (((c >= '0') &&(c <= '9') ) || ((c >= 'A') &&(c <= 'F') ) ||((c >= | 1766 | if (((c >= '0') && (c <= '9') ) || ((c >= 'A') && (c <= 'F') ) || ((c >= |
1742 | 'a') && | 1767 | 'a') |
1743 | (c <= | 1768 | && |
1744 | 'f') )) | 1769 | (c <= |
1770 | 'f') )) | ||
1745 | continue; /* skip xdigits */ | 1771 | continue; /* skip xdigits */ |
1746 | for (test_val = 0; test_val <= rnd_val&& ! c_failed[c]; test_val += | 1772 | for (test_val = 0; test_val <= rnd_val && ! c_failed[c]; test_val += |
1747 | rnd_val) | 1773 | rnd_val) |
1748 | { | 1774 | { |
1749 | char test_str[] = "0123"; | 1775 | char test_str[] = "0123"; |
@@ -1774,7 +1800,7 @@ int check_strx_to_uint32_all_chars (void) | |||
1774 | get_current_locale_str ()); | 1800 | get_current_locale_str ()); |
1775 | } | 1801 | } |
1776 | } | 1802 | } |
1777 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[c]) | 1803 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[c]) |
1778 | { | 1804 | { |
1779 | char test_str[] = "0123"; | 1805 | char test_str[] = "0123"; |
1780 | test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ | 1806 | test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ |
@@ -1789,7 +1815,8 @@ int check_strx_to_uint32_all_chars (void) | |||
1789 | } | 1815 | } |
1790 | 1816 | ||
1791 | 1817 | ||
1792 | int check_strx_to_uint32_overflow (void) | 1818 | int |
1819 | check_strx_to_uint32_overflow (void) | ||
1793 | { | 1820 | { |
1794 | size_t t_failed = 0; | 1821 | size_t t_failed = 0; |
1795 | size_t i, j; | 1822 | size_t i, j; |
@@ -1854,7 +1881,7 @@ int check_strx_to_uint32_overflow (void) | |||
1854 | get_current_locale_str ()); | 1881 | get_current_locale_str ()); |
1855 | } | 1882 | } |
1856 | } | 1883 | } |
1857 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 1884 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
1858 | printf ( | 1885 | printf ( |
1859 | "PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", | 1886 | "PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", |
1860 | n_prnt (str)); | 1887 | n_prnt (str)); |
@@ -1864,7 +1891,8 @@ int check_strx_to_uint32_overflow (void) | |||
1864 | } | 1891 | } |
1865 | 1892 | ||
1866 | 1893 | ||
1867 | int check_strx_to_uint32_no_val (void) | 1894 | int |
1895 | check_strx_to_uint32_no_val (void) | ||
1868 | { | 1896 | { |
1869 | size_t t_failed = 0; | 1897 | size_t t_failed = 0; |
1870 | size_t i, j; | 1898 | size_t i, j; |
@@ -1912,7 +1940,7 @@ int check_strx_to_uint32_no_val (void) | |||
1912 | get_current_locale_str ()); | 1940 | get_current_locale_str ()); |
1913 | } | 1941 | } |
1914 | } | 1942 | } |
1915 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 1943 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
1916 | printf ( | 1944 | printf ( |
1917 | "PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", | 1945 | "PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", |
1918 | n_prnt (t->str)); | 1946 | n_prnt (t->str)); |
@@ -1922,7 +1950,8 @@ int check_strx_to_uint32_no_val (void) | |||
1922 | } | 1950 | } |
1923 | 1951 | ||
1924 | 1952 | ||
1925 | int check_strx_to_uint32_n_valid (void) | 1953 | int |
1954 | check_strx_to_uint32_n_valid (void) | ||
1926 | { | 1955 | { |
1927 | size_t t_failed = 0; | 1956 | size_t t_failed = 0; |
1928 | size_t i, j; | 1957 | size_t i, j; |
@@ -1984,7 +2013,7 @@ int check_strx_to_uint32_n_valid (void) | |||
1984 | t->val, get_current_locale_str ()); | 2013 | t->val, get_current_locale_str ()); |
1985 | } | 2014 | } |
1986 | } | 2015 | } |
1987 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 2016 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
1988 | printf ( | 2017 | printf ( |
1989 | "PASSED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR | 2018 | "PASSED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR |
1990 | ", ->0x%" | 2019 | ", ->0x%" |
@@ -1998,7 +2027,8 @@ int check_strx_to_uint32_n_valid (void) | |||
1998 | } | 2027 | } |
1999 | 2028 | ||
2000 | 2029 | ||
2001 | int check_strx_to_uint32_n_all_chars (void) | 2030 | int |
2031 | check_strx_to_uint32_n_all_chars (void) | ||
2002 | { | 2032 | { |
2003 | static const size_t n_checks = 256; /* from 0 to 255 */ | 2033 | static const size_t n_checks = 256; /* from 0 to 255 */ |
2004 | int c_failed[n_checks]; | 2034 | int c_failed[n_checks]; |
@@ -2019,15 +2049,16 @@ int check_strx_to_uint32_n_all_chars (void) | |||
2019 | size_t rs; | 2049 | size_t rs; |
2020 | size_t len; | 2050 | size_t len; |
2021 | 2051 | ||
2022 | if (((c >= '0') &&(c <= '9') ) || ((c >= 'A') &&(c <= 'F') ) || ((c >= | 2052 | if (((c >= '0') && (c <= '9') ) || ((c >= 'A') && (c <= 'F') ) || ((c >= |
2023 | 'a') && | 2053 | 'a') |
2024 | (c <= | 2054 | && |
2025 | 'f') )) | 2055 | (c <= |
2056 | 'f') )) | ||
2026 | continue; /* skip xdigits */ | 2057 | continue; /* skip xdigits */ |
2027 | 2058 | ||
2028 | for (len = 0; len <= 5; len++) | 2059 | for (len = 0; len <= 5; len++) |
2029 | { | 2060 | { |
2030 | for (test_val = 0; test_val <= rnd_val&& ! c_failed[c]; test_val += | 2061 | for (test_val = 0; test_val <= rnd_val && ! c_failed[c]; test_val += |
2031 | rnd_val) | 2062 | rnd_val) |
2032 | { | 2063 | { |
2033 | char test_str[] = "0123"; | 2064 | char test_str[] = "0123"; |
@@ -2063,7 +2094,7 @@ int check_strx_to_uint32_n_all_chars (void) | |||
2063 | } | 2094 | } |
2064 | } | 2095 | } |
2065 | } | 2096 | } |
2066 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[c]) | 2097 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[c]) |
2067 | { | 2098 | { |
2068 | char test_str[] = "0123"; | 2099 | char test_str[] = "0123"; |
2069 | test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ | 2100 | test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ |
@@ -2078,7 +2109,8 @@ int check_strx_to_uint32_n_all_chars (void) | |||
2078 | } | 2109 | } |
2079 | 2110 | ||
2080 | 2111 | ||
2081 | int check_strx_to_uint32_n_overflow (void) | 2112 | int |
2113 | check_strx_to_uint32_n_overflow (void) | ||
2082 | { | 2114 | { |
2083 | size_t t_failed = 0; | 2115 | size_t t_failed = 0; |
2084 | size_t i, j; | 2116 | size_t i, j; |
@@ -2166,7 +2198,7 @@ int check_strx_to_uint32_n_overflow (void) | |||
2166 | } | 2198 | } |
2167 | } | 2199 | } |
2168 | } | 2200 | } |
2169 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 2201 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
2170 | printf ( | 2202 | printf ( |
2171 | "PASSED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR | 2203 | "PASSED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR |
2172 | ", &ret_val) == 0," | 2204 | ", &ret_val) == 0," |
@@ -2179,7 +2211,8 @@ int check_strx_to_uint32_n_overflow (void) | |||
2179 | } | 2211 | } |
2180 | 2212 | ||
2181 | 2213 | ||
2182 | int check_strx_to_uint32_n_no_val (void) | 2214 | int |
2215 | check_strx_to_uint32_n_no_val (void) | ||
2183 | { | 2216 | { |
2184 | size_t t_failed = 0; | 2217 | size_t t_failed = 0; |
2185 | size_t i, j; | 2218 | size_t i, j; |
@@ -2235,7 +2268,7 @@ int check_strx_to_uint32_n_no_val (void) | |||
2235 | } | 2268 | } |
2236 | } | 2269 | } |
2237 | } | 2270 | } |
2238 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 2271 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
2239 | printf ( | 2272 | printf ( |
2240 | "PASSED: MHD_strx_to_uint32_n_(\"%s\", 0..%" PRIuPTR | 2273 | "PASSED: MHD_strx_to_uint32_n_(\"%s\", 0..%" PRIuPTR |
2241 | ", &ret_val) == 0," | 2274 | ", &ret_val) == 0," |
@@ -2247,7 +2280,8 @@ int check_strx_to_uint32_n_no_val (void) | |||
2247 | } | 2280 | } |
2248 | 2281 | ||
2249 | 2282 | ||
2250 | int check_strx_to_uint64_valid (void) | 2283 | int |
2284 | check_strx_to_uint64_valid (void) | ||
2251 | { | 2285 | { |
2252 | size_t t_failed = 0; | 2286 | size_t t_failed = 0; |
2253 | size_t i, j; | 2287 | size_t i, j; |
@@ -2304,7 +2338,7 @@ int check_strx_to_uint64_valid (void) | |||
2304 | t->str.str), rv, rv, | 2338 | t->str.str), rv, rv, |
2305 | t->val, get_current_locale_str ()); | 2339 | t->val, get_current_locale_str ()); |
2306 | } | 2340 | } |
2307 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 2341 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
2308 | printf ( | 2342 | printf ( |
2309 | "PASSED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") == %" PRIuPTR | 2343 | "PASSED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") == %" PRIuPTR |
2310 | "\n", | 2344 | "\n", |
@@ -2315,7 +2349,8 @@ int check_strx_to_uint64_valid (void) | |||
2315 | } | 2349 | } |
2316 | 2350 | ||
2317 | 2351 | ||
2318 | int check_strx_to_uint64_all_chars (void) | 2352 | int |
2353 | check_strx_to_uint64_all_chars (void) | ||
2319 | { | 2354 | { |
2320 | static const size_t n_checks = 256; /* from 0 to 255 */ | 2355 | static const size_t n_checks = 256; /* from 0 to 255 */ |
2321 | int c_failed[n_checks]; | 2356 | int c_failed[n_checks]; |
@@ -2334,12 +2369,13 @@ int check_strx_to_uint64_all_chars (void) | |||
2334 | { | 2369 | { |
2335 | static const uint64_t rnd_val = 234234; | 2370 | static const uint64_t rnd_val = 234234; |
2336 | size_t rs; | 2371 | size_t rs; |
2337 | if (((c >= '0') &&(c <= '9') ) || ((c >= 'A') &&(c <= 'F') ) || ((c >= | 2372 | if (((c >= '0') && (c <= '9') ) || ((c >= 'A') && (c <= 'F') ) || ((c >= |
2338 | 'a') && | 2373 | 'a') |
2339 | (c <= | 2374 | && |
2340 | 'f') )) | 2375 | (c <= |
2376 | 'f') )) | ||
2341 | continue; /* skip xdigits */ | 2377 | continue; /* skip xdigits */ |
2342 | for (test_val = 0; test_val <= rnd_val&& ! c_failed[c]; test_val += | 2378 | for (test_val = 0; test_val <= rnd_val && ! c_failed[c]; test_val += |
2343 | rnd_val) | 2379 | rnd_val) |
2344 | { | 2380 | { |
2345 | char test_str[] = "0123"; | 2381 | char test_str[] = "0123"; |
@@ -2369,7 +2405,7 @@ int check_strx_to_uint64_all_chars (void) | |||
2369 | n_prnt (test_str), test_val, rv, get_current_locale_str ()); | 2405 | n_prnt (test_str), test_val, rv, get_current_locale_str ()); |
2370 | } | 2406 | } |
2371 | } | 2407 | } |
2372 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[c]) | 2408 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[c]) |
2373 | { | 2409 | { |
2374 | char test_str[] = "0123"; | 2410 | char test_str[] = "0123"; |
2375 | test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ | 2411 | test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ |
@@ -2384,7 +2420,8 @@ int check_strx_to_uint64_all_chars (void) | |||
2384 | } | 2420 | } |
2385 | 2421 | ||
2386 | 2422 | ||
2387 | int check_strx_to_uint64_overflow (void) | 2423 | int |
2424 | check_strx_to_uint64_overflow (void) | ||
2388 | { | 2425 | { |
2389 | size_t t_failed = 0; | 2426 | size_t t_failed = 0; |
2390 | size_t i, j; | 2427 | size_t i, j; |
@@ -2431,7 +2468,7 @@ int check_strx_to_uint64_overflow (void) | |||
2431 | n_prnt (t->str), test_val, rv, get_current_locale_str ()); | 2468 | n_prnt (t->str), test_val, rv, get_current_locale_str ()); |
2432 | } | 2469 | } |
2433 | } | 2470 | } |
2434 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 2471 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
2435 | printf ( | 2472 | printf ( |
2436 | "PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", | 2473 | "PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", |
2437 | n_prnt (t->str)); | 2474 | n_prnt (t->str)); |
@@ -2441,7 +2478,8 @@ int check_strx_to_uint64_overflow (void) | |||
2441 | } | 2478 | } |
2442 | 2479 | ||
2443 | 2480 | ||
2444 | int check_strx_to_uint64_no_val (void) | 2481 | int |
2482 | check_strx_to_uint64_no_val (void) | ||
2445 | { | 2483 | { |
2446 | size_t t_failed = 0; | 2484 | size_t t_failed = 0; |
2447 | size_t i, j; | 2485 | size_t i, j; |
@@ -2488,7 +2526,7 @@ int check_strx_to_uint64_no_val (void) | |||
2488 | n_prnt (t->str), test_val, rv, get_current_locale_str ()); | 2526 | n_prnt (t->str), test_val, rv, get_current_locale_str ()); |
2489 | } | 2527 | } |
2490 | } | 2528 | } |
2491 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 2529 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
2492 | printf ( | 2530 | printf ( |
2493 | "PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", | 2531 | "PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", |
2494 | n_prnt (t->str)); | 2532 | n_prnt (t->str)); |
@@ -2498,7 +2536,8 @@ int check_strx_to_uint64_no_val (void) | |||
2498 | } | 2536 | } |
2499 | 2537 | ||
2500 | 2538 | ||
2501 | int check_strx_to_uint64_n_valid (void) | 2539 | int |
2540 | check_strx_to_uint64_n_valid (void) | ||
2502 | { | 2541 | { |
2503 | size_t t_failed = 0; | 2542 | size_t t_failed = 0; |
2504 | size_t i, j; | 2543 | size_t i, j; |
@@ -2556,7 +2595,7 @@ int check_strx_to_uint64_n_valid (void) | |||
2556 | t->val, get_current_locale_str ()); | 2595 | t->val, get_current_locale_str ()); |
2557 | } | 2596 | } |
2558 | } | 2597 | } |
2559 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 2598 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
2560 | printf ( | 2599 | printf ( |
2561 | "PASSED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR | 2600 | "PASSED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR |
2562 | ", ->0x%" | 2601 | ", ->0x%" |
@@ -2570,7 +2609,8 @@ int check_strx_to_uint64_n_valid (void) | |||
2570 | } | 2609 | } |
2571 | 2610 | ||
2572 | 2611 | ||
2573 | int check_strx_to_uint64_n_all_chars (void) | 2612 | int |
2613 | check_strx_to_uint64_n_all_chars (void) | ||
2574 | { | 2614 | { |
2575 | static const size_t n_checks = 256; /* from 0 to 255 */ | 2615 | static const size_t n_checks = 256; /* from 0 to 255 */ |
2576 | int c_failed[n_checks]; | 2616 | int c_failed[n_checks]; |
@@ -2591,15 +2631,16 @@ int check_strx_to_uint64_n_all_chars (void) | |||
2591 | size_t rs; | 2631 | size_t rs; |
2592 | size_t len; | 2632 | size_t len; |
2593 | 2633 | ||
2594 | if (((c >= '0') &&(c <= '9') ) || ((c >= 'A') &&(c <= 'F') ) || ((c >= | 2634 | if (((c >= '0') && (c <= '9') ) || ((c >= 'A') && (c <= 'F') ) || ((c >= |
2595 | 'a') && | 2635 | 'a') |
2596 | (c <= | 2636 | && |
2597 | 'f') )) | 2637 | (c <= |
2638 | 'f') )) | ||
2598 | continue; /* skip xdigits */ | 2639 | continue; /* skip xdigits */ |
2599 | 2640 | ||
2600 | for (len = 0; len <= 5; len++) | 2641 | for (len = 0; len <= 5; len++) |
2601 | { | 2642 | { |
2602 | for (test_val = 0; test_val <= rnd_val&& ! c_failed[c]; test_val += | 2643 | for (test_val = 0; test_val <= rnd_val && ! c_failed[c]; test_val += |
2603 | rnd_val) | 2644 | rnd_val) |
2604 | { | 2645 | { |
2605 | char test_str[] = "0123"; | 2646 | char test_str[] = "0123"; |
@@ -2635,7 +2676,7 @@ int check_strx_to_uint64_n_all_chars (void) | |||
2635 | } | 2676 | } |
2636 | } | 2677 | } |
2637 | } | 2678 | } |
2638 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[c]) | 2679 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[c]) |
2639 | { | 2680 | { |
2640 | char test_str[] = "0123"; | 2681 | char test_str[] = "0123"; |
2641 | test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ | 2682 | test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ |
@@ -2650,7 +2691,8 @@ int check_strx_to_uint64_n_all_chars (void) | |||
2650 | } | 2691 | } |
2651 | 2692 | ||
2652 | 2693 | ||
2653 | int check_strx_to_uint64_n_overflow (void) | 2694 | int |
2695 | check_strx_to_uint64_n_overflow (void) | ||
2654 | { | 2696 | { |
2655 | size_t t_failed = 0; | 2697 | size_t t_failed = 0; |
2656 | size_t i, j; | 2698 | size_t i, j; |
@@ -2706,7 +2748,7 @@ int check_strx_to_uint64_n_overflow (void) | |||
2706 | } | 2748 | } |
2707 | } | 2749 | } |
2708 | } | 2750 | } |
2709 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 2751 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
2710 | printf ( | 2752 | printf ( |
2711 | "PASSED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR | 2753 | "PASSED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR |
2712 | ", &ret_val) == 0," | 2754 | ", &ret_val) == 0," |
@@ -2719,7 +2761,8 @@ int check_strx_to_uint64_n_overflow (void) | |||
2719 | } | 2761 | } |
2720 | 2762 | ||
2721 | 2763 | ||
2722 | int check_strx_to_uint64_n_no_val (void) | 2764 | int |
2765 | check_strx_to_uint64_n_no_val (void) | ||
2723 | { | 2766 | { |
2724 | size_t t_failed = 0; | 2767 | size_t t_failed = 0; |
2725 | size_t i, j; | 2768 | size_t i, j; |
@@ -2775,7 +2818,7 @@ int check_strx_to_uint64_n_no_val (void) | |||
2775 | } | 2818 | } |
2776 | } | 2819 | } |
2777 | } | 2820 | } |
2778 | if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) | 2821 | if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i]) |
2779 | printf ( | 2822 | printf ( |
2780 | "PASSED: MHD_strx_to_uint64_n_(\"%s\", 0..%" PRIuPTR | 2823 | "PASSED: MHD_strx_to_uint64_n_(\"%s\", 0..%" PRIuPTR |
2781 | ", &ret_val) == 0," | 2824 | ", &ret_val) == 0," |
@@ -2787,7 +2830,8 @@ int check_strx_to_uint64_n_no_val (void) | |||
2787 | } | 2830 | } |
2788 | 2831 | ||
2789 | 2832 | ||
2790 | int run_str_to_X_tests (void) | 2833 | int |
2834 | run_str_to_X_tests (void) | ||
2791 | { | 2835 | { |
2792 | int str_to_uint64_fails = 0; | 2836 | int str_to_uint64_fails = 0; |
2793 | int str_to_uint64_n_fails = 0; | 2837 | int str_to_uint64_n_fails = 0; |
@@ -3270,7 +3314,8 @@ int run_str_to_X_tests (void) | |||
3270 | } | 3314 | } |
3271 | 3315 | ||
3272 | 3316 | ||
3273 | int main (int argc, char *argv[]) | 3317 | int |
3318 | main (int argc, char *argv[]) | ||
3274 | { | 3319 | { |
3275 | if (has_param (argc, argv, "-v") || has_param (argc, argv, "--verbose") || | 3320 | if (has_param (argc, argv, "-v") || has_param (argc, argv, "--verbose") || |
3276 | has_param (argc, argv, "--verbose1")) | 3321 | has_param (argc, argv, "--verbose1")) |
diff --git a/src/microhttpd/test_str_token.c b/src/microhttpd/test_str_token.c index 0baca53d..1e1eab28 100644 --- a/src/microhttpd/test_str_token.c +++ b/src/microhttpd/test_str_token.c | |||
@@ -41,6 +41,7 @@ expect_found_n (const char *str, const char *token, size_t token_len) | |||
41 | return 0; | 41 | return 0; |
42 | } | 42 | } |
43 | 43 | ||
44 | |||
44 | #define expect_found(s,t) expect_found_n ((s),(t),MHD_STATICSTR_LEN_ (t)) | 45 | #define expect_found(s,t) expect_found_n ((s),(t),MHD_STATICSTR_LEN_ (t)) |
45 | 46 | ||
46 | static int | 47 | static int |
@@ -56,10 +57,12 @@ expect_not_found_n (const char *str, const char *token, size_t token_len) | |||
56 | return 0; | 57 | return 0; |
57 | } | 58 | } |
58 | 59 | ||
60 | |||
59 | #define expect_not_found(s,t) expect_not_found_n ((s),(t),MHD_STATICSTR_LEN_ ( \ | 61 | #define expect_not_found(s,t) expect_not_found_n ((s),(t),MHD_STATICSTR_LEN_ ( \ |
60 | t)) | 62 | t)) |
61 | 63 | ||
62 | int check_match (void) | 64 | int |
65 | check_match (void) | ||
63 | { | 66 | { |
64 | int errcount = 0; | 67 | int errcount = 0; |
65 | errcount += expect_found ("string", "string"); | 68 | errcount += expect_found ("string", "string"); |
@@ -85,7 +88,9 @@ int check_match (void) | |||
85 | return errcount; | 88 | return errcount; |
86 | } | 89 | } |
87 | 90 | ||
88 | int check_not_match (void) | 91 | |
92 | int | ||
93 | check_not_match (void) | ||
89 | { | 94 | { |
90 | int errcount = 0; | 95 | int errcount = 0; |
91 | errcount += expect_not_found ("strin", "string"); | 96 | errcount += expect_not_found ("strin", "string"); |
@@ -111,7 +116,9 @@ int check_not_match (void) | |||
111 | return errcount; | 116 | return errcount; |
112 | } | 117 | } |
113 | 118 | ||
114 | int main (int argc, char *argv[]) | 119 | |
120 | int | ||
121 | main (int argc, char *argv[]) | ||
115 | { | 122 | { |
116 | int errcount = 0; | 123 | int errcount = 0; |
117 | (void) argc; (void) argv; /* Unused. Silent compiler warning. */ | 124 | (void) argc; (void) argv; /* Unused. Silent compiler warning. */ |
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c index dbfa847d..404c2854 100644 --- a/src/microhttpd/test_upgrade.c +++ b/src/microhttpd/test_upgrade.c | |||
@@ -139,6 +139,8 @@ gnutlscli_connect (int *sock, | |||
139 | } | 139 | } |
140 | _exit (1); | 140 | _exit (1); |
141 | } | 141 | } |
142 | |||
143 | |||
142 | #endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ | 144 | #endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ |
143 | 145 | ||
144 | 146 | ||
@@ -296,14 +298,14 @@ wr_connect (struct wr_socket *s, | |||
296 | * it require processing on MHD side and | 298 | * it require processing on MHD side and |
297 | * when testing with "external" polling, | 299 | * when testing with "external" polling, |
298 | * test will call MHD processing only | 300 | * test will call MHD processing only |
299 | * after return from wr_connect(). */ | 301 | * after return from wr_connect(). */s->tls_connected = 0; |
300 | s->tls_connected = 0; | ||
301 | return 0; | 302 | return 0; |
302 | } | 303 | } |
303 | #endif /* HTTPS_SUPPORT */ | 304 | #endif /* HTTPS_SUPPORT */ |
304 | return -1; | 305 | return -1; |
305 | } | 306 | } |
306 | 307 | ||
308 | |||
307 | #ifdef HTTPS_SUPPORT | 309 | #ifdef HTTPS_SUPPORT |
308 | /* Only to be called from wr_send() and wr_recv() ! */ | 310 | /* Only to be called from wr_send() and wr_recv() ! */ |
309 | static bool | 311 | static bool |
@@ -318,6 +320,8 @@ wr_handshake (struct wr_socket *s) | |||
318 | MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */ | 320 | MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */ |
319 | return s->tls_connected; | 321 | return s->tls_connected; |
320 | } | 322 | } |
323 | |||
324 | |||
321 | #endif /* HTTPS_SUPPORT */ | 325 | #endif /* HTTPS_SUPPORT */ |
322 | 326 | ||
323 | 327 | ||
@@ -924,6 +928,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon) | |||
924 | } | 928 | } |
925 | } | 929 | } |
926 | 930 | ||
931 | |||
927 | #ifdef HAVE_POLL | 932 | #ifdef HAVE_POLL |
928 | 933 | ||
929 | /** | 934 | /** |
@@ -937,6 +942,8 @@ run_mhd_poll_loop (struct MHD_Daemon *daemon) | |||
937 | (void) daemon; /* Unused. Silent compiler warning. */ | 942 | (void) daemon; /* Unused. Silent compiler warning. */ |
938 | abort (); /* currently not implementable with existing MHD API */ | 943 | abort (); /* currently not implementable with existing MHD API */ |
939 | } | 944 | } |
945 | |||
946 | |||
940 | #endif /* HAVE_POLL */ | 947 | #endif /* HAVE_POLL */ |
941 | 948 | ||
942 | 949 | ||
@@ -983,6 +990,8 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon) | |||
983 | MHD_run (daemon); | 990 | MHD_run (daemon); |
984 | } | 991 | } |
985 | } | 992 | } |
993 | |||
994 | |||
986 | #endif /* EPOLL_SUPPORT */ | 995 | #endif /* EPOLL_SUPPORT */ |
987 | 996 | ||
988 | /** | 997 | /** |
@@ -1076,7 +1085,7 @@ test_upgrade (int flags, | |||
1076 | if ( (NULL == dinfo) || | 1085 | if ( (NULL == dinfo) || |
1077 | (0 == dinfo->port) ) | 1086 | (0 == dinfo->port) ) |
1078 | abort (); | 1087 | abort (); |
1079 | if (! test_tls ||(TLS_LIB_GNUTLS == use_tls_tool)) | 1088 | if (! test_tls || (TLS_LIB_GNUTLS == use_tls_tool)) |
1080 | { | 1089 | { |
1081 | sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt (); | 1090 | sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt (); |
1082 | if (NULL == sock) | 1091 | if (NULL == sock) |
@@ -1134,7 +1143,7 @@ test_upgrade (int flags, | |||
1134 | pthread_join (pt, | 1143 | pthread_join (pt, |
1135 | NULL); | 1144 | NULL); |
1136 | #if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) | 1145 | #if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) |
1137 | if (test_tls &&(TLS_LIB_GNUTLS != use_tls_tool)) | 1146 | if (test_tls && (TLS_LIB_GNUTLS != use_tls_tool)) |
1138 | waitpid (pid, NULL, 0); | 1147 | waitpid (pid, NULL, 0); |
1139 | #endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ | 1148 | #endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ |
1140 | MHD_stop_daemon (d); | 1149 | MHD_stop_daemon (d); |
diff --git a/src/microhttpd/test_upgrade_large.c b/src/microhttpd/test_upgrade_large.c index 9ad15578..a17293db 100644 --- a/src/microhttpd/test_upgrade_large.c +++ b/src/microhttpd/test_upgrade_large.c | |||
@@ -149,6 +149,8 @@ gnutlscli_connect (int *sock, | |||
149 | } | 149 | } |
150 | _exit (1); | 150 | _exit (1); |
151 | } | 151 | } |
152 | |||
153 | |||
152 | #endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ | 154 | #endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ |
153 | 155 | ||
154 | 156 | ||
@@ -306,14 +308,14 @@ wr_connect (struct wr_socket *s, | |||
306 | * it require processing on MHD side and | 308 | * it require processing on MHD side and |
307 | * when testing with "external" polling, | 309 | * when testing with "external" polling, |
308 | * test will call MHD processing only | 310 | * test will call MHD processing only |
309 | * after return from wr_connect(). */ | 311 | * after return from wr_connect(). */s->tls_connected = 0; |
310 | s->tls_connected = 0; | ||
311 | return 0; | 312 | return 0; |
312 | } | 313 | } |
313 | #endif /* HTTPS_SUPPORT */ | 314 | #endif /* HTTPS_SUPPORT */ |
314 | return -1; | 315 | return -1; |
315 | } | 316 | } |
316 | 317 | ||
318 | |||
317 | #ifdef HTTPS_SUPPORT | 319 | #ifdef HTTPS_SUPPORT |
318 | /* Only to be called from wr_send() and wr_recv() ! */ | 320 | /* Only to be called from wr_send() and wr_recv() ! */ |
319 | static bool | 321 | static bool |
@@ -328,6 +330,8 @@ wr_handshake (struct wr_socket *s) | |||
328 | MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */ | 330 | MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */ |
329 | return s->tls_connected; | 331 | return s->tls_connected; |
330 | } | 332 | } |
333 | |||
334 | |||
331 | #endif /* HTTPS_SUPPORT */ | 335 | #endif /* HTTPS_SUPPORT */ |
332 | 336 | ||
333 | 337 | ||
@@ -958,6 +962,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon) | |||
958 | kicker[1] = -1; | 962 | kicker[1] = -1; |
959 | } | 963 | } |
960 | 964 | ||
965 | |||
961 | #ifdef HAVE_POLL | 966 | #ifdef HAVE_POLL |
962 | 967 | ||
963 | /** | 968 | /** |
@@ -971,6 +976,8 @@ run_mhd_poll_loop (struct MHD_Daemon *daemon) | |||
971 | (void) daemon; /* Unused. Silent compiler warning. */ | 976 | (void) daemon; /* Unused. Silent compiler warning. */ |
972 | abort (); /* currently not implementable with existing MHD API */ | 977 | abort (); /* currently not implementable with existing MHD API */ |
973 | } | 978 | } |
979 | |||
980 | |||
974 | #endif /* HAVE_POLL */ | 981 | #endif /* HAVE_POLL */ |
975 | 982 | ||
976 | 983 | ||
@@ -1026,6 +1033,8 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon) | |||
1026 | kicker[0] = -1; | 1033 | kicker[0] = -1; |
1027 | kicker[1] = -1; | 1034 | kicker[1] = -1; |
1028 | } | 1035 | } |
1036 | |||
1037 | |||
1029 | #endif /* EPOLL_SUPPORT */ | 1038 | #endif /* EPOLL_SUPPORT */ |
1030 | 1039 | ||
1031 | /** | 1040 | /** |
@@ -1121,7 +1130,7 @@ test_upgrade (int flags, | |||
1121 | if ( (NULL == dinfo) || | 1130 | if ( (NULL == dinfo) || |
1122 | (0 == dinfo->port) ) | 1131 | (0 == dinfo->port) ) |
1123 | abort (); | 1132 | abort (); |
1124 | if (! test_tls ||(TLS_LIB_GNUTLS == use_tls_tool)) | 1133 | if (! test_tls || (TLS_LIB_GNUTLS == use_tls_tool)) |
1125 | { | 1134 | { |
1126 | sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt (); | 1135 | sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt (); |
1127 | if (NULL == sock) | 1136 | if (NULL == sock) |
@@ -1179,7 +1188,7 @@ test_upgrade (int flags, | |||
1179 | pthread_join (pt, | 1188 | pthread_join (pt, |
1180 | NULL); | 1189 | NULL); |
1181 | #if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) | 1190 | #if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) |
1182 | if (test_tls &&(TLS_LIB_GNUTLS != use_tls_tool)) | 1191 | if (test_tls && (TLS_LIB_GNUTLS != use_tls_tool)) |
1183 | waitpid (pid, NULL, 0); | 1192 | waitpid (pid, NULL, 0); |
1184 | #endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ | 1193 | #endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ |
1185 | MHD_stop_daemon (d); | 1194 | MHD_stop_daemon (d); |
diff --git a/src/microhttpd/tsearch.c b/src/microhttpd/tsearch.c index e43d758f..78f37608 100644 --- a/src/microhttpd/tsearch.c +++ b/src/microhttpd/tsearch.c | |||
@@ -102,7 +102,7 @@ tdelete (const void *__restrict vkey, | |||
102 | node_t *r; | 102 | node_t *r; |
103 | int cmp; | 103 | int cmp; |
104 | 104 | ||
105 | if ((rootp == NULL)||((p = *rootp) == NULL)) | 105 | if ((rootp == NULL) || ((p = *rootp) == NULL)) |
106 | return NULL; | 106 | return NULL; |
107 | 107 | ||
108 | while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0) | 108 | while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0) |
@@ -140,4 +140,5 @@ tdelete (const void *__restrict vkey, | |||
140 | return p; | 140 | return p; |
141 | } | 141 | } |
142 | 142 | ||
143 | |||
143 | /* end of tsearch.c */ | 144 | /* end of tsearch.c */ |