diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-11-26 15:33:55 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-11-26 15:33:55 +0300 |
commit | 4a126e24e7b780c3ad0196b72f813ce4a90215e3 (patch) | |
tree | 7bbb6e6d0a8dcb8b91c86144a9c972f51a4a8cd5 | |
parent | 14f748f9c0dd334675d7a8e23c3fe8b8f84b6361 (diff) | |
download | libmicrohttpd-4a126e24e7b780c3ad0196b72f813ce4a90215e3.tar.gz libmicrohttpd-4a126e24e7b780c3ad0196b72f813ce4a90215e3.zip |
Improved compatibility with Cygwin
-rw-r--r-- | src/include/platform.h | 6 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 46 | ||||
-rw-r--r-- | src/microhttpd/digestauth.c | 4 | ||||
-rw-r--r-- | src/microhttpd/mhd_compat.h | 6 | ||||
-rw-r--r-- | src/microhttpd/mhd_mono_clock.c | 4 | ||||
-rw-r--r-- | src/microhttpd/mhd_sockets.h | 2 | ||||
-rw-r--r-- | src/microhttpd/response.c | 20 | ||||
-rw-r--r-- | src/microhttpd/test_helpers.h | 4 | ||||
-rw-r--r-- | src/microhttpd/test_shutdown_select.c | 4 |
9 files changed, 48 insertions, 48 deletions
diff --git a/src/include/platform.h b/src/include/platform.h index 6d51747d..20d4df52 100644 --- a/src/include/platform.h +++ b/src/include/platform.h | |||
@@ -118,11 +118,11 @@ | |||
118 | typedef intptr_t ssize_t; | 118 | typedef intptr_t ssize_t; |
119 | #endif /* !_SSIZE_T_DEFINED */ | 119 | #endif /* !_SSIZE_T_DEFINED */ |
120 | 120 | ||
121 | #ifndef _WIN32 | 121 | #if !defined(_WIN32) || defined(__CYGWIN__) |
122 | typedef time_t _MHD_TIMEVAL_TV_SEC_TYPE; | 122 | typedef time_t _MHD_TIMEVAL_TV_SEC_TYPE; |
123 | #else /* _WIN32 */ | 123 | #else /* _WIN32 && ! __CYGWIN__ */ |
124 | typedef long _MHD_TIMEVAL_TV_SEC_TYPE; | 124 | typedef long _MHD_TIMEVAL_TV_SEC_TYPE; |
125 | #endif /* _WIN32 */ | 125 | #endif /* _WIN32 && ! __CYGWIN__ */ |
126 | 126 | ||
127 | #if !defined(IPPROTO_IPV6) && defined(_MSC_FULL_VER) && _WIN32_WINNT >= 0x0501 | 127 | #if !defined(IPPROTO_IPV6) && defined(_MSC_FULL_VER) && _WIN32_WINNT >= 0x0501 |
128 | /* VC use IPPROTO_IPV6 as part of enum */ | 128 | /* VC use IPPROTO_IPV6 as part of enum */ |
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index f9bebd35..794acfbd 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -52,7 +52,7 @@ | |||
52 | #endif /* MHD_HTTPS_REQUIRE_GRYPT */ | 52 | #endif /* MHD_HTTPS_REQUIRE_GRYPT */ |
53 | #endif /* HTTPS_SUPPORT */ | 53 | #endif /* HTTPS_SUPPORT */ |
54 | 54 | ||
55 | #ifdef _WIN32 | 55 | #if defined(_WIN32) && ! defined(__CYGWIN__) |
56 | #ifndef WIN32_LEAN_AND_MEAN | 56 | #ifndef WIN32_LEAN_AND_MEAN |
57 | #define WIN32_LEAN_AND_MEAN 1 | 57 | #define WIN32_LEAN_AND_MEAN 1 |
58 | #endif /* !WIN32_LEAN_AND_MEAN */ | 58 | #endif /* !WIN32_LEAN_AND_MEAN */ |
@@ -152,7 +152,7 @@ MHD_PanicCallback mhd_panic; | |||
152 | */ | 152 | */ |
153 | void *mhd_panic_cls; | 153 | void *mhd_panic_cls; |
154 | 154 | ||
155 | #ifdef _WIN32 | 155 | #if defined(_WIN32) && ! defined(__CYGWIN__) |
156 | /** | 156 | /** |
157 | * Track initialization of winsock | 157 | * Track initialization of winsock |
158 | */ | 158 | */ |
@@ -1822,14 +1822,14 @@ thread_main_handle_connection (void *data) | |||
1822 | else | 1822 | else |
1823 | { | 1823 | { |
1824 | const time_t seconds_left = timeout - (now - con->last_activity); | 1824 | const time_t seconds_left = timeout - (now - con->last_activity); |
1825 | #ifndef _WIN32 | 1825 | #if !defined(_WIN32) || defined(__CYGWIN__) |
1826 | tv.tv_sec = seconds_left; | 1826 | tv.tv_sec = seconds_left; |
1827 | #else /* _WIN32 */ | 1827 | #else /* _WIN32 && !__CYGWIN__ */ |
1828 | if (seconds_left > TIMEVAL_TV_SEC_MAX) | 1828 | if (seconds_left > TIMEVAL_TV_SEC_MAX) |
1829 | tv.tv_sec = TIMEVAL_TV_SEC_MAX; | 1829 | tv.tv_sec = TIMEVAL_TV_SEC_MAX; |
1830 | else | 1830 | else |
1831 | tv.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE) seconds_left; | 1831 | tv.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE) seconds_left; |
1832 | #endif /* _WIN32 */ | 1832 | #endif /* _WIN32 && ! __CYGWIN__ */ |
1833 | } | 1833 | } |
1834 | tv.tv_usec = 0; | 1834 | tv.tv_usec = 0; |
1835 | tvp = &tv; | 1835 | tvp = &tv; |
@@ -2073,7 +2073,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon); | |||
2073 | * and if possible. | 2073 | * and if possible. |
2074 | */ | 2074 | */ |
2075 | #define MHD_TLSLIB_NEED_PUSH_FUNC 1 | 2075 | #define MHD_TLSLIB_NEED_PUSH_FUNC 1 |
2076 | #endif /* !_WIN32 && !MHD_socket_nosignal_ && (GNUTLS_VERSION_NUMBER+0 < 0x030402) */ | 2076 | #endif /* !MHD_WINSOCK_SOCKETS && !MHD_socket_nosignal_ && (GNUTLS_VERSION_NUMBER+0 < 0x030402) */ |
2077 | 2077 | ||
2078 | #ifdef MHD_TLSLIB_NEED_PUSH_FUNC | 2078 | #ifdef MHD_TLSLIB_NEED_PUSH_FUNC |
2079 | /** | 2079 | /** |
@@ -5489,7 +5489,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
5489 | /* Apply the socket options according to listening_address_reuse. */ | 5489 | /* Apply the socket options according to listening_address_reuse. */ |
5490 | if (0 == daemon->listening_address_reuse) | 5490 | if (0 == daemon->listening_address_reuse) |
5491 | { | 5491 | { |
5492 | #ifndef _WIN32 | 5492 | #ifdef MHD_WINSOCK_SOCKETS |
5493 | /* No user requirement, use "traditional" default SO_REUSEADDR | 5493 | /* No user requirement, use "traditional" default SO_REUSEADDR |
5494 | * on non-W32 platforms, and do not fail if it doesn't work. | 5494 | * on non-W32 platforms, and do not fail if it doesn't work. |
5495 | * Don't use it on W32, because on W32 it will allow multiple | 5495 | * Don't use it on W32, because on W32 it will allow multiple |
@@ -5505,12 +5505,12 @@ MHD_start_daemon_va (unsigned int flags, | |||
5505 | MHD_socket_last_strerr_ ()); | 5505 | MHD_socket_last_strerr_ ()); |
5506 | #endif | 5506 | #endif |
5507 | } | 5507 | } |
5508 | #endif /* ! _WIN32 */ | 5508 | #endif /* ! MHD_WINSOCK_SOCKETS */ |
5509 | } | 5509 | } |
5510 | else if (daemon->listening_address_reuse > 0) | 5510 | else if (daemon->listening_address_reuse > 0) |
5511 | { | 5511 | { |
5512 | /* User requested to allow reusing listening address:port. */ | 5512 | /* User requested to allow reusing listening address:port. */ |
5513 | #ifndef _WIN32 | 5513 | #ifndef MHD_WINSOCK_SOCKETS |
5514 | /* Use SO_REUSEADDR on non-W32 platforms, and do not fail if | 5514 | /* Use SO_REUSEADDR on non-W32 platforms, and do not fail if |
5515 | * it doesn't work. */ | 5515 | * it doesn't work. */ |
5516 | if (0 > setsockopt (listen_fd, | 5516 | if (0 > setsockopt (listen_fd, |
@@ -5524,20 +5524,20 @@ MHD_start_daemon_va (unsigned int flags, | |||
5524 | MHD_socket_last_strerr_ ()); | 5524 | MHD_socket_last_strerr_ ()); |
5525 | #endif | 5525 | #endif |
5526 | } | 5526 | } |
5527 | #endif /* ! _WIN32 */ | 5527 | #endif /* ! MHD_WINSOCK_SOCKETS */ |
5528 | /* Use SO_REUSEADDR on Windows and SO_REUSEPORT on most platforms. | 5528 | /* Use SO_REUSEADDR on Windows and SO_REUSEPORT on most platforms. |
5529 | * Fail if SO_REUSEPORT is not defined or setsockopt fails. | 5529 | * Fail if SO_REUSEPORT is not defined or setsockopt fails. |
5530 | */ | 5530 | */ |
5531 | /* SO_REUSEADDR on W32 has the same semantics | 5531 | /* SO_REUSEADDR on W32 has the same semantics |
5532 | as SO_REUSEPORT on BSD/Linux */ | 5532 | as SO_REUSEPORT on BSD/Linux */ |
5533 | #if defined(_WIN32) || defined(SO_REUSEPORT) | 5533 | #if defined(MHD_WINSOCK_SOCKETS) || defined(SO_REUSEPORT) |
5534 | if (0 > setsockopt (listen_fd, | 5534 | if (0 > setsockopt (listen_fd, |
5535 | SOL_SOCKET, | 5535 | SOL_SOCKET, |
5536 | #ifndef _WIN32 | 5536 | #ifndef MHD_WINSOCK_SOCKETS |
5537 | SO_REUSEPORT, | 5537 | SO_REUSEPORT, |
5538 | #else /* _WIN32 */ | 5538 | #else /* MHD_WINSOCK_SOCKETS */ |
5539 | SO_REUSEADDR, | 5539 | SO_REUSEADDR, |
5540 | #endif /* _WIN32 */ | 5540 | #endif /* MHD_WINSOCK_SOCKETS */ |
5541 | (void *) &on, | 5541 | (void *) &on, |
5542 | sizeof (on))) | 5542 | sizeof (on))) |
5543 | { | 5543 | { |
@@ -5548,7 +5548,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
5548 | #endif | 5548 | #endif |
5549 | goto free_and_fail; | 5549 | goto free_and_fail; |
5550 | } | 5550 | } |
5551 | #else /* !_WIN32 && !SO_REUSEPORT */ | 5551 | #else /* !MHD_WINSOCK_SOCKETS && !SO_REUSEPORT */ |
5552 | /* we're supposed to allow address:port re-use, but | 5552 | /* we're supposed to allow address:port re-use, but |
5553 | on this platform we cannot; fail hard */ | 5553 | on this platform we cannot; fail hard */ |
5554 | #ifdef HAVE_MESSAGES | 5554 | #ifdef HAVE_MESSAGES |
@@ -5556,7 +5556,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
5556 | _("Cannot allow listening address reuse: SO_REUSEPORT not defined\n")); | 5556 | _("Cannot allow listening address reuse: SO_REUSEPORT not defined\n")); |
5557 | #endif | 5557 | #endif |
5558 | goto free_and_fail; | 5558 | goto free_and_fail; |
5559 | #endif /* !_WIN32 && !SO_REUSEPORT */ | 5559 | #endif /* !MHD_WINSOCK_SOCKETS && !SO_REUSEPORT */ |
5560 | } | 5560 | } |
5561 | else /* if (daemon->listening_address_reuse < 0) */ | 5561 | else /* if (daemon->listening_address_reuse < 0) */ |
5562 | { | 5562 | { |
@@ -5566,7 +5566,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
5566 | * Fail if MHD was compiled for W32 without SO_EXCLUSIVEADDRUSE | 5566 | * Fail if MHD was compiled for W32 without SO_EXCLUSIVEADDRUSE |
5567 | * or setsockopt fails. | 5567 | * or setsockopt fails. |
5568 | */ | 5568 | */ |
5569 | #if (defined(_WIN32) && defined(SO_EXCLUSIVEADDRUSE)) || \ | 5569 | #if (defined(MHD_WINSOCK_SOCKETS) && defined(SO_EXCLUSIVEADDRUSE)) || \ |
5570 | (defined(__sun) && defined(SO_EXCLBIND)) | 5570 | (defined(__sun) && defined(SO_EXCLBIND)) |
5571 | if (0 > setsockopt (listen_fd, | 5571 | if (0 > setsockopt (listen_fd, |
5572 | SOL_SOCKET, | 5572 | SOL_SOCKET, |
@@ -5585,13 +5585,13 @@ MHD_start_daemon_va (unsigned int flags, | |||
5585 | #endif | 5585 | #endif |
5586 | goto free_and_fail; | 5586 | goto free_and_fail; |
5587 | } | 5587 | } |
5588 | #elif defined(_WIN32) /* SO_EXCLUSIVEADDRUSE not defined on W32? */ | 5588 | #elif defined(MHD_WINSOCK_SOCKETS) /* SO_EXCLUSIVEADDRUSE not defined on W32? */ |
5589 | #ifdef HAVE_MESSAGES | 5589 | #ifdef HAVE_MESSAGES |
5590 | MHD_DLOG (daemon, | 5590 | MHD_DLOG (daemon, |
5591 | _("Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n")); | 5591 | _("Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n")); |
5592 | #endif | 5592 | #endif |
5593 | goto free_and_fail; | 5593 | goto free_and_fail; |
5594 | #endif /* _WIN32 */ | 5594 | #endif /* MHD_WINSOCK_SOCKETS */ |
5595 | } | 5595 | } |
5596 | 5596 | ||
5597 | /* check for user supplied sockaddr */ | 5597 | /* check for user supplied sockaddr */ |
@@ -6698,13 +6698,13 @@ static struct gcry_thread_cbs gcry_threads_w32 = { | |||
6698 | void | 6698 | void |
6699 | MHD_init(void) | 6699 | MHD_init(void) |
6700 | { | 6700 | { |
6701 | #ifdef _WIN32 | 6701 | #if defined(_WIN32) && ! defined(__CYGWIN__) |
6702 | WSADATA wsd; | 6702 | WSADATA wsd; |
6703 | #endif /* _WIN32 */ | 6703 | #endif /* _WIN32 && ! __CYGWIN__ */ |
6704 | mhd_panic = &mhd_panic_std; | 6704 | mhd_panic = &mhd_panic_std; |
6705 | mhd_panic_cls = NULL; | 6705 | mhd_panic_cls = NULL; |
6706 | 6706 | ||
6707 | #ifdef _WIN32 | 6707 | #if defined(_WIN32) && ! defined(__CYGWIN__) |
6708 | if (0 != WSAStartup(MAKEWORD(2, 2), &wsd)) | 6708 | if (0 != WSAStartup(MAKEWORD(2, 2), &wsd)) |
6709 | MHD_PANIC (_("Failed to initialize winsock\n")); | 6709 | MHD_PANIC (_("Failed to initialize winsock\n")); |
6710 | mhd_winsock_inited_ = 1; | 6710 | mhd_winsock_inited_ = 1; |
@@ -6744,7 +6744,7 @@ MHD_fini(void) | |||
6744 | #ifdef HTTPS_SUPPORT | 6744 | #ifdef HTTPS_SUPPORT |
6745 | gnutls_global_deinit (); | 6745 | gnutls_global_deinit (); |
6746 | #endif /* HTTPS_SUPPORT */ | 6746 | #endif /* HTTPS_SUPPORT */ |
6747 | #ifdef _WIN32 | 6747 | #if defined(_WIN32) && ! defined(__CYGWIN__) |
6748 | if (mhd_winsock_inited_) | 6748 | if (mhd_winsock_inited_) |
6749 | WSACleanup(); | 6749 | WSACleanup(); |
6750 | #endif | 6750 | #endif |
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c index 509652e8..7226becf 100644 --- a/src/microhttpd/digestauth.c +++ b/src/microhttpd/digestauth.c | |||
@@ -30,12 +30,12 @@ | |||
30 | #include "mhd_str.h" | 30 | #include "mhd_str.h" |
31 | #include "mhd_compat.h" | 31 | #include "mhd_compat.h" |
32 | 32 | ||
33 | #if defined(_WIN32) && defined(MHD_W32_MUTEX_) | 33 | #if defined(MHD_W32_MUTEX_) |
34 | #ifndef WIN32_LEAN_AND_MEAN | 34 | #ifndef WIN32_LEAN_AND_MEAN |
35 | #define WIN32_LEAN_AND_MEAN 1 | 35 | #define WIN32_LEAN_AND_MEAN 1 |
36 | #endif /* !WIN32_LEAN_AND_MEAN */ | 36 | #endif /* !WIN32_LEAN_AND_MEAN */ |
37 | #include <windows.h> | 37 | #include <windows.h> |
38 | #endif /* _WIN32 && MHD_W32_MUTEX_ */ | 38 | #endif /* MHD_W32_MUTEX_ */ |
39 | 39 | ||
40 | #define HASH_MD5_HEX_LEN (2 * MD5_DIGEST_SIZE) | 40 | #define HASH_MD5_HEX_LEN (2 * MD5_DIGEST_SIZE) |
41 | /* 32 bit value is 4 bytes */ | 41 | /* 32 bit value is 4 bytes */ |
diff --git a/src/microhttpd/mhd_compat.h b/src/microhttpd/mhd_compat.h index fca84b84..b4e2c66c 100644 --- a/src/microhttpd/mhd_compat.h +++ b/src/microhttpd/mhd_compat.h | |||
@@ -47,13 +47,13 @@ | |||
47 | #if defined(HAVE_SNPRINTF) | 47 | #if defined(HAVE_SNPRINTF) |
48 | #define MHD_snprintf_ snprintf | 48 | #define MHD_snprintf_ snprintf |
49 | #else /* ! HAVE_SNPRINTF */ | 49 | #else /* ! HAVE_SNPRINTF */ |
50 | #if defined(_WIN32) | 50 | #if defined(_WIN32) && ! defined(__CYGWIN__) |
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 | #define MHD_snprintf_ W32_snprintf | 53 | #define MHD_snprintf_ W32_snprintf |
54 | #else /* ! _WIN32*/ | 54 | #else /* ! _WIN32 || __CYGWIN__ */ |
55 | #error Your platform does not support snprintf() and MHD does not know how to emulate it on your platform. | 55 | #error Your platform does not support snprintf() and MHD does not know how to emulate it on your platform. |
56 | #endif /* ! _WIN32*/ | 56 | #endif /* ! _WIN32 || __CYGWIN__ */ |
57 | #endif /* ! HAVE_SNPRINTF */ | 57 | #endif /* ! HAVE_SNPRINTF */ |
58 | 58 | ||
59 | #ifdef HAVE_RANDOM | 59 | #ifdef HAVE_RANDOM |
diff --git a/src/microhttpd/mhd_mono_clock.c b/src/microhttpd/mhd_mono_clock.c index 353e04c0..97dbfb9f 100644 --- a/src/microhttpd/mhd_mono_clock.c +++ b/src/microhttpd/mhd_mono_clock.c | |||
@@ -25,10 +25,10 @@ | |||
25 | 25 | ||
26 | #include "mhd_mono_clock.h" | 26 | #include "mhd_mono_clock.h" |
27 | 27 | ||
28 | #if defined(_WIN32) && defined(HAVE_CLOCK_GETTIME) | 28 | #if defined(_WIN32) && ! defined(__CYGWIN__) && defined(HAVE_CLOCK_GETTIME) |
29 | /* Prefer native clock source over wrappers */ | 29 | /* Prefer native clock source over wrappers */ |
30 | #undef HAVE_CLOCK_GETTIME | 30 | #undef HAVE_CLOCK_GETTIME |
31 | #endif /* _WIN32 && HAVE_CLOCK_GETTIME */ | 31 | #endif /* _WIN32 && ! __CYGWIN__ && HAVE_CLOCK_GETTIME */ |
32 | 32 | ||
33 | #ifdef HAVE_CLOCK_GETTIME | 33 | #ifdef HAVE_CLOCK_GETTIME |
34 | #include <time.h> | 34 | #include <time.h> |
diff --git a/src/microhttpd/mhd_sockets.h b/src/microhttpd/mhd_sockets.h index 4a4c5cd9..b013baad 100644 --- a/src/microhttpd/mhd_sockets.h +++ b/src/microhttpd/mhd_sockets.h | |||
@@ -358,7 +358,7 @@ | |||
358 | 358 | ||
359 | /* MHD_POLL_EVENTS_ERR_DISC is 'events' mask for errors and disconnect. | 359 | /* MHD_POLL_EVENTS_ERR_DISC is 'events' mask for errors and disconnect. |
360 | * Note: Out-of-band data is treated as error. */ | 360 | * Note: Out-of-band data is treated as error. */ |
361 | # if defined(_WIN32) | 361 | # if defined(_WIN32) && ! defined(__CYGWIN__) |
362 | # define MHD_POLL_EVENTS_ERR_DISC POLLRDBAND | 362 | # define MHD_POLL_EVENTS_ERR_DISC POLLRDBAND |
363 | # elif defined(__linux__) | 363 | # elif defined(__linux__) |
364 | # define MHD_POLL_EVENTS_ERR_DISC POLLPRI | 364 | # define MHD_POLL_EVENTS_ERR_DISC POLLPRI |
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c index 18ba625d..d677cf62 100644 --- a/src/microhttpd/response.c +++ b/src/microhttpd/response.c | |||
@@ -30,9 +30,9 @@ | |||
30 | #ifdef HAVE_SYS_IOCTL_H | 30 | #ifdef HAVE_SYS_IOCTL_H |
31 | #include <sys/ioctl.h> | 31 | #include <sys/ioctl.h> |
32 | #endif /* HAVE_SYS_IOCTL_H */ | 32 | #endif /* HAVE_SYS_IOCTL_H */ |
33 | #ifdef _WIN32 | 33 | #if defined(_WIN32) && ! defined(__CYGWIN__) |
34 | #include <windows.h> | 34 | #include <windows.h> |
35 | #endif /* _WIN32 */ | 35 | #endif /* _WIN32 && !__CYGWIN__ */ |
36 | 36 | ||
37 | #include "internal.h" | 37 | #include "internal.h" |
38 | #include "response.h" | 38 | #include "response.h" |
@@ -45,12 +45,12 @@ | |||
45 | #include "mhd_compat.h" | 45 | #include "mhd_compat.h" |
46 | 46 | ||
47 | 47 | ||
48 | #if defined(_WIN32) && defined(MHD_W32_MUTEX_) | 48 | #if defined(MHD_W32_MUTEX_) |
49 | #ifndef WIN32_LEAN_AND_MEAN | 49 | #ifndef WIN32_LEAN_AND_MEAN |
50 | #define WIN32_LEAN_AND_MEAN 1 | 50 | #define WIN32_LEAN_AND_MEAN 1 |
51 | #endif /* !WIN32_LEAN_AND_MEAN */ | 51 | #endif /* !WIN32_LEAN_AND_MEAN */ |
52 | #include <windows.h> | 52 | #include <windows.h> |
53 | #endif /* _WIN32 && MHD_W32_MUTEX_ */ | 53 | #endif /* MHD_W32_MUTEX_ */ |
54 | #if defined(_WIN32) | 54 | #if defined(_WIN32) |
55 | #include <io.h> /* for lseek(), read() */ | 55 | #include <io.h> /* for lseek(), read() */ |
56 | #endif /* _WIN32 */ | 56 | #endif /* _WIN32 */ |
@@ -393,17 +393,17 @@ file_reader (void *cls, | |||
393 | size_t max) | 393 | size_t max) |
394 | { | 394 | { |
395 | struct MHD_Response *response = cls; | 395 | struct MHD_Response *response = cls; |
396 | #ifndef _WIN32 | 396 | #if !defined(_WIN32) || defined(__CYGWIN__) |
397 | ssize_t n; | 397 | ssize_t n; |
398 | #else /* _WIN32 */ | 398 | #else /* _WIN32 && !__CYGWIN__ */ |
399 | const HANDLE fh = (HANDLE) _get_osfhandle (response->fd); | 399 | const HANDLE fh = (HANDLE) _get_osfhandle (response->fd); |
400 | #endif /* _WIN32 */ | 400 | #endif /* _WIN32 && !__CYGWIN__ */ |
401 | const int64_t offset64 = (int64_t)(pos + response->fd_off); | 401 | const int64_t offset64 = (int64_t)(pos + response->fd_off); |
402 | 402 | ||
403 | if (offset64 < 0) | 403 | if (offset64 < 0) |
404 | return MHD_CONTENT_READER_END_WITH_ERROR; /* seek to required position is not possible */ | 404 | return MHD_CONTENT_READER_END_WITH_ERROR; /* seek to required position is not possible */ |
405 | 405 | ||
406 | #ifndef _WIN32 | 406 | #if !defined(_WIN32) || defined(__CYGWIN__) |
407 | if (max > SSIZE_MAX) | 407 | if (max > SSIZE_MAX) |
408 | max = SSIZE_MAX; /* Clamp to maximum return value. */ | 408 | max = SSIZE_MAX; /* Clamp to maximum return value. */ |
409 | 409 | ||
@@ -441,7 +441,7 @@ file_reader (void *cls, | |||
441 | if (n < 0) | 441 | if (n < 0) |
442 | return MHD_CONTENT_READER_END_WITH_ERROR; | 442 | return MHD_CONTENT_READER_END_WITH_ERROR; |
443 | return n; | 443 | return n; |
444 | #else /* _WIN32 */ | 444 | #else /* _WIN32 && !__CYGWIN__ */ |
445 | if (INVALID_HANDLE_VALUE == fh) | 445 | if (INVALID_HANDLE_VALUE == fh) |
446 | return MHD_CONTENT_READER_END_WITH_ERROR; /* Value of 'response->fd' is not valid. */ | 446 | return MHD_CONTENT_READER_END_WITH_ERROR; /* Value of 'response->fd' is not valid. */ |
447 | else | 447 | else |
@@ -460,7 +460,7 @@ file_reader (void *cls, | |||
460 | return MHD_CONTENT_READER_END_OF_STREAM; | 460 | return MHD_CONTENT_READER_END_OF_STREAM; |
461 | return (ssize_t) resRead; | 461 | return (ssize_t) resRead; |
462 | } | 462 | } |
463 | #endif /* _WIN32 */ | 463 | #endif /* _WIN32 && !__CYGWIN__ */ |
464 | } | 464 | } |
465 | 465 | ||
466 | 466 | ||
diff --git a/src/microhttpd/test_helpers.h b/src/microhttpd/test_helpers.h index c3f0f7be..4f015ef2 100644 --- a/src/microhttpd/test_helpers.h +++ b/src/microhttpd/test_helpers.h | |||
@@ -53,10 +53,10 @@ has_in_name(const char *prog_name, const char *marker) | |||
53 | { | 53 | { |
54 | if ('/' == prog_name[pos]) | 54 | if ('/' == prog_name[pos]) |
55 | name_pos = pos + 1; | 55 | name_pos = pos + 1; |
56 | #ifdef _WIN32 | 56 | #if defined(_WIN32) || defined(__CYGWIN__) |
57 | else if ('\\' == prog_name[pos]) | 57 | else if ('\\' == prog_name[pos]) |
58 | name_pos = pos + 1; | 58 | name_pos = pos + 1; |
59 | #endif /* _WIN32 */ | 59 | #endif /* _WIN32 || __CYGWIN__ */ |
60 | pos++; | 60 | pos++; |
61 | } | 61 | } |
62 | if (name_pos == pos) | 62 | if (name_pos == pos) |
diff --git a/src/microhttpd/test_shutdown_select.c b/src/microhttpd/test_shutdown_select.c index 1e4e3d82..934cde79 100644 --- a/src/microhttpd/test_shutdown_select.c +++ b/src/microhttpd/test_shutdown_select.c | |||
@@ -105,10 +105,10 @@ has_in_name(const char *prog_name, const char *marker) | |||
105 | { | 105 | { |
106 | if ('/' == prog_name[pos]) | 106 | if ('/' == prog_name[pos]) |
107 | name_pos = pos + 1; | 107 | name_pos = pos + 1; |
108 | #ifdef _WIN32 | 108 | #if defined(_WIN32) || defined(__CYGWIN__) |
109 | else if ('\\' == prog_name[pos]) | 109 | else if ('\\' == prog_name[pos]) |
110 | name_pos = pos + 1; | 110 | name_pos = pos + 1; |
111 | #endif /* _WIN32 */ | 111 | #endif /* _WIN32 || __CYGWIN__ */ |
112 | pos++; | 112 | pos++; |
113 | } | 113 | } |
114 | if (name_pos == pos) | 114 | if (name_pos == pos) |