Changeset 1569


Ignore:
Timestamp:
Mar 15, 2007, 12:46:51 PM (15 years ago)
Author:
livings124
Message:

return "error" when requesting a speed or ratio string for speed/ratio less then 0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/StringAdditions.m

    r1478 r1569  
    8080+ (NSString *) stringForSpeed: (float) speed
    8181{
     82    if (speed < 0)
     83        return NSLocalizedString(@"error", "Transfer speed invalid");
     84   
    8285    return [[self stringForSpeedAbbrev: speed] stringByAppendingString:
    8386                    NSLocalizedString(@"B/s", "Transfer speed (Bytes per second)")];
     
    8689+ (NSString *) stringForSpeedAbbrev: (float) speed
    8790{
     91    if (speed < 0)
     92        return NSLocalizedString(@"error", "Transfer speed invalid");
     93   
    8894    if (speed < 1000.0) //0.0 K to 999.9 K
    8995        return [NSString stringWithFormat: @"%.1f K", speed];
     
    102108    else if (ratio == TR_RATIO_INF)
    103109        return [NSString stringWithUTF8String: "\xE2\x88\x9E"];
    104     else if (ratio < 10.0)
     110    else if (ratio < 0)
     111        return NSLocalizedString(@"error", "Ratio invalid");
     112   
     113    if (ratio < 10.0)
    105114        return [NSString stringWithFormat: @"%.2f", ratio];
    106115    else if (ratio < 100.0)
Note: See TracChangeset for help on using the changeset viewer.