Ignore:
Timestamp:
Nov 25, 2009, 5:01:51 AM (13 years ago)
Author:
livings124
Message:

tr_cpPercentComplete() considers cases where size is 0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/completion.h

    r8889 r9565  
    106106static TR_INLINE float tr_cpPercentComplete( const tr_completion * cp )
    107107{
    108     return tr_getRatio( cp->sizeNow, tr_torrentInfo(cp->tor)->totalSize );
     108    const double ratio = tr_getRatio( cp->sizeNow, tr_torrentInfo(cp->tor)->totalSize );
     109    if( (int)ratio == TR_RATIO_NA )
     110        return 0.0;
     111    else if( (int)ratio == TR_RATIO_INF )
     112        return 1.0;
     113    else
     114        return ratio;
    109115}
    110116
Note: See TracChangeset for help on using the changeset viewer.