From 0ad3bb139d6a38303d9918c57c81189f35fa977e Mon Sep 17 00:00:00 2001 From: "pavel.pimenov" Date: Sat, 27 Oct 2018 12:03:30 +0300 Subject: [PATCH] fix cppcheck --- src/escape_string.cpp | 1 - src/storage_utils.cpp | 10 ++++------ src/torrent.cpp | 3 +-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/escape_string.cpp b/src/escape_string.cpp index cd6552719..f22b16bb1 100644 --- a/src/escape_string.cpp +++ b/src/escape_string.cpp @@ -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); } diff --git a/src/storage_utils.cpp b/src/storage_utils.cpp index 4baed311c..c88fdbd64 100644 --- a/src/storage_utils.cpp +++ b/src/storage_utils.cpp @@ -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(files.file_size(file_index) - file_offset), 0); diff --git a/src/torrent.cpp b/src/torrent.cpp index 5f3999d8a..b0869bed4 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -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)