mirror of
https://github.com/transmission/transmission
synced 2025-02-04 05:22:40 +00:00
... and do the same for tr_torrentGetFileDL()
This commit is contained in:
parent
a3eb718162
commit
b667ad3037
2 changed files with 13 additions and 7 deletions
|
@ -1239,15 +1239,19 @@ tr_torrentSetFileDL( tr_torrent_t * tor,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
int i, j;
|
||||||
|
const int dnd = !do_download;
|
||||||
|
|
||||||
tr_torrentWriterLock( tor );
|
tr_torrentWriterLock( tor );
|
||||||
|
|
||||||
for( i=0; i<tor->info.fileCount; ++i ) {
|
for( i=0; i<fileCount; ++i ) {
|
||||||
const int dnd = !enabled[i];
|
const int fileIndex = files[i];
|
||||||
tr_file_t * file = &tor->info.files[i];
|
tr_file_t * file = &tor->info.files[fileIndex];
|
||||||
file->dnd = dnd;
|
file->dnd = dnd;
|
||||||
for( j=file->firstPiece; j<=file->lastPiece; ++j )
|
for( j=file->firstPiece; j<=file->lastPiece; ++j )
|
||||||
tor->info.pieces[j].dnd = dnd;
|
tor->info.pieces[j].dnd = dnd;
|
||||||
|
|
|
@ -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 */
|
/* returns true if the file's `download' flag is set */
|
||||||
int tr_torrentGetFileDL( const tr_torrent_t *, int file );
|
int tr_torrentGetFileDL( const tr_torrent_t *, int file );
|
||||||
|
|
||||||
/* enabled should be an array of tor->info.fileCount bytes,
|
/* set a batch of files to be downloaded or not. */
|
||||||
* each holding a nonzero value if the file is to be downloaded */
|
void tr_torrentSetFileDLs ( tr_torrent_t * tor,
|
||||||
void tr_torrentSetFileDLs ( tr_torrent_t *, const uint8_t * enabled );
|
int * files,
|
||||||
|
int fileCount,
|
||||||
|
int do_download );
|
||||||
|
|
||||||
/* single-file form of tr_torrentSetFileDLs */
|
/* single-file form of tr_torrentSetFileDLs */
|
||||||
void tr_torrentSetFileDL( tr_torrent_t *, int file, int do_download );
|
void tr_torrentSetFileDL( tr_torrent_t *, int file, int do_download );
|
||||||
|
|
Loading…
Reference in a new issue