Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-11-06 19:16:46 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-11-06 19:16:46 +0300
commit64cd9a079b987e1ef3daf926bd5af26185e297a5 (patch)
treec97765e392afd910473c8a8fe6a39ca675529c73 /source/blender/blenlib/intern/storage.c
parent65b414cfb291e8ae47e92ab1b101de3fa6d19704 (diff)
Fix T70952: EXR files bigger than 2GB don't open on Windows
Diffstat (limited to 'source/blender/blenlib/intern/storage.c')
-rw-r--r--source/blender/blenlib/intern/storage.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index fd5de717a24..7c481868d64 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -180,8 +180,8 @@ double BLI_dir_free_space(const char *dir)
*/
size_t BLI_file_descriptor_size(int file)
{
- struct stat st;
- if ((file < 0) || (fstat(file, &st) == -1)) {
+ BLI_stat_t st;
+ if ((file < 0) || (BLI_fstat(file, &st) == -1)) {
return -1;
}
return st.st_size;
@@ -246,6 +246,15 @@ int BLI_exists(const char *name)
}
#ifdef WIN32
+int BLI_fstat(int fd, BLI_stat_t *buffer)
+{
+# if defined(_MSC_VER)
+ return _fstat64(fd, buffer);
+# else
+ return _fstat(fd, buffer);
+# endif
+}
+
int BLI_stat(const char *path, BLI_stat_t *buffer)
{
int r;
@@ -266,6 +275,11 @@ int BLI_wstat(const wchar_t *path, BLI_stat_t *buffer)
# endif
}
#else
+int BLI_fstat(int fd, struct stat *buffer)
+{
+ return fstat(fd, buffer);
+}
+
int BLI_stat(const char *path, struct stat *buffer)
{
return stat(path, buffer);
@@ -298,8 +312,8 @@ static void *file_read_data_as_mem_impl(FILE *fp,
size_t pad_bytes,
size_t *r_size)
{
- struct stat st;
- if (fstat(fileno(fp), &st) == -1) {
+ BLI_stat_t st;
+ if (BLI_fstat(fileno(fp), &st) == -1) {
return NULL;
}
if (S_ISDIR(st.st_mode)) {