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 next message
Klugier is currently offline  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

Re: [FileSel - Minor Fix] FormatFileSize method should use international notation. [message #40175 is a reply to message #40174] Thu, 27 June 2013 23:10 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

klugier wrote on Thu, 27 June 2013 20:27

More information you can find on wikipedia.

Or on xkcd Wink

(Sorry for off-topic post, but I just couldn't resist Very Happy )

[Updated on: Thu, 27 June 2013 23:11]

Report message to a moderator

Re: [FileSel - Minor Fix] FormatFileSize method should use international notation. [message #40176 is a reply to message #40175] Fri, 28 June 2013 01:21 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1085
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello dolik.rce,

You are right. It is too many possibilities there. I think we should only extend formating.

Sincerely,
Klugier


U++ - one framework to rule them all.
Re: [FileSel - Minor Fix] FormatFileSize method should use international notation. [message #40177 is a reply to message #40176] Fri, 28 June 2013 09:25 Go to previous message
mirek is currently offline  mirek
Messages: 14162
Registered: November 2005
Ultimate Member
OK, nice, applied.

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


Current Time: Fri Dec 13 22:22:42 CET 2024

Total time taken to generate the page: 0.03828 seconds