diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2015-06-09 19:34:07 +0000 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2015-06-09 19:34:07 +0000 |
commit | 67859a6401f2b7e4daf11067aa188c4f6f669432 (patch) | |
tree | a4f1778e09b765d8133a0323d019b97b7ee72b35 | |
parent | 09088de0dbfb52843d4a960041b1f560b4c0e1b1 (diff) | |
download | libmicrohttpd-67859a6401f2b7e4daf11067aa188c4f6f669432.tar.gz libmicrohttpd-67859a6401f2b7e4daf11067aa188c4f6f669432.zip |
response.c: file_reader(): add support for W32 64-bit seek
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/microhttpd/response.c | 5 | ||||
-rw-r--r-- | w32/VS2013/MHD_config.h | 3 |
3 files changed, 9 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 3f7fb8f6..1e1187ad 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -608,6 +608,7 @@ AM_CONDITIONAL(HAVE_SPDYLAY, [test "x$have_spdylay" = "xyes"]) | |||
608 | # large file support (> 4 GB) | 608 | # large file support (> 4 GB) |
609 | AC_SYS_LARGEFILE | 609 | AC_SYS_LARGEFILE |
610 | AC_FUNC_FSEEKO | 610 | AC_FUNC_FSEEKO |
611 | AC_CHECK_FUNCS([_lseeki64]) | ||
611 | 612 | ||
612 | # optional: have error messages ? | 613 | # optional: have error messages ? |
613 | AC_MSG_CHECKING(whether to generate error messages) | 614 | AC_MSG_CHECKING(whether to generate error messages) |
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c index 4a6382f8..32e679f4 100644 --- a/src/microhttpd/response.c +++ b/src/microhttpd/response.c | |||
@@ -329,11 +329,16 @@ file_reader (void *cls, uint64_t pos, char *buf, size_t max) | |||
329 | if (offset64 < 0) | 329 | if (offset64 < 0) |
330 | return MHD_CONTENT_READER_END_WITH_ERROR; /* seek to required position is not possible */ | 330 | return MHD_CONTENT_READER_END_WITH_ERROR; /* seek to required position is not possible */ |
331 | 331 | ||
332 | #if defined(HAVE___LSEEKI64) | ||
333 | if (_lseeki64 (response->fd, offset64, SEEK_SET) != offset64) | ||
334 | return MHD_CONTENT_READER_END_WITH_ERROR; /* can't seek to required position */ | ||
335 | #else /* !HAVE___LSEEKI64 */ | ||
332 | if (sizeof(off_t) < sizeof(uint64_t) && offset64 > (uint64_t)INT32_MAX) | 336 | if (sizeof(off_t) < sizeof(uint64_t) && offset64 > (uint64_t)INT32_MAX) |
333 | return MHD_CONTENT_READER_END_WITH_ERROR; /* seek to required position is not possible */ | 337 | return MHD_CONTENT_READER_END_WITH_ERROR; /* seek to required position is not possible */ |
334 | 338 | ||
335 | if (lseek (response->fd, (off_t)offset64, SEEK_SET) != (off_t)offset64) | 339 | if (lseek (response->fd, (off_t)offset64, SEEK_SET) != (off_t)offset64) |
336 | return MHD_CONTENT_READER_END_WITH_ERROR; /* can't seek to required position */ | 340 | return MHD_CONTENT_READER_END_WITH_ERROR; /* can't seek to required position */ |
341 | #endif | ||
337 | 342 | ||
338 | n = read (response->fd, buf, max); | 343 | n = read (response->fd, buf, max); |
339 | if (0 == n) | 344 | if (0 == n) |
diff --git a/w32/VS2013/MHD_config.h b/w32/VS2013/MHD_config.h index 07f1fbbb..645389b2 100644 --- a/w32/VS2013/MHD_config.h +++ b/w32/VS2013/MHD_config.h | |||
@@ -70,6 +70,9 @@ | |||
70 | don't. */ | 70 | don't. */ |
71 | #define HAVE_DECL_TCP_NOPUSH 0 | 71 | #define HAVE_DECL_TCP_NOPUSH 0 |
72 | 72 | ||
73 | /* Define to 1 if you have the `_lseeki64' function. */ | ||
74 | #define HAVE___LSEEKI64 1 | ||
75 | |||
73 | 76 | ||
74 | /* *** Headers information *** */ | 77 | /* *** Headers information *** */ |
75 | /* Not really important as not used by code currently */ | 78 | /* Not really important as not used by code currently */ |