Ignore:
Timestamp:
Jul 10, 2007, 3:41:16 AM (15 years ago)
Author:
charles
Message:

fix dnd-setting bug created while splitting DND and priorities into two separate entities

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r2317 r2319  
    12041204void
    12051205tr_torrentSetFileDL( tr_torrent_t  * tor,
    1206                      int             file,
     1206                     int             fileIndex,
    12071207                     int             do_download )
    12081208{
     1209    int i;
     1210    tr_file_t * file;
     1211    const int dnd = !do_download;
     1212
    12091213    tr_torrentWriterLock( tor );
    12101214
    1211     assert( 0<=file && file<tor->info.fileCount );
    1212     tor->info.files[file].dnd = !do_download;
     1215    assert( 0<=fileIndex && fileIndex<tor->info.fileCount );
     1216    file = &tor->info.files[fileIndex];
     1217    file->dnd = dnd;
     1218    for( i=file->firstPiece; i<=file->lastPiece; ++i )
     1219      tor->info.pieces[i].dnd = dnd;
    12131220    fastResumeSave( tor );
    12141221
    12151222    tr_torrentWriterUnlock( tor );
    12161223}
     1224
     1225void
     1226tr_torrentSetFileDLs ( tr_torrent_t * tor, const uint8_t * enabled )
     1227{
     1228    int i, j;
     1229
     1230    tr_torrentWriterLock( tor );
     1231
     1232    for( i=0; i<tor->info.fileCount; ++i ) {
     1233        const int dnd = !enabled[i];
     1234        tr_file_t * file = &tor->info.files[i];
     1235        file->dnd = dnd;
     1236        for( j=file->firstPiece; j<=file->lastPiece; ++j )
     1237            tor->info.pieces[j].dnd = dnd;
     1238    }
     1239
     1240    fastResumeSave( tor );
     1241
     1242    tr_torrentWriterUnlock( tor );
     1243}
Note: See TracChangeset for help on using the changeset viewer.