mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 02:18:42 +00:00
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:
@@ -254,7 +254,7 @@ bool tr_torrentUseMetainfoFromFile(
|
|||||||
// tor should keep this metainfo
|
// tor should keep this metainfo
|
||||||
tor->setMetainfo(*metainfo);
|
tor->setMetainfo(*metainfo);
|
||||||
|
|
||||||
if (tor->incompleteMetadata)
|
if (tor->incompleteMetadata != nullptr)
|
||||||
{
|
{
|
||||||
incompleteMetadataFree(tor->incompleteMetadata);
|
incompleteMetadataFree(tor->incompleteMetadata);
|
||||||
tor->incompleteMetadata = nullptr;
|
tor->incompleteMetadata = nullptr;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ TEST_F(BlocklistTest, parsing)
|
|||||||
createFileWithContents(path, Contents1);
|
createFileWithContents(path, Contents1);
|
||||||
tr_sessionReloadBlocklists(session_);
|
tr_sessionReloadBlocklists(session_);
|
||||||
EXPECT_TRUE(tr_blocklistExists(session_));
|
EXPECT_TRUE(tr_blocklistExists(session_));
|
||||||
EXPECT_EQ(5, tr_blocklistGetRuleCount(session_));
|
EXPECT_EQ(size_t{ 5 }, tr_blocklistGetRuleCount(session_));
|
||||||
|
|
||||||
// enable the blocklist
|
// enable the blocklist
|
||||||
EXPECT_FALSE(tr_blocklistIsEnabled(session_));
|
EXPECT_FALSE(tr_blocklistIsEnabled(session_));
|
||||||
@@ -108,27 +108,27 @@ TEST_F(BlocklistTest, updating)
|
|||||||
auto const path = tr_pathbuf{ tr_sessionGetConfigDir(session_), "/blocklists/level1" };
|
auto const path = tr_pathbuf{ tr_sessionGetConfigDir(session_), "/blocklists/level1" };
|
||||||
|
|
||||||
// no blocklist to start with...
|
// 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
|
// test that updated source files will get loaded
|
||||||
createFileWithContents(path, Contents1);
|
createFileWithContents(path, Contents1);
|
||||||
tr_sessionReloadBlocklists(session_);
|
tr_sessionReloadBlocklists(session_);
|
||||||
EXPECT_EQ(5, tr_blocklistGetRuleCount(session_));
|
EXPECT_EQ(5U, tr_blocklistGetRuleCount(session_));
|
||||||
|
|
||||||
// test that updated source files will get loaded
|
// test that updated source files will get loaded
|
||||||
createFileWithContents(path, Contents2);
|
createFileWithContents(path, Contents2);
|
||||||
tr_sessionReloadBlocklists(session_);
|
tr_sessionReloadBlocklists(session_);
|
||||||
EXPECT_EQ(6, tr_blocklistGetRuleCount(session_));
|
EXPECT_EQ(6U, tr_blocklistGetRuleCount(session_));
|
||||||
|
|
||||||
// test that updated source files will get loaded
|
// test that updated source files will get loaded
|
||||||
createFileWithContents(path, Contents1);
|
createFileWithContents(path, Contents1);
|
||||||
tr_sessionReloadBlocklists(session_);
|
tr_sessionReloadBlocklists(session_);
|
||||||
EXPECT_EQ(5, tr_blocklistGetRuleCount(session_));
|
EXPECT_EQ(5U, tr_blocklistGetRuleCount(session_));
|
||||||
|
|
||||||
// ensure that new files, if bad, get skipped
|
// ensure that new files, if bad, get skipped
|
||||||
createFileWithContents(path, "# nothing useful\n");
|
createFileWithContents(path, "# nothing useful\n");
|
||||||
tr_sessionReloadBlocklists(session_);
|
tr_sessionReloadBlocklists(session_);
|
||||||
EXPECT_EQ(5, tr_blocklistGetRuleCount(session_));
|
EXPECT_EQ(5U, tr_blocklistGetRuleCount(session_));
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 const src_filename = tr_pathbuf{ LIBTRANSMISSION_TEST_ASSETS_DIR, "/debian-11.2.0-amd64-DVD-1.iso.torrent"sv };
|
||||||
auto tm = tr_torrent_metainfo{};
|
auto tm = tr_torrent_metainfo{};
|
||||||
EXPECT_TRUE(tm.parseTorrentFile(src_filename));
|
EXPECT_TRUE(tm.parseTorrentFile(src_filename));
|
||||||
EXPECT_EQ(2, tm.webseedCount());
|
EXPECT_EQ(size_t{ 2 }, tm.webseedCount());
|
||||||
EXPECT_EQ(
|
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,
|
"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));
|
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 const src_filename = tr_pathbuf{ LIBTRANSMISSION_TEST_ASSETS_DIR, "/webseed-getright-list.torrent"sv };
|
||||||
auto tm = tr_torrent_metainfo{};
|
auto tm = tr_torrent_metainfo{};
|
||||||
EXPECT_TRUE(tm.parseTorrentFile(src_filename));
|
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://www.webseed-one.com/"sv, tm.webseed(0));
|
||||||
EXPECT_EQ("http://webseed-two.com/"sv, tm.webseed(1));
|
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 const src_filename = tr_pathbuf{ LIBTRANSMISSION_TEST_ASSETS_DIR, "/webseed-getright-string.torrent"sv };
|
||||||
auto tm = tr_torrent_metainfo{};
|
auto tm = tr_torrent_metainfo{};
|
||||||
EXPECT_TRUE(tm.parseTorrentFile(src_filename));
|
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));
|
EXPECT_EQ("http://www.webseed-one.com/"sv, tm.webseed(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user