mirror of
https://github.com/transmission/transmission
synced 2024-12-25 09:13:06 +00:00
use a float instead of a double for file unit size
This commit is contained in:
parent
3abf813bbf
commit
e37848ca60
1 changed files with 2 additions and 2 deletions
|
@ -179,7 +179,7 @@
|
||||||
+ (NSString *) stringForFileSize: (uint64_t) size showUnitUnless: (NSString *) notAllowedUnit
|
+ (NSString *) stringForFileSize: (uint64_t) size showUnitUnless: (NSString *) notAllowedUnit
|
||||||
unitsUsed: (NSString **) unitUsed
|
unitsUsed: (NSString **) unitUsed
|
||||||
{
|
{
|
||||||
const double baseFloat = [NSApp isOnSnowLeopardOrBetter] ? 1000.0 : 1024.0;
|
const float baseFloat = [NSApp isOnSnowLeopardOrBetter] ? 1000.0 : 1024.0;
|
||||||
const NSUInteger baseInt = [NSApp isOnSnowLeopardOrBetter] ? 1000 : 1024;
|
const NSUInteger baseInt = [NSApp isOnSnowLeopardOrBetter] ? 1000 : 1024;
|
||||||
|
|
||||||
double convertedSize;
|
double convertedSize;
|
||||||
|
@ -216,7 +216,7 @@
|
||||||
[numberFormatter setMinimumFractionDigits: 0];
|
[numberFormatter setMinimumFractionDigits: 0];
|
||||||
[numberFormatter setMaximumFractionDigits: decimals];
|
[numberFormatter setMaximumFractionDigits: decimals];
|
||||||
|
|
||||||
NSString * fileSizeString = [numberFormatter stringFromNumber: [NSNumber numberWithDouble: convertedSize]];
|
NSString * fileSizeString = [numberFormatter stringFromNumber: [NSNumber numberWithFloat: convertedSize]];
|
||||||
|
|
||||||
if (!notAllowedUnit || ![unit isEqualToString: notAllowedUnit])
|
if (!notAllowedUnit || ![unit isEqualToString: notAllowedUnit])
|
||||||
fileSizeString = [fileSizeString stringByAppendingFormat: @" %@", unit];
|
fileSizeString = [fileSizeString stringByAppendingFormat: @" %@", unit];
|
||||||
|
|
Loading…
Reference in a new issue