general cleanup. remove valgrind markup, log_hash_failures and C headers (#752)

general cleanup. remove valgrind markup, log_hash_failures and C headers
This commit is contained in:
Arvid Norberg 2016-05-23 08:15:39 -04:00
parent f1216686d2
commit 748af6eec1
59 changed files with 148 additions and 367 deletions

View File

@ -392,9 +392,6 @@ feature iconv : auto on off : composite propagated ;
feature.compose <iconv>on : <define>TORRENT_USE_ICONV=1 ;
feature.compose <iconv>off : <define>TORRENT_USE_ICONV=0 ;
feature use-valgrind : off on : composite propagated link-incompatible ;
feature.compose <use-valgrind>on : <define>TORRENT_USE_VALGRIND=1 ;
feature memory-optimization : off on : composite propagated link-incompatible ;
feature.compose <memory-optimization>on : <define>TORRENT_OPTIMIZE_MEMORY_USAGE ;

View File

@ -3,6 +3,8 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <libtorrent/sha1_hash.hpp>
#include <iostream>
#include "boost_python.hpp"
#include "bytes.hpp"
@ -36,7 +38,6 @@ void bind_sha1_hash()
.def("to_bytes", sha1_hash_bytes)
;
scope().attr("big_number") = scope().attr("sha1_hash");
scope().attr("peer_id") = scope().attr("sha1_hash");
scope().attr("peer_id") = scope().attr("sha1_hash");
}

View File

@ -6,8 +6,15 @@
#define BOOST_PYTHON_HPP
#include <libtorrent/aux_/disable_warnings_push.hpp>
#include <iostream>
#include <boost/python.hpp>
#include <libtorrent/aux_/disable_warnings_pop.hpp>
// something in here creates a define for this, presumably to make older
// versions of msvc appear to support snprintf
#ifdef snprintf
#undef snprintf
#endif
#endif

View File

@ -72,6 +72,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/time.hpp"
#include "libtorrent/create_torrent.hpp"
#include "libtorrent/read_resume_data.hpp"
#include "libtorrent/hex.hpp" // for to_hex, from_hex
#include "torrent_view.hpp"
#include "session_view.hpp"

View File

@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/announce_entry.hpp"
#include "libtorrent/bdecode.hpp"
#include "libtorrent/magnet_uri.hpp"
#include "libtorrent/hex.hpp" // for to_hex, from_hex
int load_file(std::string const& filename, std::vector<char>& v
, libtorrent::error_code& ec, int limit = 8000000)

View File

