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:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-05-28 20:50:40 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-05-28 21:21:39 +0400
commit973f95fa9dfb21e4347a510f119c55b9673f6076 (patch)
tree9c08ca5e2803b3b816f4e443938a80ea9319df20 /source/blender
parent74cc3974fea0422343b09bdd61e4d3924c62940a (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')
-rw-r--r--source/blender/blenkernel/intern/bpath.c2
-rw-r--r--source/blender/blenkernel/intern/packedFile.c2
-rw-r--r--source/blender/blenkernel/intern/text.c4
-rw-r--r--source/blender/blenlib/BLI_fileops.h13
-rw-r--r--source/blender/blenlib/intern/storage.c10
-rw-r--r--source/blender/editors/space_file/filesel.c2
-rw-r--r--source/blender/editors/space_text/text_ops.c2
-rw-r--r--source/blender/imbuf/intern/thumbs.c4
-rw-r--r--source/blender/imbuf/intern/util.c4
9 files changed, 27 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index d0883728a71..3fca58bd088 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -210,7 +210,7 @@ static int findFileRecursive(char *filename_new,
/* file searching stuff */
DIR *dir;
struct dirent *de;
- struct stat status;
+ BLI_stat_t status;
char path[FILE_MAX];
int size;
bool found = false;
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index dafe5ca55ff..d186b4299a5 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -368,7 +368,7 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i
int checkPackedFile(const char *filename, PackedFile *pf)
{
- struct stat st;
+ BLI_stat_t st;
int ret_val, i, len, file;
char buf[4096];
char name[FILE_MAX];
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index b6d7e8922c4..90687ef9916 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -667,7 +667,7 @@ void BKE_text_write(Text *text, const char *str) /* called directly from rna */
int BKE_text_file_modified_check(Text *text)
{
- struct stat st;
+ BLI_stat_t st;
int result;
char file[FILE_MAX];
@@ -696,7 +696,7 @@ int BKE_text_file_modified_check(Text *text)
void BKE_text_file_modified_ignore(Text *text)
{
- struct stat st;
+ BLI_stat_t st;
int result;
char file[FILE_MAX];
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
index 7c10e50acc4..c032b606900 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -59,7 +59,18 @@ int BLI_rename(const char *from, const char *to);
int BLI_delete(const char *path, bool dir, bool recursive);
int BLI_move(const char *path, const char *to);
int BLI_create_symlink(const char *path, const char *to);
-int BLI_stat(const char *path, struct stat *buffer);
+
+#ifdef WIN32
+# ifndef __MINGW64__
+typedef struct _stat64 BLI_stat_t;
+# else
+typedef struct stat BLI_stat_t;
+#endif
+#else
+typedef struct stat BLI_stat_t;
+#endif
+
+int BLI_stat(const char *path, BLI_stat_t *buffer);
/* Directories */
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
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index e8371d7666b..81ab276ccc0 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -656,7 +656,7 @@ int autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
}
else {
char path[FILE_MAX];
- struct stat status;
+ BLI_stat_t status;
BLI_join_dirfile(path, sizeof(path), dirname, de->d_name);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 0263b6cd912..fcd6fb3c179 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -458,7 +458,7 @@ static void txt_write_file(Text *text, ReportList *reports)
{
FILE *fp;
TextLine *tmp;
- struct stat st;
+ BLI_stat_t st;
char filepath[FILE_MAX];
BLI_strncpy(filepath, text->name, FILE_MAX);
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index b4c97a2aea1..236d41078d6 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -305,7 +305,7 @@ ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, Im
short tsize = 128;
short ex, ey;
float scaledx, scaledy;
- struct stat info;
+ BLI_stat_t info;
switch (size) {
case THB_NORMAL:
@@ -472,7 +472,7 @@ ImBuf *IMB_thumb_manage(const char *path, ThumbSize size, ThumbSource source)
{
char thumb[FILE_MAX];
char uri[URI_MAX];
- struct stat st;
+ BLI_stat_t st;
ImBuf *img = NULL;
if (BLI_stat(path, &st)) {
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index fbb28849ce6..b912c3e229a 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -187,7 +187,7 @@ int IMB_ispic_type(const char *name)
unsigned char buf[HEADER_SIZE];
ImFileType *type;
- struct stat st;
+ BLI_stat_t st;
int fp;
if (UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name);
@@ -391,7 +391,7 @@ static int isredcode(const char *filename)
int imb_get_anim_type(const char *name)
{
int type;
- struct stat st;
+ BLI_stat_t st;
if (UTIL_DEBUG) printf("in getanimtype: %s\n", name);