From 5f5ba9446215363b37adc6d69882e6ae3bb72df8 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 25 Feb 2011 04:28:32 +0000 Subject: [PATCH] cleared some variables in constructors and got rid of an unnecessary constructor --- include/libtorrent/file_pool.hpp | 2 +- include/libtorrent/policy.hpp | 2 +- src/bt_peer_connection.cpp | 2 ++ src/policy.cpp | 3 --- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/libtorrent/file_pool.hpp b/include/libtorrent/file_pool.hpp index f0a98425a..6b1c51e3a 100644 --- a/include/libtorrent/file_pool.hpp +++ b/include/libtorrent/file_pool.hpp @@ -73,7 +73,7 @@ namespace libtorrent struct lru_file_entry { - lru_file_entry(): last_use(time_now()) {} + lru_file_entry(): key(0), last_use(time_now()), mode(0) {} mutable boost::intrusive_ptr file_ptr; void* key; ptime last_use; diff --git a/include/libtorrent/policy.hpp b/include/libtorrent/policy.hpp index 0f5b0d3a8..ab5d9d1bd 100644 --- a/include/libtorrent/policy.hpp +++ b/include/libtorrent/policy.hpp @@ -60,7 +60,7 @@ namespace libtorrent // min value is 0, max value is 16775168 struct ufloat16 { - ufloat16() {} + ufloat16():m_val(0) {} ufloat16(int v) { *this = v; } operator int() diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index f74a0feeb..a3e92dca6 100644 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -125,6 +125,7 @@ namespace libtorrent m_in_constructor = false; m_encrypted_bytes = 0; #endif + memset(m_reserved_bits, 0, sizeof(m_reserved_bits)); } bt_peer_connection::bt_peer_connection( @@ -176,6 +177,7 @@ namespace libtorrent m_in_constructor = false; m_encrypted_bytes = 0; #endif + memset(m_reserved_bits, 0, sizeof(m_reserved_bits)); } void bt_peer_connection::start() diff --git a/src/policy.cpp b/src/policy.cpp index 85f3c4a57..25afe020a 100644 --- a/src/policy.cpp +++ b/src/policy.cpp @@ -1532,9 +1532,6 @@ namespace libtorrent } #endif // TORRENT_DEBUG - policy::peer::peer() - {} - policy::peer::peer(boost::uint16_t port, bool conn, int src) : prev_amount_upload(0) , prev_amount_download(0)