1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-27 01:57:52 +00:00

fix: dead store warning in torrent.cc when building without assertions (#1898)

This commit is contained in:
Charles Kerr 2021-10-07 18:44:43 -05:00 committed by GitHub
parent 2312965285
commit 93f5ad8767
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -751,7 +751,6 @@ static void refreshCurrentDir(tr_torrent* tor);
static void torrentInitFromInfo(tr_torrent* tor)
{
uint64_t t;
tr_info const* const info = &tor->info;
tor->blockSize = tr_getBlockSize(info->pieceSize);
@ -780,13 +779,14 @@ static void torrentInitFromInfo(tr_torrent* tor)
tor->blockCountInPiece = tor->blockSize != 0 ? info->pieceSize / tor->blockSize : 0;
tor->blockCountInLastPiece = tor->blockSize != 0 ? (tor->lastPieceSize + tor->blockSize - 1) / tor->blockSize : 0;
#ifdef TR_ENABLE_ASSERTS
/* check our work */
if (tor->blockSize != 0)
{
TR_ASSERT(info->pieceSize % tor->blockSize == 0);
}
t = info->pieceCount - 1;
uint64_t t = info->pieceCount - 1;
t *= info->pieceSize;
t += tor->lastPieceSize;
TR_ASSERT(t == info->totalSize);
@ -800,6 +800,7 @@ static void torrentInitFromInfo(tr_torrent* tor)
t *= tor->blockCountInPiece;
t += tor->blockCountInLastPiece;
TR_ASSERT(t == (uint64_t)tor->blockCount);
#endif
tr_cpConstruct(&tor->completion, tor);