From 88cfec047f5d25f54bf631a69927495480980db5 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 1 Feb 2008 01:38:55 +0000 Subject: [PATCH] #666: pausing in the middle of "verify local data" makes T forget about the nonverified portion --- libtransmission/fastresume.c | 9 +++++++-- libtransmission/torrent.c | 16 ++++++++++++++++ libtransmission/torrent.h | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) 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