Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
Klugier is currently offline  Klugier
Messages: 660
Registered: September 2012
Location: Poland, Kraków
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


Ultimate++ - one framework to rule them all.

[Updated on: Fri, 28 June 2013 18:00]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: [Win32 - FileSel - System Places Improvement] - Disk name
Next Topic: [FIXED] Scrollbar artifacts on KDE (GTK Backend)
Goto Forum:
  


Current Time: Wed Jul 15 00:11:26 CEST 2020

Total time taken to generate the page: 0.01546 seconds