@ -47,6 +47,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/version.hpp"
#include "libtorrent/socket.hpp" // for tcp::endpoint
#include "libtorrent/bitfield.hpp"
#include "libtorrent/error_code.hpp"
namespace libtorrent
{

View File

@ -42,23 +42,19 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/torrent_peer_allocator.hpp"
#include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <algorithm>
#include <vector>
#include <set>
#include <list>
#include <condition_variable>
#include <mutex>
#include <stdarg.h> // for va_start, va_end
#include <cstdarg> // for va_start, va_end
#include <unordered_map>
#ifdef TORRENT_USE_OPENSSL
#include "libtorrent/ssl_stream.hpp"
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/session.hpp" // for user_load_function_t
#include "libtorrent/ip_voter.hpp"
#include "libtorrent/entry.hpp"

View File

@ -71,20 +71,12 @@ POSSIBILITY OF SUCH DAMAGE.
// performs a little bit better and can have a higher recursion limit on the
// structures it's parsing.
#include <stdlib.h>
#include <string>
#include <exception>
#include <iterator> // for distance
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/static_assert.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/entry.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/entry.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/io.hpp" // for write_string
@ -103,7 +95,7 @@ namespace libtorrent
// the stack allocated buffer for keeping the
// decimal representation of the number can
// not hold number bigger than this:
BOOST_STATIC_ASSERT(sizeof(entry::integer_type) <= 8);
static_assert(sizeof(entry::integer_type) <= 8, "64 bit integers required");
char buf[21];
int ret = 0;
for (char const* str = integer_to_str(buf, 21, val);

View File

@ -36,10 +36,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/peer_id.hpp" // for sha1_hash
#include "libtorrent/config.hpp" // for sha1_hash
#include <cmath> // for log()
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/cstdint.hpp>
#include <math.h> // for log()
#include "libtorrent/aux_/disable_warnings_pop.hpp"
@ -70,7 +71,7 @@ namespace libtorrent
{
const int c = (std::min)(count_zero_bits(bits, N), (N * 8) - 1);
const int m = N * 8;
return ::log(c / float(m)) / (2.f * ::log(1.f - 1.f/m));
return std::log(c / float(m)) / (2.f * std::log(1.f - 1.f/m));
}
bloom_filter() { clear(); }

View File

@ -37,9 +37,12 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/invariant_check.hpp"
#include "libtorrent/assert.hpp"
#include <cstdlib> // malloc/free/realloc
#include <boost/cstdint.hpp>
#include <algorithm> // for std::swap
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/cstdint.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
namespace libtorrent {
class buffer

View File

@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_PEER_CLASS_TYPE_FILTER_HPP_INCLUDED
#define TORRENT_PEER_CLASS_TYPE_FILTER_HPP_INCLUDED
#include <string.h> // for memset
#include <cstring> // for memset
#include <boost/cstdint.hpp>
namespace libtorrent
@ -46,8 +46,8 @@ namespace libtorrent
{
peer_class_type_filter()
{
memset(m_peer_class_type_mask, 0xff, sizeof(m_peer_class_type_mask));
memset(m_peer_class_type, 0, sizeof(m_peer_class_type));
std::memset(m_peer_class_type_mask, 0xff, sizeof(m_peer_class_type_mask));
std::memset(m_peer_class_type, 0, sizeof(m_peer_class_type));
}
enum socket_type_t

View File

@ -33,15 +33,11 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_PEER_ID_HPP_INCLUDED
#define TORRENT_PEER_ID_HPP_INCLUDED
#include "libtorrent/config.hpp"
#include "libtorrent/sha1_hash.hpp"
namespace libtorrent
{
typedef sha1_hash peer_id;
#ifndef TORRENT_NO_DEPRECATE
typedef sha1_hash big_number;
#endif
using peer_id = sha1_hash;
}
#endif // TORRENT_PEER_ID_HPP_INCLUDED

View File

@ -37,17 +37,18 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <algorithm>
#include <vector>
#include <bitset>
#include <utility>
#include <boost/static_assert.hpp>
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/cstdint.hpp>
#include <boost/tuple/tuple.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#ifdef TORRENT_DEBUG_REFCOUNTS
#include <set>
#endif
@ -56,8 +57,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <set>
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/peer_id.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/time.hpp"
@ -707,9 +706,9 @@ namespace libtorrent
#ifndef TORRENT_DEBUG_REFCOUNTS
#ifdef TORRENT_OPTIMIZE_MEMORY_USAGE
BOOST_STATIC_ASSERT(sizeof(piece_pos) == sizeof(char) * 4);
static_assert(sizeof(piece_pos) == sizeof(char) * 4, "unexpected struct size");
#else
BOOST_STATIC_ASSERT(sizeof(piece_pos) == sizeof(char) * 8);
static_assert(sizeof(piece_pos) == sizeof(char) * 8, "unexpected struct size");
#endif
#endif

View File

@ -42,11 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/assert.hpp"
#include "libtorrent/aux_/byteswap.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
#if TORRENT_USE_IOSTREAM
#include <iostream>
#include <iomanip>
#endif
#include <iosfwd>
#ifdef max
#undef max
@ -151,8 +147,8 @@ namespace libtorrent
{
for (int i = 0; i < number_size; ++i)
{
boost::uint32_t lhs = aux::network_to_host(m_number[i]);
boost::uint32_t rhs = aux::network_to_host(n.m_number[i]);
boost::uint32_t const lhs = aux::network_to_host(m_number[i]);
boost::uint32_t const rhs = aux::network_to_host(n.m_number[i]);
if (lhs < rhs) return true;
if (lhs > rhs) return false;
}
@ -222,8 +218,8 @@ namespace libtorrent
return reinterpret_cast<boost::uint8_t const*>(m_number)[i];
}
typedef const boost::uint8_t* const_iterator;
typedef boost::uint8_t* iterator;
using const_iterator = boost::uint8_t const*;
using iterator = boost::uint8_t*;
// start and end iterators for the hash. The value type
// of these iterators is ``boost::uint8_t``.
@ -259,26 +255,11 @@ namespace libtorrent
return ret;
}
#if TORRENT_USE_IOSTREAM
// print a sha1_hash object to an ostream as 40 hexadecimal digits
inline std::ostream& operator<<(std::ostream& os, sha1_hash const& peer)
{
char out[41];
to_hex(reinterpret_cast<char const*>(&peer[0]), sha1_hash::size, out);
return os << out;
}
TORRENT_EXPORT std::ostream& operator<<(std::ostream& os, sha1_hash const& peer);
// read 40 hexadecimal digits from an istream into a sha1_hash
inline std::istream& operator>>(std::istream& is, sha1_hash& peer)
{
char hex[40];
is.read(hex, 40);
if (!from_hex(hex, 40, reinterpret_cast<char*>(&peer[0])))
is.setstate(std::ios_base::failbit);
return is;
}
#endif // TORRENT_USE_IOSTREAM
TORRENT_EXPORT std::istream& operator>>(std::istream& is, sha1_hash& peer);
}
namespace std {
@ -296,5 +277,5 @@ namespace std {
};
}
#endif // TORRENT_PEER_ID_HPP_INCLUDED
#endif // TORRENT_SHA1_HASH_HPP_INCLUDED

View File

@ -35,7 +35,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <algorithm>
#include <vector>
#include <assert.h>
#include <cstring>
#include <limits>
#include <boost/cstdint.hpp>

View File

@ -388,8 +388,6 @@ namespace libtorrent
// these functions will be removed in a future version
TORRENT_DEPRECATED
torrent_info(entry const& torrent_file);
TORRENT_DEPRECATED
void print(std::ostream& os) const;
// ------- end deprecation -------
#endif

View File

@ -39,15 +39,14 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/sha1_hash.hpp"
#include "libtorrent/time.hpp" // for time_duration
#include "libtorrent/storage_defs.hpp" // for storage_mode_t
#include "libtorrent/error_code.hpp" // for storage_mode_t
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/cstdint.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include <string>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
namespace libtorrent
{
// holds a snapshot of the status of a torrent, as queried by

View File

@ -35,13 +35,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <vector>
#include <string>
#include <list>
#include <utility>
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/cstdint.hpp>
@ -66,6 +66,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/array_view.hpp"
#include "libtorrent/time.hpp"
#include "libtorrent/debug.hpp"
#include "libtorrent/error_code.hpp"
namespace libtorrent
{

View File

@ -34,11 +34,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include "settings.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/kademlia/node.hpp" // for verify_message
#include "libtorrent/kademlia/dht_storage.hpp"
#include "libtorrent/io_service.hpp"
#include "libtorrent/address.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
#include "libtorrent/aux_/time.hpp"
#include "simulator/simulator.hpp"

View File

@ -42,8 +42,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/http_connection.hpp"
#include "libtorrent/resolver.hpp"
#include "libtorrent/io.hpp"
#include "make_proxy_settings.hpp"
#include <iostream>
#include <boost/crc.hpp>
using namespace libtorrent;

View File

@ -47,6 +47,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/performance_counters.hpp"
#include "libtorrent/stack_allocator.hpp"
#include "libtorrent/piece_picker.hpp" // for piece_block
#include "libtorrent/hex.hpp" // to_hex, from_hex
#include "libtorrent/aux_/escape_string.hpp" // for convert_from_native
#include "libtorrent/aux_/max_path.hpp" // for TORRENT_MAX_PATH

View File

@ -45,6 +45,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#ifndef TORRENT_DISABLE_LOGGING
#include "libtorrent/hex.hpp" // to_hex, from_hex
#endif
#include "libtorrent/bt_peer_connection.hpp"
#include "libtorrent/session.hpp"
#include "libtorrent/identify_client.hpp"

View File

@ -71,15 +71,14 @@ POSSIBILITY OF SUCH DAMAGE.
#ifdef TORRENT_DEBUG_FILE_LEAKS
#include <set>
#include <cstdio>
#endif
// for convert_to_wstring and convert_to_native
#include "libtorrent/aux_/escape_string.hpp"
#include <stdio.h>
#include "libtorrent/assert.hpp"
#include <boost/scoped_ptr.hpp>
#include <boost/static_assert.hpp>
#ifdef TORRENT_DISK_STATS
#include "libtorrent/io.hpp"
@ -147,7 +146,7 @@ POSSIBILITY OF SUCH DAMAGE.
// related functions support 64-bit offsets.
// this test makes sure lseek() returns a type
// at least 64 bits wide
BOOST_STATIC_ASSERT(sizeof(lseek(0, 0, 0)) >= 8);
static_assert(sizeof(lseek(0, 0, 0)) >= 8, "64 bit file operations are required");
#endif // posix part
@ -323,9 +322,9 @@ done:
#endif
#ifdef TORRENT_DEBUG
BOOST_STATIC_ASSERT((libtorrent::file::rw_mask & libtorrent::file::sparse) == 0);
BOOST_STATIC_ASSERT((libtorrent::file::rw_mask & libtorrent::file::attribute_mask) == 0);
BOOST_STATIC_ASSERT((libtorrent::file::sparse & libtorrent::file::attribute_mask) == 0);
static_assert((libtorrent::file::rw_mask & libtorrent::file::sparse) == 0, "internal flags error");
static_assert((libtorrent::file::rw_mask & libtorrent::file::attribute_mask) == 0, "internal flags error");
static_assert((libtorrent::file::sparse & libtorrent::file::attribute_mask) == 0, "internal flags error");
#endif
#if defined TORRENT_WINDOWS && defined UNICODE && !TORRENT_USE_WSTRING
@ -2352,7 +2351,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
void print_open_files(char const* event, char const* name)
{
FILE* out = fopen("open_files.log", "a+");
FILE* out = std::fopen("open_files.log", "a+");
std::lock_guard<std::mutex> l(file_handle_mutex);
std::fprintf(out, "\n\nEVENT: %s TORRENT: %s\n\n", event, name);
for (std::set<file_handle*>::iterator i = global_file_handles.begin()
@ -2367,7 +2366,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
h->print_info(out);
std::fprintf(out, "\n%s\n\n", h.stack);
}
fclose(out);
std::fclose(out);
}
#endif
}

View File

@ -51,6 +51,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/aux_/time.hpp"
#ifndef TORRENT_DISABLE_LOGGING
#include "libtorrent/hex.hpp" // to_hex, from_hex
#endif
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/bind.hpp>

View File

@ -36,6 +36,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include <libtorrent/io.hpp>
#include <libtorrent/socket.hpp>
#include <libtorrent/socket_io.hpp>
#ifndef TORRENT_DISABLE_LOGGING
#include <libtorrent/hex.hpp> // to_hex, from_hex
#endif
#include <vector>
namespace libtorrent { namespace dht

View File

@ -36,6 +36,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include <libtorrent/socket_io.hpp>
#include <libtorrent/performance_counters.hpp>
#ifndef TORRENT_DISABLE_LOGGING
#include <libtorrent/hex.hpp> // to_hex, from_hex
#endif
namespace libtorrent { namespace dht
{

View File

@ -42,10 +42,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/bdecode.hpp"
#endif
#ifdef TORRENT_USE_VALGRIND
#include <valgrind/memcheck.h>
#endif
namespace libtorrent { namespace dht
{
@ -107,12 +103,6 @@ bool verify_mutable_item(
, char const* pk
, char const* sig)
{
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(v.first, v.second);
VALGRIND_CHECK_MEM_IS_DEFINED(pk, item_pk_len);
VALGRIND_CHECK_MEM_IS_DEFINED(sig, item_sig_len);
#endif
char str[canonical_length];
int len = canonical_string(v, seq, salt, str);
@ -136,12 +126,6 @@ void sign_mutable_item(
, char const* sk
, char* sig)
{
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(v.first, v.second);
VALGRIND_CHECK_MEM_IS_DEFINED(sk, item_sk_len);
VALGRIND_CHECK_MEM_IS_DEFINED(pk, item_pk_len);
#endif
char str[canonical_length];
int len = canonical_string(v, seq, salt, str);

View File

@ -32,20 +32,21 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <utility>
#include <cinttypes> // for PRId64 et.al.
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/bind.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/function/function1.hpp>
#ifdef TORRENT_USE_VALGRIND
#include <valgrind/memcheck.h>
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#ifndef TORRENT_DISABLE_LOGGING
#include <libtorrent/hex.hpp> // to_hex, from_hex
#endif
#include "libtorrent/io.hpp"
#include "libtorrent/bencode.hpp"
#include "libtorrent/hasher.hpp"
@ -1061,12 +1062,7 @@ void node::incoming_request(msg const& m, entry& e)
else
{
// mutable put, we must verify the signature
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(msg_keys[4].string_ptr(), item_sig_len);
VALGRIND_CHECK_MEM_IS_DEFINED(pk, item_pk_len);
#endif
boost::int64_t seq = msg_keys[2].int_value();
boost::int64_t const seq = msg_keys[2].int_value();
if (seq < 0)
{

View File

@ -40,6 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include <libtorrent/hex.hpp> // to_hex, from_hex
#include "libtorrent/kademlia/routing_table.hpp"
#include "libtorrent/broadcast_socket.hpp" // for cidr_distance
#include "libtorrent/session_status.hpp"

View File

@ -42,6 +42,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include <libtorrent/alert_types.hpp> // for dht_lookup
#include <libtorrent/aux_/time.hpp>
#ifndef TORRENT_DISABLE_LOGGING
#include <libtorrent/hex.hpp> // to_hex, from_hex
#endif
#include <boost/bind.hpp>
namespace libtorrent { namespace dht

View File

@ -30,6 +30,9 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include <cstdlib>
#include <cstdarg>
#include "libtorrent/lsd.hpp"
#include "libtorrent/io.hpp"
#include "libtorrent/http_tracker_connection.hpp"
@ -38,15 +41,14 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/http_parser.hpp"
#include "libtorrent/socket_io.hpp" // for print_address
#include "libtorrent/debug.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/bind.hpp>
#include <boost/asio/ip/host_name.hpp>
#include <boost/asio/ip/multicast.hpp>
#include <cstdlib>
#include <boost/config.hpp>
#include <cstdarg>
#include "libtorrent/aux_/disable_warnings_pop.hpp"

View File

@ -38,6 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/torrent_status.hpp"
#include "libtorrent/torrent_info.hpp"
#include "libtorrent/announce_entry.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
#include <string>

View File

@ -66,10 +66,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/assert.hpp"
#include <boost/scoped_array.hpp>
#ifdef TORRENT_USE_VALGRIND
#include <valgrind/memcheck.h>
#endif
namespace
{
// round up to even kilobyte
@ -414,9 +410,6 @@ namespace libtorrent
}
memset(ptr, 0, m_header_size - (ptr - reinterpret_cast<char*>(header.get())));
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(header.get(), m_header_size);
#endif
file::iovec_t b = {header.get(), size_t(m_header_size) };
m_file.writev(0, &b, 1, ec);
if (ec) return;

View File

@ -33,10 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/peer_class.hpp"
#include "libtorrent/peer_connection.hpp"
#ifdef TORRENT_USE_VALGRIND
#include <valgrind/memcheck.h>
#endif
namespace libtorrent
{
void peer_class::set_upload_limit(int limit)
@ -99,9 +95,6 @@ namespace libtorrent
void peer_class_pool::decref(peer_class_t c)
{
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_VALUE_IS_DEFINED(c);
#endif
TORRENT_ASSERT(c < m_peer_classes.size());
TORRENT_ASSERT(m_peer_classes[c].get());
@ -113,9 +106,6 @@ namespace libtorrent
void peer_class_pool::incref(peer_class_t c)
{
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_VALUE_IS_DEFINED(c);
#endif
TORRENT_ASSERT(c < m_peer_classes.size());
TORRENT_ASSERT(m_peer_classes[c].get());
@ -124,9 +114,6 @@ namespace libtorrent
peer_class* peer_class_pool::at(peer_class_t c)
{
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_VALUE_IS_DEFINED(c);
#endif
if (c >= m_peer_classes.size()) return 0;
return m_peer_classes[c].get();
}

View File

@ -48,9 +48,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#ifndef TORRENT_DISABLE_LOGGING
#include <stdarg.h> // for va_start, va_end
#include <stdio.h> // for vsnprintf
#include <cstdarg> // for va_start, va_end
#include <cstdio> // for vsnprintf
#include "libtorrent/socket_io.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
#endif
#include "libtorrent/peer_connection.hpp"
@ -517,7 +518,7 @@ namespace libtorrent
// TODO: it would be neat to be able to print this straight into the
// alert's stack allocator
char buf[512];
vsnprintf(buf, sizeof(buf), fmt, v);
std::vsnprintf(buf, sizeof(buf), fmt, v);
va_end(v);
torrent_handle h;

View File

@ -34,10 +34,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/assert.hpp"
#include <string.h> // for memset
#ifdef TORRENT_USE_VALGRIND
#include <valgrind/memcheck.h>
#endif
namespace libtorrent {
@ -86,9 +82,6 @@ namespace libtorrent {
{
TORRENT_ASSERT(i >= 0);
TORRENT_ASSERT(i < num_counters);
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_VALUE_IS_DEFINED(m_stats_counter[i]);
#endif
#ifdef ATOMIC_LLONG_LOCK_FREE
return m_stats_counter[i].load(std::memory_order_relaxed);

View File

@ -56,10 +56,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/torrent_peer.hpp"
#endif
#ifdef TORRENT_USE_VALGRIND
#include <valgrind/memcheck.h>
#endif
#include "libtorrent/invariant_check.hpp"
#define TORRENT_PIECE_PICKER_INVARIANT_CHECK INVARIANT_CHECK
@ -230,28 +226,17 @@ namespace libtorrent
TORRENT_ASSERT(int(ret.info_idx) * m_blocks_per_piece
+ m_blocks_per_piece <= int(m_block_info.size()));
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_VALUE_IS_DEFINED(piece);
VALGRIND_CHECK_VALUE_IS_DEFINED(block_index);
#endif
block_info* info = blocks_for_piece(ret);
for (int i = 0; i < m_blocks_per_piece; ++i)
{
info[i].num_peers = 0;
info[i].state = block_info::state_none;
info[i].peer = 0;
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_VALUE_IS_DEFINED(info[i].peer);
#endif
#if TORRENT_USE_ASSERTS
info[i].piece_index = piece;
info[i].peers.clear();
#endif
}
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_VALUE_IS_DEFINED(ret.info_idx);
VALGRIND_CHECK_VALUE_IS_DEFINED(ret.index);
#endif
downloading_iter = m_downloads[download_state].insert(downloading_iter, ret);
#if TORRENT_USE_INVARIANT_CHECKS
@ -3027,9 +3012,6 @@ get_out:
*/
bool piece_picker::is_requested(piece_block block) const
{
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_VALUE_IS_DEFINED(block);
#endif
TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
TORRENT_ASSERT(block.piece_index < m_piece_map.size());
@ -3048,9 +3030,6 @@ get_out:
bool piece_picker::is_downloaded(piece_block block) const
{
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_VALUE_IS_DEFINED(block);
#endif
TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
TORRENT_ASSERT(block.piece_index < m_piece_map.size());
@ -3070,9 +3049,6 @@ get_out:
bool piece_picker::is_finished(piece_block block) const
{
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_VALUE_IS_DEFINED(block);
#endif
TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
TORRENT_ASSERT(block.piece_index < m_piece_map.size());

View File

@ -329,11 +329,6 @@ namespace libtorrent
// configurations this will give a link error
void TORRENT_EXPORT TORRENT_CFG() {}
#if defined _MSC_VER && defined TORRENT_DEBUG
static void straight_to_debugger(unsigned int, _EXCEPTION_POINTERS*)
{ throw; }
#endif
void session::start(int flags, settings_pack const& pack, io_service* ios)
{
bool const internal_executor = ios == NULL;

View File

@ -32,8 +32,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <ctime>
#include <algorithm>
#include <cctype>
@ -45,16 +43,14 @@ POSSIBILITY OF SUCH DAMAGE.
#include <unordered_set>
#endif // TORRENT_DEBUG && !TORRENT_DISABLE_INVARIANT_CHECKS
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/limits.hpp>
#include <boost/bind.hpp>
#include <boost/function_equal.hpp>
#include <boost/make_shared.hpp>
#include <boost/asio/ip/v6_only.hpp>
#ifdef TORRENT_USE_VALGRIND
#include <valgrind/memcheck.h>
#endif
#if TORRENT_USE_RLIMIT
#ifdef __GNUC__
@ -120,6 +116,7 @@ const rlim_t rlim_infinity = RLIM_INFINITY;
#ifndef TORRENT_DISABLE_LOGGING
#include "libtorrent/socket_io.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
// for logging stat layout
#include "libtorrent/stat.hpp"

View File

@ -32,9 +32,31 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/sha1_hash.hpp"
#include "libtorrent/aux_/cpuid.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
#include <iostream>
#include <iomanip>
namespace libtorrent
{
// print a sha1_hash object to an ostream as 40 hexadecimal digits
std::ostream& operator<<(std::ostream& os, sha1_hash const& peer)
{
char out[sha1_hash::size * 2 + 1];
to_hex(peer.data(), sha1_hash::size, out);
return os << out;
}
// read 40 hexadecimal digits from an istream into a sha1_hash
std::istream& operator>>(std::istream& is, sha1_hash& peer)
{
char hex[sha1_hash::size];
is.read(hex, sha1_hash::size);
if (!from_hex(hex, sha1_hash::size, peer.data()))
is.setstate(std::ios_base::failbit);
return is;
}
int sha1_hash::count_leading_zeroes() const
{
int ret = 0;

View File

@ -37,14 +37,14 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include <vector>
#include <map>
#include <utility>
#include <numeric>
#include <cstdio>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/hasher.hpp"
#include "libtorrent/torrent.hpp"
#include "libtorrent/torrent_handle.hpp"
@ -57,63 +57,14 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/random.hpp"
#include "libtorrent/operations.hpp" // for operation_t enum
//#define TORRENT_LOG_HASH_FAILURES
#ifndef TORRENT_DISABLE_LOGGING
#include "libtorrent/socket_io.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
#endif
#ifdef TORRENT_LOG_HASH_FAILURES
#include "libtorrent/peer_id.hpp" // sha1_hash
#include "libtorrent/hex.hpp" // to_hex
#include "libtorrent/socket_io.hpp"
void log_hash_block(FILE** f, libtorrent::torrent const& t, int piece, int block
, libtorrent::address a, char const* bytes, int len, bool corrupt)
{
using namespace libtorrent;
mkdir("hash_failures", 0755);
if (*f == NULL)
{
char filename[1024];
std::snprintf(filename, sizeof(filename), "hash_failures/%s.log"
, to_hex(t.info_hash().to_string()).c_str());
*f = fopen(filename, "w");
}
file_storage const& fs = t.torrent_file().files();
std::vector<file_slice> files = fs.map_block(piece, block * 0x4000, len);
std::string fn = fs.file_path(fs.internal_at(files[0].file_index));
char filename[4094];
int offset = 0;
for (int i = 0; i < files.size(); ++i)
{
offset += std::snprintf(filename+offset, sizeof(filename)-offset
, "%s[%" PRId64 ",%d]", libtorrent::filename(fn).c_str(), files[i].offset, int(files[i].size));
if (offset >= sizeof(filename)) break;
}
std::fprintf(*f, "%s\t%04d\t%04d\t%s\t%s\t%s\n", to_hex(t.info_hash().to_string()).c_str(), piece
, block, corrupt ? " bad" : "good", print_address(a).c_str(), filename);
std::snprintf(filename, sizeof(filename), "hash_failures/%s_%d_%d_%s.block"
, to_hex(t.info_hash().to_string()).c_str(), piece, block, corrupt ? "bad" : "good");
FILE* data = fopen(filename, "w+");
fwrite(bytes, 1, len, data);
fclose(data);
}
#endif
namespace libtorrent {
class torrent;
class torrent;
namespace
{
@ -125,16 +76,7 @@ namespace
smart_ban_plugin(torrent& t)
: m_torrent(t)
, m_salt(random())
{
#ifdef TORRENT_LOG_HASH_FAILURES
m_log_file = NULL;
#endif
}
#ifdef TORRENT_LOG_HASH_FAILURES
~smart_ban_plugin()
{ fclose(m_log_file); }
#endif
{}
virtual void on_piece_pass(int p) override
{
@ -259,11 +201,6 @@ namespace
torrent_peer* p = (*range.first);
block_entry e = {p, h.final()};
#ifdef TORRENT_LOG_HASH_FAILURES
log_hash_block(&m_log_file, m_torrent, b.piece_index
, b.block_index, p->address(), j->buffer.disk_block, j->buffer_size, true);
#endif
std::map<piece_block, block_entry>::iterator i = m_block_hashes.lower_bound(b);
if (i != m_block_hashes.end() && i->first == b && i->second.peer == p)
@ -299,7 +236,7 @@ namespace
// we don't have to insert it
return;
}
m_block_hashes.insert(i, std::pair<const piece_block, block_entry>(b, e));
#ifndef TORRENT_DISABLE_LOGGING
@ -334,11 +271,6 @@ namespace
if (b.second.digest == ok_digest) return;
#ifdef TORRENT_LOG_HASH_FAILURES
log_hash_block(&m_log_file, m_torrent, b.first.piece_index
, b.first.block_index, a, j->buffer.disk_block, j->buffer_size, false);
#endif
// find the peer
std::pair<peer_list::iterator, peer_list::iterator> range
= m_torrent.find_peers(a);
@ -384,9 +316,6 @@ namespace
// that is forged to match the CRC of the good data.
int m_salt;
#ifdef TORRENT_LOG_HASH_FAILURES
FILE* m_log_file;
#endif
// explicitly disallow assignment, to silence msvc warning
smart_ban_plugin& operator=(smart_ban_plugin const&);
};

View File

@ -33,12 +33,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include "libtorrent/error_code.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <ctime>
#include <algorithm>
#include <set>
#include <functional>
#include <cstdio>
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/ref.hpp>
#include <boost/bind.hpp>
@ -79,8 +80,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/disk_buffer_holder.hpp"
#include "libtorrent/alloca.hpp"
#include "libtorrent/stat_cache.hpp"
#include <cstdio>
#include "libtorrent/hex.hpp" // to_hex, from_hex
//#define TORRENT_PARTIAL_HASH_LOG

View File

@ -100,6 +100,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/alert_manager.hpp"
#include "libtorrent/disk_interface.hpp"
#include "libtorrent/broadcast_socket.hpp" // for is_ip_address
#include "libtorrent/hex.hpp" // to_hex, from_hex
// TODO: factor out cache_status to its own header
#include "libtorrent/disk_io_thread.hpp" // for cache_status

View File

@ -49,6 +49,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/add_torrent_params.hpp"
#include "libtorrent/magnet_uri.hpp"
#include "libtorrent/announce_entry.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
#ifndef TORRENT_NO_DEPRECATE
#include "libtorrent/lazy_entry.hpp"
@ -65,11 +66,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <set>
#include <ctime>
#if !defined TORRENT_NO_DEPRECATE && TORRENT_USE_IOSTREAM
#include <iostream>
#include <iomanip>
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#if TORRENT_USE_I2P
@ -1724,33 +1720,6 @@ namespace libtorrent
return ret;
}
#if !defined TORRENT_NO_DEPRECATE && TORRENT_USE_IOSTREAM
// ------- start deprecation -------
void torrent_info::print(std::ostream& os) const
{
INVARIANT_CHECK;
os << "trackers:\n";
for (std::vector<announce_entry>::const_iterator i = trackers().begin();
i != trackers().end(); ++i)
{
os << i->tier << ": " << i->url << "\n";
}
if (!m_comment.empty())
os << "comment: " << m_comment << "\n";
os << "private: " << (m_private?"yes":"no") << "\n";
os << "number of pieces: " << num_pieces() << "\n";
os << "piece length: " << piece_length() << "\n";
os << "files:\n";
for (int i = 0; i < m_files.num_files(); ++i)
os << " " << std::setw(11) << m_files.file_size(i)
<< " " << m_files.file_path(i) << "\n";
}
// ------- end deprecation -------
#endif
#if TORRENT_USE_INVARIANT_CHECKS
void torrent_info::check_invariant() const
{

View File

@ -48,6 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/random.hpp"
#include "libtorrent/torrent_info.hpp"
#include "libtorrent/broadcast_socket.hpp" // for supports_ipv6()
#include "libtorrent/hex.hpp" // to_hex, from_hex
#include <boost/tuple/tuple.hpp>
#include <boost/bind.hpp>

View File

@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <sys/stat.h> // for chmod
#include "libtorrent/torrent_info.hpp"
#include "libtorrent/torrent_status.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
static const int file_sizes[] =
{ 5, 16 - 5, 16000, 17, 10, 8000, 8000, 1,1,1,1,1,100,1,1,1,1,100,1,1,1,1,1,1

View File

@ -41,27 +41,21 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/random.hpp"
#include "libtorrent/ed25519.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
#include "libtorrent/kademlia/node_id.hpp"
#include "libtorrent/kademlia/routing_table.hpp"
#include "libtorrent/kademlia/item.hpp"
#include "libtorrent/kademlia/dht_observer.hpp"
#include "libtorrent/ed25519.hpp"
#include <numeric>
#include <cstdarg>
#include <tuple>
#include <iostream>
#include "test.hpp"
#include "setup_transfer.hpp"
#ifdef TORRENT_USE_VALGRIND
#include <valgrind/memcheck.h>
#endif
#if TORRENT_USE_IOSTREAM
#include <iostream>
#endif
using namespace libtorrent;
using namespace libtorrent::dht;
@ -227,14 +221,6 @@ void send_dht_request(node& node, char const* msg, udp::endpoint const& ep
e["a"].dict().insert(std::make_pair("id", generate_next().to_string()));
char msg_buf[1500];
int size = bencode(msg_buf, e);
#if defined TORRENT_DEBUG && TORRENT_USE_IOSTREAM
// this yields a lot of output. too much
// std::cerr << "sending: " << e << "\n";
#endif
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(msg_buf, size);
#endif
bdecode_node decoded;
error_code ec;
@ -281,10 +267,6 @@ void send_dht_response(node& node, bdecode_node const& request, udp::endpoint co
char msg_buf[1500];
int size = bencode(msg_buf, e);
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(msg_buf, size);
#endif
bdecode_node decoded;
error_code ec;
bdecode(msg_buf, msg_buf + size, decoded, ec);
@ -989,9 +971,6 @@ void do_test_dht(address(&rand_addr)())
itemv = std::pair<char const*, int>(buffer, bencode(buffer, items[0].ent));
sign_mutable_item(itemv, salt, seq, public_key, private_key, signature);
TEST_EQUAL(verify_mutable_item(itemv, salt, seq, public_key, signature), true);
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(signature, item_sig_len);
#endif
send_dht_request(node, "put", source, &response
, msg_args()
@ -1063,9 +1042,6 @@ void do_test_dht(address(&rand_addr)())
itemv.second = bencode(buffer, items[0].ent);
sign_mutable_item(itemv, salt, seq, public_key, private_key, signature);
TEST_EQUAL(verify_mutable_item(itemv, salt, seq, public_key, signature), 1);
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(signature, item_sig_len);
#endif
// break the signature
signature[2] ^= 0xaa;
@ -1131,9 +1107,6 @@ void do_test_dht(address(&rand_addr)())
itemv.second = bencode(buffer, items[1].ent);
sign_mutable_item(itemv, salt, seq, public_key, private_key, signature);
TEST_EQUAL(verify_mutable_item(itemv, salt, seq, public_key, signature), 1);
#ifdef TORRENT_USE_VALGRIND
VALGRIND_CHECK_MEM_IS_DEFINED(signature, item_sig_len);
#endif
TEST_CHECK(item_target_id(salt, public_key) == target_id);
@ -1342,11 +1315,7 @@ void do_test_dht(address(&rand_addr)())
// part of the closest nodes
std::set<node_id> duplicates;
#ifdef TORRENT_USE_VALGRIND
const int reps = 3;
#else
const int reps = 50;
#endif
for (int r = 0; r < reps; ++r)
{

View File

@ -41,14 +41,14 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/random.hpp"
#include "libtorrent/ed25519.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
#include "libtorrent/kademlia/dht_storage.hpp"
#include "libtorrent/kademlia/node_id.hpp"
#include "libtorrent/kademlia/routing_table.hpp"
#include "libtorrent/kademlia/item.hpp"
#include "libtorrent/kademlia/dht_observer.hpp"
#include "libtorrent/random.hpp"
#include "libtorrent/ed25519.hpp"
#include <numeric>
#include "test.hpp"

View File

@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/bencode.hpp"
#include "libtorrent/torrent_info.hpp" // for announce_entry
#include "libtorrent/announce_entry.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
using namespace libtorrent;
namespace lt = libtorrent;

View File

@ -45,11 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
void test_enc_handler(libtorrent::crypto_plugin* a, libtorrent::crypto_plugin* b)
{
#ifdef TORRENT_USE_VALGRIND
const int repcount = 10;
#else
const int repcount = 128;
#endif
for (int rep = 0; rep < repcount; ++rep)
{
int const buf_len = rand() % (512 * 1024);
@ -106,11 +102,7 @@ TORRENT_TEST(diffie_hellman)
{
using namespace libtorrent;
#ifdef TORRENT_USE_VALGRIND
const int repcount = 10;
#else
const int repcount = 128;
#endif
for (int rep = 0; rep < repcount; ++rep)
{

View File

@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/broadcast_socket.hpp"
#include "libtorrent/socket_io.hpp" // for print_endpoint
#include "libtorrent/announce_entry.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
#include "test.hpp"
#include "setup_transfer.hpp"

View File

@ -168,11 +168,7 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags)
rejected_trackers.clear();
#ifdef TORRENT_USE_VALGRIND
const int timeout = 100;
#else
const int timeout = 20;
#endif
for (int i = 0; i < timeout; ++i)
{

View File

@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/create_torrent.hpp"
#include "libtorrent/alert_types.hpp"
#include "libtorrent/torrent_info.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
enum flags_t
{

View File

@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/torrent_info.hpp"
#include "libtorrent/resolve_links.hpp"
#include "libtorrent/file.hpp" // for combine_path
#include "libtorrent/hex.hpp" // to_hex, from_hex
#include <boost/make_shared.hpp>
#include <boost/bind.hpp>

View File

@ -32,6 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "libtorrent/sha1_hash.hpp"
#include "libtorrent/hex.hpp" // to_hex, from_hex
using namespace libtorrent;

View File

@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/file.hpp"
#include "libtorrent/session_status.hpp"
#include "libtorrent/torrent_info.hpp"
#include "libtorrent/hex.hpp" // for to_hex, from_hex
#include "test.hpp"
#include "test_utils.hpp"
@ -232,11 +233,7 @@ void test_ssl(int test_idx, bool use_utp)
tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec)
, port));
#ifdef TORRENT_USE_VALGRIND
const int timeout = 100;
#else
const int timeout = 40;
#endif
for (int i = 0; i < timeout; ++i)
{
print_alerts(ses1, "ses1", true, true, true, &on_alert);

View File

@ -37,7 +37,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/create_torrent.hpp"
#include "libtorrent/alert_types.hpp"
#include "libtorrent/torrent.hpp"
#include <boost/tuple/tuple.hpp>
#include <boost/make_shared.hpp>
#include <iostream>

View File

@ -36,17 +36,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/create_torrent.hpp"
#include "libtorrent/announce_entry.hpp"
#include "libtorrent/aux_/escape_string.hpp" // for convert_path_to_posix
#include "libtorrent/hex.hpp" // to_hex, from_hex
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/make_shared.hpp>
#include <boost/ref.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#if TORRENT_USE_IOSTREAM
#include <sstream>
#endif
#include <iostream>
using namespace libtorrent;
@ -737,20 +733,6 @@ TORRENT_TEST(parse_torrents)
, flags & file_storage::flag_symlink ? "-> ": ""
, flags & file_storage::flag_symlink ? fs.symlink(i).c_str() : "");
}
// test swap
#if !defined TORRENT_NO_DEPRECATE && TORRENT_USE_IOSTREAM
std::stringstream str1;
ti->print(str1);
torrent_info temp("temp", ec);
temp.swap(*ti);
std::stringstream str2;
temp.print(str2);
TEST_EQUAL(str1.str(), str2.str());
#endif
}
for (int i = 0; i < int(sizeof(test_error_torrents)/sizeof(test_error_torrents[0])); ++i)

View File

@ -105,11 +105,7 @@ void test_transfer()
boost::tie(tor1, tor2, ignore) = setup_transfer(&ses1, &ses2, 0
, true, false, true, "_utp", 0, &t, false, &atp);
#ifdef TORRENT_USE_VALGRIND
const int timeout = 16;
#else
const int timeout = 8;
#endif
for (int i = 0; i < timeout; ++i)
{