fix cppcheck

This commit is contained in:
pavel.pimenov 2018-10-27 12:03:30 +03:00 committed by Arvid Norberg
parent 82ca0adc66
commit 0ad3bb139d
3 changed files with 5 additions and 9 deletions

View File

@ -628,7 +628,6 @@ namespace {
ws.resize(s.size());
std::size_t size = mbstowcs(&ws[0], s.c_str(), s.size());
if (size == std::size_t(-1)) return s;
std::string ret;
return libtorrent::wchar_utf8(ws);
}

View File

@ -145,14 +145,12 @@ namespace libtorrent { namespace aux {
TORRENT_ALLOCA(tmp_buf, iovec_t, bufs.size());
// the number of bytes left to read in the current file (specified by
// file_index). This is the minimum of (file_size - file_offset) and
// bytes_left.
int file_bytes_left;
while (bytes_left > 0)
{
file_bytes_left = bytes_left;
// the number of bytes left to read in the current file (specified by
// file_index). This is the minimum of (file_size - file_offset) and
// bytes_left.
int file_bytes_left = bytes_left;
if (file_offset + file_bytes_left > files.file_size(file_index))
file_bytes_left = std::max(static_cast<int>(files.file_size(file_index) - file_offset), 0);

View File

@ -273,9 +273,8 @@ bool is_downloading_state(int const st)
ws.emplace_back(web_seed_t(u, web_seed_entry::url_seed));
// correct URLs to end with a "/" for multi-file torrents
std::string& url = ws.back().url;
if (multi_file)
ensure_trailing_slash(url);
ensure_trailing_slash(ws.back().url);
}
for (auto const& e : p.http_seeds)