Ignore:
Timestamp:
Feb 15, 2008, 6:25:42 PM (14 years ago)
Author:
charles
Message:

make the code a little easier to read. make tr_ioFileTest()'s return value consistent with other inout funcs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/verify.c

    r5042 r5045  
    9191        else if( !tr_torrentIsPieceChecked( tor, i ) )
    9292        {
    93             const int check = tr_ioTestPiece( tor, i );
    94             tr_torrentSetHasPiece( tor, i, !check );
     93            const tr_errno err = tr_ioTestPiece( tor, i );
     94
     95            if( !err ) /* yay */
     96            {
     97                tr_torrentSetHasPiece( tor, i, TRUE );
     98            }
     99            else
     100            {
     101                /* if we were wrong about it being complete,
     102                 * reset and start again.  if we were right about
     103                 * it being incomplete, do nothing -- we don't
     104                 * want to lose blocks in those incomplete pieces */
     105
     106                if( tr_cpPieceIsComplete( tor->completion, i ) )
     107                    tr_torrentSetHasPiece( tor, i, FALSE );
     108            }
     109               
    95110            tr_torrentSetPieceChecked( tor, i, TRUE );
    96111        }
Note: See TracChangeset for help on using the changeset viewer.