diff --git a/src/base/bittorrent/torrentinfo.cpp b/src/base/bittorrent/torrentinfo.cpp index a5a38d888..df96014a6 100644 --- a/src/base/bittorrent/torrentinfo.cpp +++ b/src/base/bittorrent/torrentinfo.cpp @@ -339,9 +339,9 @@ TorrentInfo::PieceRange TorrentInfo::filePieces(int fileIndex) const const libt::file_storage &files = nativeInfo()->files(); const auto fileSize = files.file_size(fileIndex); - const auto firstOffset = files.file_offset(fileIndex); - return makeInterval(static_cast(firstOffset / pieceLength()), - static_cast((firstOffset + fileSize - 1) / pieceLength())); + const auto fileOffset = files.file_offset(fileIndex); + return makeInterval(static_cast(fileOffset / pieceLength()), + static_cast((fileOffset + fileSize - 1) / pieceLength())); } void TorrentInfo::renameFile(const int index, const QString &newPath)