fixup! refactor: remove tr_piece struct (#2059) (#2153)

fix: off-by-one when marking a range of pieces as untested
This commit is contained in:
Charles Kerr 2021-11-14 10:12:02 -06:00 committed by GitHub
parent 1c800511d7
commit 7b772e73e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -237,7 +237,9 @@ struct tr_torrent
// if a file has changed, mark its pieces as unchecked
if (mtime == 0 || mtime != mtimes[i])
{
checked_pieces_.unsetRange(info.files[i].firstPiece, info.files[i].lastPiece);
auto const begin = info.files[i].firstPiece;
auto const end = info.files[i].lastPiece + 1;
checked_pieces_.unsetRange(begin, end);
}
}
}