Changeset 11807


Ignore:
Timestamp:
Feb 1, 2011, 9:32:03 PM (12 years ago)
Author:
jordan
Message:

(trivial) make the implementation of tr_torPieceCountBlocks(), tr_torPieceCountBytes(), and tr_torBlockCountBytes() consistent.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.h

    r11781 r11807  
    274274tr_torPieceCountBlocks( const tr_torrent * tor, const tr_piece_index_t piece )
    275275{
    276     if( piece + 1 == tor->info.pieceCount )
    277         return tor->blockCountInLastPiece;
    278     else
    279         return tor->blockCountInPiece;
     276    return piece + 1 == tor->info.pieceCount ? tor->blockCountInLastPiece
     277                                             : tor->blockCountInPiece;
    280278}
    281279
     
    284282tr_torPieceCountBytes( const tr_torrent * tor, const tr_piece_index_t piece )
    285283{
    286     return piece == tor->info.pieceCount - 1 ? tor->lastPieceSize
     284    return piece + 1 == tor->info.pieceCount ? tor->lastPieceSize
    287285                                             : tor->info.pieceSize;
    288286}
     
    292290tr_torBlockCountBytes( const tr_torrent * tor, const tr_block_index_t block )
    293291{
    294     return block == tor->blockCount - 1 ? tor->lastBlockSize
     292    return block + 1 == tor->blockCount ? tor->lastBlockSize
    295293                                        : tor->blockSize;
    296294}
Note: See TracChangeset for help on using the changeset viewer.