diff --git a/src/file.cpp b/src/file.cpp index b44f22f2c..4f22af6b9 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -474,10 +474,18 @@ namespace libtorrent ec.clear(); #ifdef TORRENT_WINDOWS + // windows does not allow trailing / or \ in + // the path when removing files + std::string pruned; + if (inf[inf.size() - 1] == '/' + || inf[inf.size() - 1] == '\\') + pruned = inf.substr(0, inf.size() - 1); + else + pruned = inf; #ifdef UNICODE - std::wstring f = convert_to_wstring(inf); + std::wstring f = convert_to_wstring(pruned); #else - std::string f = convert_to_native(inf); + std::string f = convert_to_native(pruned); #endif if (DeleteFile(f.c_str()) == 0) { diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index bef142200..d5a0eacc2 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -4361,7 +4361,10 @@ namespace libtorrent size_type cur_payload_dl = m_statistics.last_payload_downloaded(); size_type cur_protocol_dl = m_statistics.last_protocol_downloaded(); #endif - on_receive(error, bytes_transferred); + { + INVARIANT_CHECK; + on_receive(error, bytes_transferred); + } #ifdef TORRENT_DEBUG TORRENT_ASSERT(m_statistics.last_payload_downloaded() - cur_payload_dl >= 0); TORRENT_ASSERT(m_statistics.last_protocol_downloaded() - cur_protocol_dl >= 0); diff --git a/src/storage.cpp b/src/storage.cpp index 849119717..c7df51ff2 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -645,7 +645,7 @@ namespace libtorrent ret.second = true; while (ret.second && !bp.empty()) { - std::pair ret = directories.insert(combine_path(m_save_path, bp)); + ret = directories.insert(combine_path(m_save_path, bp)); bp = parent_path(bp); } delete_one_file(p);