This change has no effect on non-windows platforms, since those
either define off_t to 64-bits, or allow you to decide whether
it should be 64-bits yourself via some LARGEFILE-like macro.
On Windows, however, off_t is always 32-bit, so it's a bad choice
for "file size" or "file offset" values. Instead, I'm adding
an ev_off_t type, and using it in the one place where we used
off_t to mean "the size of a file" or "an offset into a file" in the
API.
This breaks ABI compatibility on Windows.
*/
int
evbuffer_add_file(struct evbuffer *outbuf, int fd,
- off_t offset, off_t length)
+ ev_off_t offset, ev_off_t length)
{
#if defined(USE_SENDFILE) || defined(_EVENT_HAVE_MMAP)
struct evbuffer_chain *chain;
return (-1);
#ifdef WIN32
-#define lseek _lseek
+#define lseek _lseeki64
#endif
if (lseek(fd, offset, SEEK_SET) == -1) {
evbuffer_free(tmp);
@return 0 if successful, or -1 if an error occurred
*/
-int evbuffer_add_file(struct evbuffer *output, int fd, off_t offset,
- off_t length);
+int evbuffer_add_file(struct evbuffer *output, int fd, ev_off_t offset,
+ ev_off_t length);
/**
Append a formatted string to the end of an evbuffer.
#define ev_ssize_t ssize_t
#endif
+#ifdef WIN32
+#define ev_off_t ev_int64_t
+#else
+#define ev_off_t off_t
+#endif
+
/* Limits for integer types.
We're making two assumptions here: