From 7ba82f3f0a848aedcc0f3b3f73a429f740792dbe Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 19 Mar 2019 20:04:23 +1100 Subject: Fix T62707: opening blend files over 2gb on win32 fails Regression in 358e07f447e9ed7 for ms-windows since off_t is an int32_t even on 64bit systems causing files over 2gb not to load. Poison off_t so this doesn't happen again. --- source/blender/blenloader/intern/readfile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/blenloader/intern/readfile.c') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 93ef7fe5b73..b8131c8abbb 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -264,7 +264,7 @@ typedef struct BHeadN { struct BHeadN *next, *prev; #ifdef USE_BHEAD_READ_ON_DEMAND /** Use to read the data from the file directly into memory as needed. */ - off_t file_offset; + off64_t file_offset; /** When set, the remainder of this allocation is the data, otherwise it needs to be read. */ bool has_data; #endif @@ -838,7 +838,7 @@ static BHeadN *get_bhead(FileData *fd) new_bhead->file_offset = fd->file_offset; new_bhead->has_data = false; new_bhead->bhead = bhead; - off_t seek_new = fd->seek(fd, bhead.len, SEEK_CUR); + off64_t seek_new = fd->seek(fd, bhead.len, SEEK_CUR); if (seek_new == -1) { fd->is_eof = true; MEM_freeN(new_bhead); @@ -946,7 +946,7 @@ static bool blo_bhead_read_data(FileData *fd, BHead *thisblock, void *buf) bool success = true; BHeadN *new_bhead = BHEADN_FROM_BHEAD(thisblock); BLI_assert(new_bhead->has_data == false && new_bhead->file_offset != 0); - off_t offset_backup = fd->file_offset; + off64_t offset_backup = fd->file_offset; if (UNLIKELY(fd->seek(fd, new_bhead->file_offset, SEEK_SET) == -1)) { success = false; } @@ -1136,7 +1136,7 @@ static int fd_read_data_from_file(FileData *filedata, void *buffer, uint size) return (readsize); } -static off_t fd_seek_data_from_file(FileData *filedata, off_t offset, int whence) +static off64_t fd_seek_data_from_file(FileData *filedata, off64_t offset, int whence) { filedata->file_offset = lseek(filedata->filedes, offset, whence); return filedata->file_offset; -- cgit v1.2.3