aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/response.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/response.c')
-rw-r--r--src/microhttpd/response.c20
1 files changed, 10 insertions, 10 deletions
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