diff --git a/libtransmission/fastresume.c b/libtransmission/fastresume.c index c2b953a4b..8ada734d9 100644 --- a/libtransmission/fastresume.c +++ b/libtransmission/fastresume.c @@ -208,7 +208,7 @@ tr_fastResumeSave( const tr_torrent * tor ) /* Write progress data */ if (1) { - int n; + int i, n; tr_time_t * mtimes; uint8_t * buf = malloc( FR_PROGRESS_LEN( tor ) ); uint8_t * walk = buf; @@ -216,6 +216,9 @@ tr_fastResumeSave( const tr_torrent * tor ) /* mtimes */ mtimes = getMTimes( tor, &n ); + for( i=0; iinfo.files[i].name ); + } } free( curMTimes ); diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index f03705e68..21559ba73 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -1317,6 +1317,22 @@ tr_torrentSetFileChecked( tr_torrent * tor, int fileIndex, int isChecked ) tr_bitfieldRemRange ( tor->checkedPieces, begin, end ); } +int +tr_torrentIsFileChecked( const tr_torrent * tor, int fileIndex ) +{ + const tr_file * file = &tor->info.files[fileIndex]; + const size_t begin = file->firstPiece; + const size_t end = file->lastPiece + 1; + size_t i; + int isChecked = TRUE; + + for( i=begin; isChecked && i