Changeset 996


Ignore:
Timestamp:
Oct 13, 2006, 12:23:20 AM (15 years ago)
Author:
joshe
Message:

Fix a few minor style nits.
Use a floats instead of uint8_ts for piece percentages.

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/completion.c

    r994 r996  
    201201}
    202202
    203 uint8_t tr_cpPercentBlocksInPiece( tr_completion_t * cp, int piece )
     203float tr_cpPercentBlocksInPiece( tr_completion_t * cp, int piece )
    204204{
    205205    tr_torrent_t * tor = cp->tor;
     
    217217
    218218    for( i = startBlock; i < endBlock; i++ )
     219    {
    219220        if( tr_bitfieldHas( bitfield, i ) )
     221        {
    220222            complete++;
    221    
    222     return (complete * 100.0) / blockCount;
     223        }
     224    }   
     225
     226    return (float)complete / (float)blockCount;
    223227}
    224228
     
    233237
    234238    for( i = start; i < end; i++ )
    235         if( !tr_cpBlockIsComplete( cp, i ) && !cp->blockDownloaders[i] )
    236             return i;
     239    {
     240        if( tr_cpBlockIsComplete( cp, i ) || cp->blockDownloaders[i] )
     241        {
     242            continue;
     243        }
     244        return i;
     245    }
    237246
    238247    return -1;
  • trunk/libtransmission/completion.h

    r994 r996  
    5858uint8_t         * tr_cpBlockBitfield( tr_completion_t * );
    5959void              tr_cpBlockBitfieldSet( tr_completion_t *, uint8_t * );
    60 uint8_t           tr_cpPercentBlocksInPiece( tr_completion_t * cp, int piece );
     60float             tr_cpPercentBlocksInPiece( tr_completion_t * cp, int piece );
    6161/* Missing = we don't have it and we are not getting it from any peer yet */
    6262static inline int tr_cpMissingBlocksForPiece( tr_completion_t * cp, int piece )
  • trunk/libtransmission/transmission.c

    r994 r996  
    634634}
    635635
    636 void tr_torrentAmountFinished( tr_torrent_t * tor, int8_t * tab, int size )
     636void tr_torrentAmountFinished( tr_torrent_t * tor, float * tab, int size )
    637637{
    638638    int i, piece;
  • trunk/libtransmission/transmission.h

    r994 r996  
    274274void tr_torrentAvailability( tr_torrent_t *, int8_t * tab, int size );
    275275
    276 void tr_torrentAmountFinished( tr_torrent_t * tor, int8_t * tab, int size );
     276void tr_torrentAmountFinished( tr_torrent_t * tor, float * tab, int size );
    277277
    278278/***********************************************************************
Note: See TracChangeset for help on using the changeset viewer.