diff --git a/examples/client_test.cpp b/examples/client_test.cpp index ae38490f0..b75a3b062 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -400,7 +400,7 @@ std::string const& piece_bar(libtorrent::bitfield const& p, int width) int end = (std::max)(int(piece + piece_per_char), int(piece) + 1); for (int k = int(piece); k < end; ++k, ++num_pieces) if (p[k]) ++num_have; - int color = int(std::ceil(num_have / float(num_pieces) * (table_size - 1))); + int color = int(std::ceil(num_have / float((std::max)(num_pieces, 1)) * (table_size - 1))); char buf[10]; snprintf(buf, 10, "48;5;%d", 232 + color); bar += esc(buf); diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index e63580856..654386cdf 100644 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -1847,7 +1847,7 @@ namespace libtorrent { max_out_request_queue(reqq); #ifdef TORRENT_VERBOSE_LOGGING - peer_log("*** MAX OUT REQUEST QUEUE [ %d ]", req); + peer_log("*** MAX OUT REQUEST QUEUE [ %d ]", reqq); #endif } diff --git a/src/piece_picker.cpp b/src/piece_picker.cpp index 337b0adaa..b7250ccd4 100644 --- a/src/piece_picker.cpp +++ b/src/piece_picker.cpp @@ -1099,7 +1099,7 @@ namespace libtorrent std::cerr << "[" << this << "] " << "restore_piece(" << index << ")" << std::endl; #endif TORRENT_ASSERT(index >= 0); - TORRENT_ASSERT(index < (int)m_piece_map.size()); + TORRENT_ASSERT(index < int(m_piece_map.size())); int download_state = m_piece_map[index].download_queue(); TORRENT_ASSERT(download_state != piece_pos::piece_open); diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 02daa4dd4..eb5804c28 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -2390,7 +2390,7 @@ retry: if (ec) { #ifndef TORRENT_DISABLE_LOGGING - session_log("%s <== INCOMING CONNECTION FAILED, could " + session_log(" <== INCOMING CONNECTION FAILED, could " "not retrieve remote endpoint: %s" , print_endpoint(endp).c_str(), ec.message().c_str()); #endif