fix: minor warnings (#3413)

* fix: signed-unsigned comparison warning

* fix: readability-implicit-bool-conversion warning

* fix: signed-unsigned comparison warning
This commit is contained in:
Charles Kerr 2022-07-05 18:32:30 -05:00 committed by GitHub
parent 9dfb3bf3df
commit e9a7ddf7f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View File

@ -254,7 +254,7 @@ bool tr_torrentUseMetainfoFromFile(
// tor should keep this metainfo
tor->setMetainfo(*metainfo);
if (tor->incompleteMetadata)
if (tor->incompleteMetadata != nullptr)
{
incompleteMetadataFree(tor->incompleteMetadata);
tor->incompleteMetadata = nullptr;

View File

@ -73,7 +73,7 @@ TEST_F(BlocklistTest, parsing)
createFileWithContents(path, Contents1);
tr_sessionReloadBlocklists(session_);
EXPECT_TRUE(tr_blocklistExists(session_));
EXPECT_EQ(5, tr_blocklistGetRuleCount(session_));
EXPECT_EQ(size_t{ 5 }, tr_blocklistGetRuleCount(session_));
// enable the blocklist
EXPECT_FALSE(tr_blocklistIsEnabled(session_));
@ -108,27 +108,27 @@ TEST_F(BlocklistTest, updating)
auto const path = tr_pathbuf{ tr_sessionGetConfigDir(session_), "/blocklists/level1" };
// no blocklist to start with...
EXPECT_EQ(0, tr_blocklistGetRuleCount(session_));
EXPECT_EQ(0U, tr_blocklistGetRuleCount(session_));
// test that updated source files will get loaded
createFileWithContents(path, Contents1);
tr_sessionReloadBlocklists(session_);
EXPECT_EQ(5, tr_blocklistGetRuleCount(session_));
EXPECT_EQ(5U, tr_blocklistGetRuleCount(session_));
// test that updated source files will get loaded
createFileWithContents(path, Contents2);
tr_sessionReloadBlocklists(session_);
EXPECT_EQ(6, tr_blocklistGetRuleCount(session_));
EXPECT_EQ(6U, tr_blocklistGetRuleCount(session_));
// test that updated source files will get loaded
createFileWithContents(path, Contents1);
tr_sessionReloadBlocklists(session_);
EXPECT_EQ(5, tr_blocklistGetRuleCount(session_));
EXPECT_EQ(5U, tr_blocklistGetRuleCount(session_));
// ensure that new files, if bad, get skipped
createFileWithContents(path, "# nothing useful\n");
tr_sessionReloadBlocklists(session_);
EXPECT_EQ(5, tr_blocklistGetRuleCount(session_));
EXPECT_EQ(5U, tr_blocklistGetRuleCount(session_));
// cleanup
}

View File

@ -227,7 +227,7 @@ TEST_F(TorrentMetainfoTest, HoffmanStyleWebseeds)
auto const src_filename = tr_pathbuf{ LIBTRANSMISSION_TEST_ASSETS_DIR, "/debian-11.2.0-amd64-DVD-1.iso.torrent"sv };
auto tm = tr_torrent_metainfo{};
EXPECT_TRUE(tm.parseTorrentFile(src_filename));
EXPECT_EQ(2, tm.webseedCount());
EXPECT_EQ(size_t{ 2 }, tm.webseedCount());
EXPECT_EQ(
"https://cdimage.debian.org/cdimage/release/11.2.0//srv/cdbuilder.debian.org/dst/deb-cd/weekly-builds/amd64/iso-dvd/debian-11.2.0-amd64-DVD-1.iso"sv,
tm.webseed(0));
@ -241,7 +241,7 @@ TEST_F(TorrentMetainfoTest, GetRightStyleWebseedList)
auto const src_filename = tr_pathbuf{ LIBTRANSMISSION_TEST_ASSETS_DIR, "/webseed-getright-list.torrent"sv };
auto tm = tr_torrent_metainfo{};
EXPECT_TRUE(tm.parseTorrentFile(src_filename));
EXPECT_EQ(2, tm.webseedCount());
EXPECT_EQ(size_t{ 2 }, tm.webseedCount());
EXPECT_EQ("http://www.webseed-one.com/"sv, tm.webseed(0));
EXPECT_EQ("http://webseed-two.com/"sv, tm.webseed(1));
}
@ -251,7 +251,7 @@ TEST_F(TorrentMetainfoTest, GetRightStyleWebseedString)
auto const src_filename = tr_pathbuf{ LIBTRANSMISSION_TEST_ASSETS_DIR, "/webseed-getright-string.torrent"sv };
auto tm = tr_torrent_metainfo{};
EXPECT_TRUE(tm.parseTorrentFile(src_filename));
EXPECT_EQ(1, tm.webseedCount());
EXPECT_EQ(size_t{ 1 }, tm.webseedCount());
EXPECT_EQ("http://www.webseed-one.com/"sv, tm.webseed(0));
}