47 #if !defined(_WIN32) || defined(__CYGWIN__) 50 const HANDLE fh = (HANDLE) _get_osfhandle (response->
fd);
52 const int64_t offset64 = (int64_t)(pos + response->
fd_off);
57 #if !defined(_WIN32) || defined(__CYGWIN__) 61 #if defined(HAVE_PREAD64) 62 n = pread64 (response->
fd,
66 #elif defined(HAVE_PREAD) 67 if ( (
sizeof(off_t) <
sizeof (uint64_t)) &&
71 n = pread (response->
fd,
76 #if defined(HAVE_LSEEK64) 77 if (lseek64 (response->
fd,
79 SEEK_SET) != offset64)
82 if ( (
sizeof(off_t) <
sizeof (uint64_t)) &&
86 if (lseek (response->
fd,
88 SEEK_SET) != (off_t) offset64)
91 n = read (response->
fd,
102 if (INVALID_HANDLE_VALUE == fh)
106 OVERLAPPED f_ol = {0, 0, {{0, 0}}, 0};
107 ULARGE_INTEGER pos_uli;
111 pos_uli.QuadPart = (uint64_t) offset64;
112 f_ol.Offset = pos_uli.LowPart;
113 f_ol.OffsetHigh = pos_uli.HighPart;
122 return (ssize_t) resRead;
139 (void) close (response->
fd);
171 #if !defined(HAVE___LSEEKI64) && !defined(HAVE_LSEEK64) 172 if ( (
sizeof (uint64_t) >
sizeof (off_t)) &&
178 if ( ((int64_t) size < 0) ||
180 ((int64_t) (size +
offset) < 0) )
189 if (
NULL == response)
static void free_callback(void *cls)
internal shared structures
struct MHD_Response * MHD_response_from_fd(enum MHD_HTTP_StatusCode sc, int fd, uint64_t offset, uint64_t size)
#define MHD_CONTENT_READER_END_OF_STREAM
static ssize_t file_reader(void *cls, uint64_t pos, char *buf, size_t max)
#define MHD_CONTENT_READER_END_WITH_ERROR
struct MHD_Response * MHD_response_from_callback(enum MHD_HTTP_StatusCode sc, uint64_t size, size_t block_size, MHD_ContentReaderCallback crc, void *crc_cls, MHD_ContentReaderFreeCallback crfc)