Home » U++ Library support » U++ Library : Other (not classified elsewhere) » [FIXED] FormatFileSize method should use extend formating.
[FIXED] FormatFileSize method should use extend formating. [message #40174] |
Thu, 27 June 2013 20:27 |
|
Klugier
Messages: 1085 Registered: September 2012 Location: Poland, Kraków
|
Senior Contributor |
|
|
Hello,
I think we can extend File size formatting to one place after comma. I have enclose sample code (CtrlLib/FileSel - line 1114):
String FormatFileSize(int64 n)
{
if(n < 10000)
return Format("%d B ", n);
else
if(n < 10000 * 1024)
return Format("%d.%d K ", n >> 10, (n & 1023) / 103);
else
if(n < I64(10000000) * 1024)
return Format("%d.%d M ", n >> 20, (n & 1023) / 103);
else
return Format("%d.%d G ", n >> 30, (n & 1023) / 103);
}
Insted of:
String FormatFileSize(int64 n)
{
if(n < 10000)
return Format("%d B ", n);
else
if(n < 10000 * 1024)
return Format("%d K ", n >> 10);
else
if(n < I64(10000000) * 1024)
return Format("%d M ", n >> 20);
else
return Format("%d G ", n >> 30);
}
We can also enlarge a little size display in FileSel, beacuse information string will be longer.
-----
More information you can find on wikipedia.
Sincerely,
Klugier
U++ - one framework to rule them all.
[Updated on: Fri, 28 June 2013 18:00] Report message to a moderator
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Dec 13 22:22:42 CET 2024
Total time taken to generate the page: 0.03828 seconds
|