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.

File:
1 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;
Note: See TracChangeset for help on using the changeset viewer.