The default bug view has changed. See this FAQ.

FormatFileSize fails for sizes >999.5 GB

RESOLVED FIXED in Thunderbird 17.0

Status

MailNews Core
Attachments
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: squib, Assigned: squib)

Tracking

Trunk
Thunderbird 17.0
x86_64
Linux
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
It turns out I had an off-by-one error in FormatFileSize. We should fix this. I have a patch, but haven't written a test yet. I will (hopefully) do that in the next couple of days.

(This isn't really the right component, but it's the closest there is in MailNews Core.)
(Assignee)

Comment 1

5 years ago
Created attachment 648246 [details] [diff] [review]
Fix formatFileSize

Here's a fix, with unit tests. I also fixed a bug where formatFileSize(0, true) returned "0.1 KB". It now returns "0 KB".
Attachment #648246 - Flags: review?(mbanner)

Comment 2

5 years ago
Kudos for the size==0 case ;)

Updated

5 years ago
Blocks: 668756
Comment on attachment 648246 [details] [diff] [review]
Fix formatFileSize

Review of attachment 648246 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with the comments fixed.

::: mailnews/base/test/unit/test_formatFileSize.js
@@ +2,5 @@
> + * License, v. 2.0. If a copy of the MPL was not distributed with this
> + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
> +
> +/*
> + * Tests for nsIMessenger methods.

Whilst true, I think this should just reference formatFileSize, or you need to rename the file...

@@ +9,5 @@
> +load("../../../../mailnews/resources/logHelper.js");
> +load("../../../../mailnews/resources/asyncTestUtils.js");
> +
> +const gStringBundle = Cc["@mozilla.org/intl/stringbundle;1"]
> +                        .getService(Ci.nsIStringBundleService)

Please use Services.strings
Attachment #648246 - Flags: review?(mbanner) → review+
(Assignee)

Comment 4

5 years ago
Checked in: https://hg.mozilla.org/comm-central/rev/0ce4d789f7ec
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 17.0
You need to log in before you can comment on or make changes to this bug.