diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 8 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.h | 11 |
2 files changed, 13 insertions, 6 deletions
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; diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index 9e970b9ae5d..a1af4bfad16 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -48,10 +48,17 @@ enum eFileDataFlag { FD_FLAGS_NOT_MY_LIBMAP = 1 << 5, }; +/* Disallow since it's 32bit on ms-windows. */ +#ifdef __GNUC__ +# pragma GCC poison off_t +#endif +#if defined(_MSC_VER) +typedef int64_t off64_t; +#endif typedef int (FileDataReadFn)(struct FileData *filedata, void *buffer, unsigned int size); -typedef off_t (FileDataSeekFn)(struct FileData *filedata, off_t offset, int whence); +typedef off64_t (FileDataSeekFn)(struct FileData *filedata, off64_t offset, int whence); typedef struct FileData { /** Linked list of BHeadN's. */ @@ -59,7 +66,7 @@ typedef struct FileData { enum eFileDataFlag flags; bool is_eof; int buffersize; - off_t file_offset; + int64_t file_offset; FileDataReadFn *read; FileDataSeekFn *seek; |