diff --git a/contrib/win32/win32compat/fileio.c b/contrib/win32/win32compat/fileio.c index 3b3a99c41..2cb08557e 100644 --- a/contrib/win32/win32compat/fileio.c +++ b/contrib/win32/win32compat/fileio.c @@ -811,7 +811,7 @@ cleanup: } long -fileio_lseek(struct w32_io* pio, long offset, int origin) +fileio_lseek(struct w32_io* pio, unsigned __int64 offset, int origin) { debug4("lseek - pio:%p", pio); if (origin != SEEK_SET) { @@ -820,8 +820,9 @@ fileio_lseek(struct w32_io* pio, long offset, int origin) return -1; } - pio->read_overlapped.Offset = offset; - pio->write_overlapped.Offset = offset; + pio->write_overlapped.Offset = pio->read_overlapped.Offset = offset & 0xffffffff; + pio->write_overlapped.OffsetHigh = pio->read_overlapped.OffsetHigh = (offset & 0xffffffff00000000) >> 32; + return 0; } diff --git a/contrib/win32/win32compat/inc/unistd.h b/contrib/win32/win32compat/inc/unistd.h index 688caae93..25d55c307 100644 --- a/contrib/win32/win32compat/inc/unistd.h +++ b/contrib/win32/win32compat/inc/unistd.h @@ -46,7 +46,7 @@ int w32_dup2(int oldfd, int newfd); unsigned int w32_alarm(unsigned int seconds); #define alarm w32_alarm -long w32_lseek(int fd, long offset, int origin); +long w32_lseek(int fd, unsigned __int64 offset, int origin); #define lseek w32_lseek #define getdtablesize() MAX_FDS diff --git a/contrib/win32/win32compat/w32fd.c b/contrib/win32/win32compat/w32fd.c index 6a9d13293..91394dc6a 100644 --- a/contrib/win32/win32compat/w32fd.c +++ b/contrib/win32/win32compat/w32fd.c @@ -484,7 +484,7 @@ w32_fstat(int fd, struct w32_stat *buf) } long -w32_lseek(int fd, long offset, int origin) +w32_lseek(int fd, unsigned __int64 offset, int origin) { CHECK_FD(fd); return fileio_lseek(fd_table.w32_ios[fd], offset, origin); diff --git a/contrib/win32/win32compat/w32fd.h b/contrib/win32/win32compat/w32fd.h index 7bb4335a0..1768a3488 100644 --- a/contrib/win32/win32compat/w32fd.h +++ b/contrib/win32/win32compat/w32fd.h @@ -163,5 +163,5 @@ int fileio_read(struct w32_io* pio, void *dst, size_t max); int fileio_write(struct w32_io* pio, const void *buf, size_t max); int fileio_fstat(struct w32_io* pio, struct _stat64 *buf); int fileio_stat(const char *path, struct _stat64 *buf); -long fileio_lseek(struct w32_io* pio, long offset, int origin); +long fileio_lseek(struct w32_io* pio, unsigned __int64 offset, int origin); FILE* fileio_fdopen(struct w32_io* pio, const char *mode);