mirror of
https://github.com/transmission/transmission
synced 2025-03-04 18:48:06 +00:00
removing unreachable code (#4083)
This commit is contained in:
parent
f9abbaca70
commit
84badfc66f
2 changed files with 0 additions and 56 deletions
|
@ -1121,15 +1121,12 @@ std::string tr_variantToStr(tr_variant const* v, tr_variant_fmt fmt)
|
|||
{
|
||||
case TR_VARIANT_FMT_JSON:
|
||||
return tr_variantToStrJson(v, false);
|
||||
break;
|
||||
|
||||
case TR_VARIANT_FMT_JSON_LEAN:
|
||||
return tr_variantToStrJson(v, true);
|
||||
break;
|
||||
|
||||
default: // TR_VARIANT_FMT_BENC:
|
||||
return tr_variantToStrBenc(v);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
@interface NSString (Private)
|
||||
|
||||
+ (NSString*)stringForFileSizeLion:(uint64_t)size showUnitUnless:(NSString*)notAllowedUnit unitsUsed:(NSString**)unitUsed;
|
||||
|
||||
+ (NSString*)stringForSpeed:(CGFloat)speed kb:(NSString*)kb mb:(NSString*)mb gb:(NSString*)gb;
|
||||
|
||||
@end
|
||||
|
@ -146,57 +144,6 @@
|
|||
|
||||
@implementation NSString (Private)
|
||||
|
||||
+ (NSString*)stringForFileSizeLion:(uint64_t)size showUnitUnless:(NSString*)notAllowedUnit unitsUsed:(NSString**)unitUsed
|
||||
{
|
||||
double convertedSize;
|
||||
NSString* unit;
|
||||
NSUInteger decimals;
|
||||
if (size < pow(1000, 2))
|
||||
{
|
||||
convertedSize = size / 1000.0;
|
||||
unit = NSLocalizedString(@"KB", "File size - kilobytes");
|
||||
decimals = convertedSize >= 10.0 ? 0 : 1;
|
||||
}
|
||||
else if (size < pow(1000, 3))
|
||||
{
|
||||
convertedSize = size / powf(1000.0, 2);
|
||||
unit = NSLocalizedString(@"MB", "File size - megabytes");
|
||||
decimals = 1;
|
||||
}
|
||||
else if (size < pow(1000, 4))
|
||||
{
|
||||
convertedSize = size / powf(1000.0, 3);
|
||||
unit = NSLocalizedString(@"GB", "File size - gigabytes");
|
||||
decimals = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
convertedSize = size / powf(1000.0, 4);
|
||||
unit = NSLocalizedString(@"TB", "File size - terabytes");
|
||||
decimals = 2;
|
||||
}
|
||||
|
||||
//match Finder's behavior
|
||||
NSNumberFormatter* numberFormatter = [[NSNumberFormatter alloc] init];
|
||||
numberFormatter.numberStyle = NSNumberFormatterDecimalStyle;
|
||||
numberFormatter.minimumFractionDigits = 0;
|
||||
numberFormatter.maximumFractionDigits = decimals;
|
||||
|
||||
NSString* fileSizeString = [numberFormatter stringFromNumber:@(convertedSize)];
|
||||
|
||||
if (!notAllowedUnit || ![unit isEqualToString:notAllowedUnit])
|
||||
{
|
||||
fileSizeString = [fileSizeString stringByAppendingFormat:@" %@", unit];
|
||||
}
|
||||
|
||||
if (unitUsed)
|
||||
{
|
||||
*unitUsed = unit;
|
||||
}
|
||||
|
||||
return fileSizeString;
|
||||
}
|
||||
|
||||
+ (NSString*)stringForSpeed:(CGFloat)speed kb:(NSString*)kb mb:(NSString*)mb gb:(NSString*)gb
|
||||
{
|
||||
if (speed <= 999.95) //0.0 KB/s to 999.9 KB/s
|
||||
|
|
Loading…
Add table
Reference in a new issue