mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
commit
c9ff0abade
1 changed files with 7 additions and 2 deletions
|
@ -363,8 +363,13 @@ TorrentInfo::PieceRange TorrentInfo::filePieces(const int fileIndex) const
|
||||||
const lt::file_storage &files = nativeInfo()->files();
|
const lt::file_storage &files = nativeInfo()->files();
|
||||||
const auto fileSize = files.file_size(LTFileIndex {fileIndex});
|
const auto fileSize = files.file_size(LTFileIndex {fileIndex});
|
||||||
const auto fileOffset = files.file_offset(LTFileIndex {fileIndex});
|
const auto fileOffset = files.file_offset(LTFileIndex {fileIndex});
|
||||||
return makeInterval(static_cast<int>(fileOffset / pieceLength()),
|
|
||||||
static_cast<int>((fileOffset + fileSize - 1) / pieceLength()));
|
const int beginIdx = (fileOffset / pieceLength());
|
||||||
|
const int endIdx = ((fileOffset + fileSize - 1) / pieceLength());
|
||||||
|
|
||||||
|
if (fileSize <= 0)
|
||||||
|
return {beginIdx, 0};
|
||||||
|
return makeInterval(beginIdx, endIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorrentInfo::renameFile(const int index, const QString &newPath)
|
void TorrentInfo::renameFile(const int index, const QString &newPath)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue