diff options
author | Andrea Weikert <elubie@gmx.net> | 2009-03-14 16:12:11 +0300 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2009-03-14 16:12:11 +0300 |
commit | b907b9fd9b625bacb4500fb21b791bb109e1d10d (patch) | |
tree | 9e1b06a9d8137e552f7a0bd04905aba7fbafdf29 /source/blender/blenlib/intern/storage.c | |
parent | 2aa71b42266a2b1ad278eba0a343f6008a0d1418 (diff) |
2.5 filebrowser
* added filter buttons to header
* changed large icon for movie files to match small icon
* fixed small stack corruption in interface_draw.c (Matt, check if this is ok)
* moved nice display of file size to storage.c, where string is created.
Diffstat (limited to 'source/blender/blenlib/intern/storage.c')
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index e01d2dbc3fb..d3570808d6d 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -401,24 +401,19 @@ void BLI_adddirstrings() * everyone starts using __USE_FILE_OFFSET64 or equivalent. */ st_size= (off_t)files[num].s.st_size; - - num1= st_size % 1000; - num2= st_size/1000; - num2= num2 % 1000; - num3= st_size/(1000*1000); - num3= num3 % 1000; - num4= st_size/(1000*1000*1000); - num4= num4 % 1000; - 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"); + + if (st_size > 1024*1024*1024) { + sprintf(files[num].size, "%.2f GB", st_size/(1024*1024*1024)); + } + else if (st_size > 1024*1024) { + sprintf(files[num].size, "%.1f MB", st_size/(1024*1024)); + } + else if (st_size > 1024) { + sprintf(files[num].size, "%d KB", (int)(st_size/1024)); + } + else { + sprintf(files[num].size, "%d B", (int)st_size); + } strftime(datum, 32, "%d-%b-%y %H:%M", tm); |