mirror of
https://github.com/transmission/transmission
synced 2025-02-22 22:20:39 +00:00
refactor: remove unused declarations from tr-macros.h (#4630)
This commit is contained in:
parent
506439f099
commit
43bb4bc1c8
3 changed files with 9 additions and 10 deletions
|
@ -33,10 +33,14 @@ using namespace std::literals;
|
|||
|
||||
namespace
|
||||
{
|
||||
constexpr auto TrSha1DigestStrlen = size_t{ 40 };
|
||||
|
||||
constexpr auto TrSha256DigestStrlen = size_t{ 64 };
|
||||
|
||||
namespace ssha1_impl
|
||||
{
|
||||
|
||||
auto constexpr DigestStringSize = TR_SHA1_DIGEST_STRLEN;
|
||||
auto constexpr DigestStringSize = TrSha1DigestStrlen;
|
||||
auto constexpr SaltedPrefix = "{"sv;
|
||||
|
||||
std::string tr_salt(std::string_view plaintext, std::string_view salt)
|
||||
|
@ -210,7 +214,7 @@ std::optional<tr_sha1_digest_t> tr_sha1_from_string(std::string_view hex)
|
|||
{
|
||||
using namespace hex_impl;
|
||||
|
||||
if (std::size(hex) != TR_SHA1_DIGEST_STRLEN)
|
||||
if (std::size(hex) != TrSha1DigestStrlen)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
@ -229,7 +233,7 @@ std::optional<tr_sha256_digest_t> tr_sha256_from_string(std::string_view hex)
|
|||
{
|
||||
using namespace hex_impl;
|
||||
|
||||
if (std::size(hex) != TR_SHA256_DIGEST_STRLEN)
|
||||
if (std::size(hex) != TrSha256DigestStrlen)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -103,13 +103,8 @@ using tr_announce_key_t = uint32_t;
|
|||
// A string of length 20 which this downloader uses as its id. Each
|
||||
// downloader generates its own id at random at the start of a new
|
||||
// download. This value will also almost certainly have to be escaped.
|
||||
auto inline constexpr PEER_ID_LEN = size_t{ 20 };
|
||||
using tr_peer_id_t = std::array<char, PEER_ID_LEN>;
|
||||
using tr_peer_id_t = std::array<char, 20>;
|
||||
|
||||
auto inline constexpr TR_SHA1_DIGEST_STRLEN = size_t{ 40 };
|
||||
using tr_sha1_digest_t = std::array<std::byte, 20>;
|
||||
using tr_sha1_digest_string_t = std::array<char, TR_SHA1_DIGEST_STRLEN + 1>; // +1 for '\0'
|
||||
|
||||
auto inline constexpr TR_SHA256_DIGEST_STRLEN = size_t{ 64 };
|
||||
using tr_sha256_digest_t = std::array<std::byte, 32>;
|
||||
using tr_sha256_digest_string_t = std::array<char, TR_SHA256_DIGEST_STRLEN + 1>; // +1 for '\0'
|
||||
|
|
|
@ -184,7 +184,7 @@ TEST_F(SessionTest, peerId)
|
|||
auto const buf = tr_peerIdInit();
|
||||
|
||||
// confirm that it begins with peer_id_prefix
|
||||
auto const peer_id = std::string_view(reinterpret_cast<char const*>(buf.data()), PEER_ID_LEN);
|
||||
auto const peer_id = std::string_view{ reinterpret_cast<char const*>(buf.data()), std::size(buf) };
|
||||
EXPECT_EQ(peer_id_prefix, peer_id.substr(0, peer_id_prefix.size()));
|
||||
|
||||
// confirm that its total is evenly divisible by 36
|
||||
|
|
Loading…
Reference in a new issue