Queue size inaccurate 1.2GB shows as 2GiB

Need help with FileZilla Client? Something does not work as expected? In this forum you may find an answer.

Moderator: Project members

Post Reply
Message
Author
marky1124
500 Command not understood
Posts: 3
Joined: 2004-04-05 22:58

Queue size inaccurate 1.2GB shows as 2GiB

#1 Post by marky1124 » 2009-09-23 11:45

Hi,

I was transferring 81 files that added up to a total of 1.2GB and I noticed that Filezilla 3.2.7.1 reported the Queue size as 2GiB. I searched around and found that this has been raised before as a bug ticket #4324, http://trac.filezilla-project.org/ticket/4324. It was rejected by codesquid with the following comment "Filesizes are rounded up, this is by design."

Surely this is a little unfair and overly inaccurate, rounding up from 1.2 to 2 seems misleading. It would be much better if it showed 1.2GB or 1.3GiB or something similar.

Cheers,
Mark

User avatar
boco
Contributor
Posts: 26960
Joined: 2006-05-01 03:28
Location: Germany

Re: Queue size inaccurate 1.2GB shows as 2GiB

#2 Post by boco » 2009-09-24 01:42

I'd love to see that a little more accurate, too, like 1.25GB or 1.25GiB .
No support requests over PM! You will NOT get any reply!!!
FTP connection problems? Please read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
FileZilla Pro support: https://customerforum.fileZilla-project.org

tateu
450 Internal Error
Posts: 38
Joined: 2004-11-13 01:19

Re: Queue size inaccurate 1.2GB shows as 2GiB

#3 Post by tateu » 2009-10-04 19:24

I use a modified version based on Filezilla 3.2.7.1. For a test queue, my code displays 3.06 GiB and the current Filezilla 3.2.8 displays 4 GiB.

In statusbar.cpp, line 306, for CStatusBar::DisplayQueueSize, instead of the current code:

Code: Select all

extern wxString FormatSize(const wxLongLong& size, bool add_bytes_suffix, int format, bool thousands_separator, int num_decimal_places);

void CStatusBar::DisplayQueueSize(wxLongLong totalSize, bool hasUnknown)
{
	m_size = totalSize;
	m_hasUnknownFiles = hasUnknown;

	if (totalSize == 0 && !hasUnknown)
	{
		SetStatusText(_("Queue: empty"), FIELD_QUEUESIZE);
		return;
	}

	wxString queueSize = wxString::Format(_("Queue: %s%s"), hasUnknown ? _T(">") : _T(""),
			FormatSize(totalSize, true, m_sizeFormat, m_sizeFormatThousandsSep, m_sizeFormatDecimalPlaces).c_str());

	SetStatusText(queueSize, FIELD_QUEUESIZE);
}
try this:

Code: Select all

void CStatusBar::DisplayQueueSize(wxLongLong totalSize, bool hasUnknown)
{
	m_size = totalSize;
	m_hasUnknownFiles = hasUnknown;

	if (totalSize == 0 && !hasUnknown)
	{
		SetStatusText(_("Queue: empty"), FIELD_QUEUESIZE);
		return;
	}

	double divider;
	if (m_sizeFormat == 3)
		divider = 1000.0;
	else
		divider = 1024.0;

	double finalSize;
	int p = 1;
	if (totalSize > divider)
	{
		finalSize = totalSize.ToDouble() / divider;
	}
	else
		finalSize = totalSize.ToDouble();

	
	while (finalSize > divider && p < 6)
	{
		finalSize /= divider;
		p++;
	}

	wxString queueSize;
	if (!p)
		queueSize.Printf(_("Queue: %s%0.2f bytes"), hasUnknown ? _T(">") : _T(""), finalSize);
	else
	{
		// We stop at Exa. If someone has files bigger than that, he can afford to
		// make a donation to have this changed ;)
		const wxChar prefix[] = { ' ', 'K', 'M', 'G', 'T', 'P', 'E' };

		queueSize.Printf(_("Queue: %s%0.2f %c"), hasUnknown ? _T(">") : _T(""), finalSize, prefix[p]);

		if (m_sizeFormat == 1)
			queueSize += 'i';
		
		static wxChar byte_unit = 0;
		if (!byte_unit)
		{
			wxString t = _("B <Unit symbol for bytes. Only translate first letter>");
			byte_unit = t[0];
		}
		queueSize += byte_unit;
	}
	SetStatusText(queueSize, FIELD_QUEUESIZE);
}

marky1124
500 Command not understood
Posts: 3
Joined: 2004-04-05 22:58

Re: Queue size inaccurate 1.2GB shows as 2GiB

#4 Post by marky1124 » 2009-10-04 19:31

Excellent, thank you Tateu.
Will this now get rolled into a future version of Filezilla?

Cheers,
Mark

User avatar
boco
Contributor
Posts: 26960
Joined: 2006-05-01 03:28
Location: Germany

Re: Queue size inaccurate 1.2GB shows as 2GiB

#5 Post by boco » 2009-10-04 19:51

Hopefully.
No support requests over PM! You will NOT get any reply!!!
FTP connection problems? Please read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
FileZilla Pro support: https://customerforum.fileZilla-project.org

User avatar
botg
Site Admin
Posts: 35599
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: Queue size inaccurate 1.2GB shows as 2GiB

#6 Post by botg » 2009-10-04 23:56

Or simply use stock 3.2.8 and set the number of decimal places in the settings dialog.

tateu
450 Internal Error
Posts: 38
Joined: 2004-11-13 01:19

Re: Queue size inaccurate 1.2GB shows as 2GiB

#7 Post by tateu » 2009-10-05 00:07

Oh, nice...I saw that you made some type of change with it but "Number of decimal places" is disabled when "Display size in bytes" is enabled so I didn't really catch on to it. Shouldn't "Number of decimal places" always be enabled, then?

User avatar
boco
Contributor
Posts: 26960
Joined: 2006-05-01 03:28
Location: Germany

Re: Queue size inaccurate 1.2GB shows as 2GiB

#8 Post by boco » 2009-10-05 12:36

Temporarily swith to another option, set the number of decimals, then switch back.
No support requests over PM! You will NOT get any reply!!!
FTP connection problems? Please read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
FileZilla Pro support: https://customerforum.fileZilla-project.org

Post Reply