various clang-tidy fixes

This commit is contained in:
arvidn 2020-03-17 20:27:25 +01:00 committed by Arvid Norberg
parent fd1a42e18d
commit 903ead89b1
4 changed files with 14 additions and 14 deletions

View File

@ -67,12 +67,12 @@ toolset.flags clang_tidy.compile OPTIONS <rtti>off : -fno-rtti ;
TOUCH = [ common.file-creation-command ] ;
actions compile.c++ {
"$(CONFIG_COMMAND)" -header-filter=*. -warnings-as-errors=* "$(>)" -- -x c++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" \
"$(CONFIG_COMMAND)" -quiet -header-filter=* -warnings-as-errors=* "$(>)" -- -x c++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" \
&& $(TOUCH) "$(<)"
}
actions compile.c {
"$(CONFIG_COMMAND)" -header-filter=*. -warnings-as-errors=* "$(>)" -- -x c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" \
"$(CONFIG_COMMAND)" -quiet -header-filter=* -warnings-as-errors=* "$(>)" -- -x c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" \
&& $(TOUCH) "$(<)"
}

View File

@ -587,7 +587,7 @@ namespace libtorrent {
{
char ret[200];
std::snprintf(ret, sizeof(ret), "%s peer dropped block ( piece: %d block: %d)"
, torrent_alert::message().c_str(), static_cast<int>(piece_index), block_index);
, peer_alert::message().c_str(), static_cast<int>(piece_index), block_index);
return ret;
}
@ -605,7 +605,7 @@ namespace libtorrent {
{
char ret[200];
std::snprintf(ret, sizeof(ret), "%s peer timed out request ( piece: %d block: %d)"
, torrent_alert::message().c_str(), static_cast<int>(piece_index), block_index);
, peer_alert::message().c_str(), static_cast<int>(piece_index), block_index);
return ret;
}
@ -623,7 +623,7 @@ namespace libtorrent {
{
char ret[200];
std::snprintf(ret, sizeof(ret), "%s block finished downloading (piece: %d block: %d)"
, torrent_alert::message().c_str(), static_cast<int>(piece_index), block_index);
, peer_alert::message().c_str(), static_cast<int>(piece_index), block_index);
return ret;
}
@ -644,7 +644,7 @@ namespace libtorrent {
{
char ret[200];
std::snprintf(ret, sizeof(ret), "%s requested block (piece: %d block: %d)"
, torrent_alert::message().c_str(), static_cast<int>(piece_index), block_index);
, peer_alert::message().c_str(), static_cast<int>(piece_index), block_index);
return ret;
}
@ -662,7 +662,7 @@ namespace libtorrent {
{
char ret[200];
std::snprintf(ret, sizeof(ret), "%s received block not in download queue (piece: %d block: %d)"
, torrent_alert::message().c_str(), static_cast<int>(piece_index), block_index);
, peer_alert::message().c_str(), static_cast<int>(piece_index), block_index);
return ret;
}
@ -1868,7 +1868,7 @@ namespace {
{
static char const* const mode[] =
{ "<==", "==>", "<<<", ">>>", "***" };
return torrent_alert::message() + " [" + print_endpoint(endpoint) + "] "
return peer_alert::message() + " [" + print_endpoint(endpoint) + "] "
+ mode[direction] + " " + event_type + " [ " + log_message() + " ]";
}
@ -2285,8 +2285,8 @@ namespace {
"reverse_sequential ",
"backup1 ",
"backup2 ",
"end_game "
"extent_affinity "
"end_game ",
"extent_affinity ",
};
std::string ret = peer_alert::message();
@ -2530,7 +2530,7 @@ namespace {
{
char ret[200];
snprintf(ret, sizeof(ret), "%s block uploaded to a peer (piece: %d block: %d)"
, torrent_alert::message().c_str(), static_cast<int>(piece_index), block_index);
, peer_alert::message().c_str(), static_cast<int>(piece_index), block_index);
return ret;
}

View File

@ -144,14 +144,14 @@ namespace libtorrent {
if (old_size_words && b) buf()[old_size_words - 1] |= aux::host_to_network(0xffffffff >> b);
if (old_size_words < new_size_words)
std::memset(buf() + old_size_words, 0xff
, std::size_t((new_size_words - old_size_words) * 4));
, static_cast<std::size_t>(new_size_words - old_size_words) * 4);
clear_trailing_bits();
}
else
{
if (old_size_words < new_size_words)
std::memset(buf() + old_size_words, 0x00
, std::size_t((new_size_words - old_size_words) * 4));
, static_cast<std::size_t>(new_size_words - old_size_words) * 4);
}
TORRENT_ASSERT(size() == bits);
}

View File

@ -298,7 +298,7 @@ namespace libtorrent {
}
if (int(p.file_priorities.size()) <= idx2)
p.file_priorities.resize(std::size_t(idx2 + 1), dont_download);
p.file_priorities.resize(static_cast<std::size_t>(idx2) + 1, dont_download);
for (int i = idx1; i <= idx2; i++)
p.file_priorities[std::size_t(i)] = default_priority;