diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-13 00:16:53 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-13 00:16:53 +0300 |
commit | bdfe7d89e2f1292644577972c716931b4ce3c6c3 (patch) | |
tree | d00eb50b749cb001e2b08272c91791e66740b05d /source/blender/blenlib/intern/storage.c | |
parent | 78a1c27c4a6abe0ed31ca93ad21910f3df04da56 (diff) | |
parent | 7e4db234cee71ead34ee81a12e27da4bd548eb4b (diff) |
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
Diffstat (limited to 'source/blender/blenlib/intern/storage.c')
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 6e64a98af2a..ca7a376d3a2 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -47,7 +47,9 @@ #include <time.h> #include <sys/stat.h> -#if !defined(linux) && (defined(__sgi) || defined(__sun__) || defined(__sun) || defined(__sparc) || defined(__sparc__)) +#if defined (__sun__) || defined (__sun) +#include <sys/statvfs.h> /* Other modern unix os's should probably use this also */ +#elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sgi) || defined(__sparc) || defined(__sparc__)) #include <sys/statfs.h> #endif @@ -176,7 +178,12 @@ double BLI_diskfree(char *dir) return (double) (freec*bytesps*sectorspc); #else + +#if defined (__sun__) || defined (__sun) + struct statvfs disk; +#else struct statfs disk; +#endif char name[FILE_MAXDIR],*slash; int len = strlen(dir); @@ -196,12 +203,12 @@ double BLI_diskfree(char *dir) #ifdef __BeOS return -1; #endif -#if !defined(linux) && (defined (__sgi) || defined (__sun__) || defined (__sun) || defined(__sparc) || defined(__sparc__)) - if (statfs(name, &disk, sizeof(struct statfs), 0)){ - /* printf("diskfree: Couldn't get information about %s.\n",dir); */ - return(-1); - } +#if defined (__sun__) || defined (__sun) + if (statvfs(name, &disk)) return(-1); +#elif !defined(__FreeBSD__) && !defined(linux) && (defined (__sgi) || defined(__sparc) || defined(__sparc__)) + /* WARNING - This may not be supported by geeneric unix os's - Campbell */ + if (statfs(name, &disk, sizeof(struct statfs), 0)) return(-1); #endif return ( ((double) disk.f_bsize) * ((double) disk.f_bfree)); @@ -326,11 +333,11 @@ void BLI_adddirstrings() char size[250]; static char * types[8] = {"---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rwx"}; int num, mode; - int num1, num2, num3, num4; + off_t num1, num2, num3, num4, num5; #ifdef WIN32 __int64 st_size; #else - long long st_size; + off_t st_size; #endif struct direntry * file; @@ -392,7 +399,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= (unsigned int)files[num].s.st_size; + st_size= (off_t)files[num].s.st_size; num1= st_size % 1000; num2= st_size/1000; @@ -401,11 +408,15 @@ void BLI_adddirstrings() num3= num3 % 1000; num4= st_size/(1000*1000*1000); num4= num4 % 1000; - - if(num4) sprintf(files[num].size, "%3d %03d %03d %03d", num4, num3, num2, num1); - else if(num3) sprintf(files[num].size, "%7d %03d %03d", num3, num2, num1); - else if(num2) sprintf(files[num].size, "%11d %03d", num2, num1); - else if(num1) sprintf(files[num].size, "%15d", num1); + num5= st_size/(1000000000000LL); + num5= num5 % 1000; + + if(num5) + sprintf(files[num].size, "%1d %03d %03d %03d K", (int)num5, (int)num4, (int)num3, (int)num2); + else if(num4) sprintf(files[num].size, "%3d %03d %03d %03d", (int)num4, (int)num3, (int)num2, (int)num1); + else if(num3) sprintf(files[num].size, "%7d %03d %03d", (int)num3, (int)num2, (int)num1); + else if(num2) sprintf(files[num].size, "%11d %03d", (int)num2, (int)num1); + else if(num1) sprintf(files[num].size, "%15d", (int)num1); else sprintf(files[num].size, "0"); strftime(datum, 32, "%d-%b-%y %H:%M", tm); @@ -469,6 +480,17 @@ int BLI_filesize(int file) return (buf.st_size); } +int BLI_filepathsize(const char *path) +{ + int size, file = open(path, O_BINARY|O_RDONLY); + + if (file <= 0) + return -1; + + size = BLI_filesize(file); + close(file); + return size; +} int BLI_exist(char *name) |