From 569bb8f47d62f40004f87a4862d87b4b1937fecb Mon Sep 17 00:00:00 2001 From: Andrea Weikert Date: Sun, 26 Jul 2009 12:40:44 +0000 Subject: 2.5 filebrowser Bugfixes: * crash when loading file that has filebrowser open * file size over 2GB/4GB? shows negative number Other: * tried to improve drawing speed a bit by only drawing the files actually shown and improving refresh behaviour a bit. Note: Solution I found so far is to use the non-standard _stat64, as far as I could see, WIN64 should work without that patch (Genscher, please check and if needed you can enable this too by removing the !defined(WIN64) ) This probably needs to be fixed in at least one other place (BLI_filesize), will look into this once this fix proves stable enough) --- source/blender/blenlib/BLI_storage_types.h | 4 ++++ source/blender/blenlib/intern/storage.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_storage_types.h b/source/blender/blenlib/BLI_storage_types.h index 385aa39e6cb..9430ac8c5ff 100644 --- a/source/blender/blenlib/BLI_storage_types.h +++ b/source/blender/blenlib/BLI_storage_types.h @@ -55,7 +55,11 @@ struct direntry{ char *string; mode_t type; char *relname; +#if defined(WIN32) && !defined(WIN64) && (_MSC_VER>=1500) + struct _stat64 s; +#else struct stat s; +#endif unsigned int flags; char size[16]; char mode1[4]; diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 7af383e2356..997d9b9c3f1 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -265,7 +265,13 @@ void BLI_builddir(char *dirname, char *relname) while(dlink){ memset(&files[actnum], 0 , sizeof(struct direntry)); files[actnum].relname = dlink->name; +// use 64 bit file size, only needed for WIN32, WIN64 should work fine with stat. +// Excluding other than current MSVC compiler until able to test. +#if defined(WIN32) && !defined(WIN64) && (_MSC_VER>=1500) + _stat64(dlink->name,&files[actnum].s); +#else stat(dlink->name,&files[actnum].s); +#endif files[actnum].type=files[actnum].s.st_mode; files[actnum].flags = 0; totnum++; @@ -361,7 +367,7 @@ void BLI_adddirstrings() * will buy us some time until files get bigger than 4GB or until * everyone starts using __USE_FILE_OFFSET64 or equivalent. */ - st_size= (off_t)files[num].s.st_size; + st_size= files[num].s.st_size; if (st_size > 1024*1024*1024) { sprintf(files[num].size, "%.2f GB", ((double)st_size)/(1024*1024*1024)); -- cgit v1.2.3