Changeset 1767
- Timestamp:
- Apr 20, 2007, 11:51:15 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/torrent.c
r1766 r1767 462 462 if( s->downloaded == 0 ) 463 463 { 464 //if s eeding without ever downloading, calculate ratio from total size465 if( s->progress > = 1.0 )466 { 467 s->ratio = (float)s->uploaded / ( float)inf->totalSize;464 //if some is downloaded without a downloaded value, calculate ratio from total size 465 if( s->progress > 0.0 ) 466 { 467 s->ratio = (float)s->uploaded / ((float)inf->totalSize * s->progress); 468 468 } 469 469 else 470 470 { 471 s->ratio = s->uploaded == 0 ? TR_RATIO_NA : TR_RATIO_INF;471 s->ratio = TR_RATIO_NA; 472 472 } 473 473 } -
trunk/libtransmission/transmission.h
r1763 r1767 449 449 450 450 #define TR_RATIO_NA -1 451 #define TR_RATIO_INF -2452 451 float ratio; 453 452 }; -
trunk/macosx/StringAdditions.m
r1645 r1767 106 106 if (ratio == TR_RATIO_NA) 107 107 return NSLocalizedString(@"N/A", "No Ratio"); 108 else if (ratio == TR_RATIO_INF)109 return [NSString stringWithUTF8String: "\xE2\x88\x9E"];110 108 else if (ratio < 0) 111 109 return NSLocalizedString(@"error", "Ratio invalid"); 110 else; 112 111 113 112 if (ratio < 10.0) -
trunk/macosx/Torrent.m
r1765 r1767 290 290 291 291 //check to stop for ratio 292 float stopRatio , ratio;292 float stopRatio; 293 293 if ([self isSeeding] && (stopRatio = [self actualStopRatio]) != INVALID 294 && ((ratio = [self ratio]) >= stopRatio || ratio == TR_RATIO_INF))294 && [self ratio] >= stopRatio) 295 295 { 296 296 [self stopTransfer]; … … 1257 1257 - (NSNumber *) ratioSortKey 1258 1258 { 1259 float ratio = [self ratio]; 1260 if (ratio == TR_RATIO_INF) 1261 return [NSNumber numberWithInt: 999999999]; //this should hopefully be big enough 1262 else 1263 return [NSNumber numberWithFloat: [self ratio]]; 1259 return [NSNumber numberWithFloat: [self ratio]]; 1264 1260 } 1265 1261
Note: See TracChangeset
for help on using the changeset viewer.