From b667ad303768e8b86b7af12588a2928ba94d5367 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 13 Jul 2007 01:17:21 +0000 Subject: [PATCH] ... and do the same for tr_torrentGetFileDL() --- libtransmission/torrent.c | 12 ++++++++---- libtransmission/transmission.h | 8 +++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 77e80273d..599123991 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -1239,15 +1239,19 @@ tr_torrentSetFileDL( tr_torrent_t * tor, } void -tr_torrentSetFileDLs ( tr_torrent_t * tor, const uint8_t * enabled ) +tr_torrentSetFileDLs ( tr_torrent_t * tor, + int * files, + int fileCount, + int do_download ) { int i, j; + const int dnd = !do_download; tr_torrentWriterLock( tor ); - for( i=0; iinfo.fileCount; ++i ) { - const int dnd = !enabled[i]; - tr_file_t * file = &tor->info.files[i]; + for( i=0; iinfo.files[fileIndex]; file->dnd = dnd; for( j=file->firstPiece; j<=file->lastPiece; ++j ) tor->info.pieces[j].dnd = dnd; diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index e503719fa..9d13b482e 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -236,9 +236,11 @@ tr_priority_t tr_torrentGetFilePriority( const tr_torrent_t *, int file ); /* returns true if the file's `download' flag is set */ int tr_torrentGetFileDL( const tr_torrent_t *, int file ); -/* enabled should be an array of tor->info.fileCount bytes, - * each holding a nonzero value if the file is to be downloaded */ -void tr_torrentSetFileDLs ( tr_torrent_t *, const uint8_t * enabled ); +/* set a batch of files to be downloaded or not. */ +void tr_torrentSetFileDLs ( tr_torrent_t * tor, + int * files, + int fileCount, + int do_download ); /* single-file form of tr_torrentSetFileDLs */ void tr_torrentSetFileDL( tr_torrent_t *, int file, int do_download );