diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-05-28 20:50:40 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-05-28 21:21:39 +0400 |
commit | 973f95fa9dfb21e4347a510f119c55b9673f6076 (patch) | |
tree | 9c08ca5e2803b3b816f4e443938a80ea9319df20 /source/blender/blenlib/intern/storage.c | |
parent | 74cc3974fea0422343b09bdd61e4d3924c62940a (diff) |
Fix T40157: Loading movies larger than 4GB in size fails
Issue was caused by _wstat returning EOVERFLOW error because
of file size didn't fit into stat structure which was using
long datatype.
The idea of this patch is to use _wstat64 and _stat64 structure
which is capable storing 64bit file sizes.
Made it a typedef for stat structure used by BLI_stat function
in order to make code easier to follow and avoid ifdefs all
over the place.
Additionally solved issue with BLI_exists which was wrongly
returning False in cases destination file is larger then 4GB.
Diffstat (limited to 'source/blender/blenlib/intern/storage.c')
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 2c6fc9f2058..a5de1072372 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -460,7 +460,7 @@ size_t BLI_file_descriptor_size(int file) */ size_t BLI_file_size(const char *path) { - struct stat stats; + BLI_stat_t stats; if (BLI_stat(path, &stats) == -1) return -1; return stats.st_size; @@ -474,7 +474,7 @@ int BLI_exists(const char *name) { #if defined(WIN32) #ifndef __MINGW32__ - struct _stat64i32 st; + struct _stat64 st; #else struct _stati64 st; #endif @@ -507,7 +507,7 @@ int BLI_exists(const char *name) old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); #ifndef __MINGW32__ - res = _wstat(tmp_16, &st); + res = _wstat64(tmp_16, &st); #else res = _wstati64(tmp_16, &st); #endif @@ -525,14 +525,14 @@ int BLI_exists(const char *name) #ifdef WIN32 -int BLI_stat(const char *path, struct stat *buffer) +int BLI_stat(const char *path, BLI_stat_t *buffer) { int r; UTF16_ENCODE(path); /* workaround error in MinGW64 headers, normally, a wstat should work */ #ifndef __MINGW64__ - r = _wstat(path_16, buffer); + r = _wstat64(path_16, buffer); #else r = _wstati64(path_16, buffer); #endif |