forked from premiere/premiere-libtorrent
fix uses of defines for whether or not asserts are active (#832)
This commit is contained in:
parent
d3cd568447
commit
ead11737b4
|
@ -34,10 +34,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "libtorrent/config.hpp"
|
#include "libtorrent/config.hpp"
|
||||||
|
|
||||||
#if (defined TORRENT_DEBUG && TORRENT_USE_ASSERTS) \
|
#if TORRENT_USE_ASSERTS \
|
||||||
|| defined TORRENT_ASIO_DEBUGGING \
|
|| defined TORRENT_ASIO_DEBUGGING \
|
||||||
|| defined TORRENT_PROFILE_CALLS \
|
|| defined TORRENT_PROFILE_CALLS \
|
||||||
|| defined TORRENT_RELEASE_ASSERTS \
|
|
||||||
|| defined TORRENT_DEBUG_BUFFERS
|
|| defined TORRENT_DEBUG_BUFFERS
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
|
@ -440,7 +440,7 @@ private:
|
||||||
char m_reserved_bits[8];
|
char m_reserved_bits[8];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
bool m_in_constructor;
|
bool m_in_constructor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <boost/pool/pool.hpp>
|
#include <boost/pool/pool.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
#if defined TORRENT_DEBUG
|
||||||
#include <set>
|
#include <set>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ namespace libtorrent
|
||||||
// flags controlling this job
|
// flags controlling this job
|
||||||
boost::uint8_t flags;
|
boost::uint8_t flags;
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
bool in_use:1;
|
bool in_use:1;
|
||||||
|
|
||||||
// set to true when the job is added to the completion queue.
|
// set to true when the job is added to the completion queue.
|
||||||
|
|
|
@ -73,7 +73,7 @@ struct TORRENT_EXTRA_EXPORT observer : boost::noncopyable
|
||||||
, flags(0)
|
, flags(0)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(a);
|
TORRENT_ASSERT(a);
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
m_in_constructor = true;
|
m_in_constructor = true;
|
||||||
m_was_sent = false;
|
m_was_sent = false;
|
||||||
m_was_abandoned = false;
|
m_was_abandoned = false;
|
||||||
|
@ -164,7 +164,7 @@ private:
|
||||||
public:
|
public:
|
||||||
unsigned char flags;
|
unsigned char flags;
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
bool m_in_constructor:1;
|
bool m_in_constructor:1;
|
||||||
bool m_was_sent:1;
|
bool m_was_sent:1;
|
||||||
bool m_was_abandoned:1;
|
bool m_was_abandoned:1;
|
||||||
|
|
|
@ -39,10 +39,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined TORRENT_DEBUG && TORRENT_USE_ASSERTS) \
|
#if TORRENT_USE_ASSERTS \
|
||||||
|| defined TORRENT_ASIO_DEBUGGING \
|
|| defined TORRENT_ASIO_DEBUGGING \
|
||||||
|| defined TORRENT_PROFILE_CALLS \
|
|| defined TORRENT_PROFILE_CALLS \
|
||||||
|| defined TORRENT_RELEASE_ASSERTS \
|
|
||||||
|| defined TORRENT_DEBUG_BUFFERS
|
|| defined TORRENT_DEBUG_BUFFERS
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
|
@ -160,7 +160,7 @@ namespace libtorrent
|
||||||
, m_dont_have_id(0)
|
, m_dont_have_id(0)
|
||||||
, m_share_mode_id(0)
|
, m_share_mode_id(0)
|
||||||
#endif
|
#endif
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
, m_in_constructor(true)
|
, m_in_constructor(true)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace libtorrent
|
||||||
, action(read)
|
, action(read)
|
||||||
, ret(0)
|
, ret(0)
|
||||||
, flags(0)
|
, flags(0)
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
, in_use(false)
|
, in_use(false)
|
||||||
, job_posted(false)
|
, job_posted(false)
|
||||||
, callback_called(false)
|
, callback_called(false)
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace libtorrent
|
||||||
|
|
||||||
new (ptr) disk_io_job;
|
new (ptr) disk_io_job;
|
||||||
ptr->action = static_cast<disk_io_job::action_t>(type);
|
ptr->action = static_cast<disk_io_job::action_t>(type);
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
ptr->in_use = true;
|
ptr->in_use = true;
|
||||||
#endif
|
#endif
|
||||||
return ptr;
|
return ptr;
|
||||||
|
@ -72,7 +72,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(j);
|
TORRENT_ASSERT(j);
|
||||||
if (j == 0) return;
|
if (j == 0) return;
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
TORRENT_ASSERT(j->in_use);
|
TORRENT_ASSERT(j->in_use);
|
||||||
j->in_use = false;
|
j->in_use = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -251,7 +251,7 @@ namespace libtorrent
|
||||||
boost::tie(payload, protocol) = m_parser.incoming(recv_buffer, parse_error);
|
boost::tie(payload, protocol) = m_parser.incoming(recv_buffer, parse_error);
|
||||||
received_bytes(0, protocol);
|
received_bytes(0, protocol);
|
||||||
bytes_transferred -= protocol;
|
bytes_transferred -= protocol;
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
if (payload > front_request.length) payload = front_request.length;
|
if (payload > front_request.length) payload = front_request.length;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ observer_ptr find_data::new_observer(void* ptr
|
||||||
, udp::endpoint const& ep, node_id const& id)
|
, udp::endpoint const& ep, node_id const& id)
|
||||||
{
|
{
|
||||||
observer_ptr o(new (ptr) find_data_observer(this, ep, id));
|
observer_ptr o(new (ptr) find_data_observer(this, ep, id));
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
o->m_in_constructor = false;
|
o->m_in_constructor = false;
|
||||||
#endif
|
#endif
|
||||||
return o;
|
return o;
|
||||||
|
|
|
@ -383,7 +383,7 @@ namespace
|
||||||
void* ptr = node.m_rpc.allocate_observer();
|
void* ptr = node.m_rpc.allocate_observer();
|
||||||
if (ptr == 0) return;
|
if (ptr == 0) return;
|
||||||
observer_ptr o(new (ptr) announce_observer(algo, i->first.ep(), i->first.id));
|
observer_ptr o(new (ptr) announce_observer(algo, i->first.ep(), i->first.id));
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
o->m_in_constructor = false;
|
o->m_in_constructor = false;
|
||||||
#endif
|
#endif
|
||||||
entry e;
|
entry e;
|
||||||
|
@ -470,7 +470,7 @@ void node::direct_request(udp::endpoint ep, entry& e
|
||||||
void* ptr = m_rpc.allocate_observer();
|
void* ptr = m_rpc.allocate_observer();
|
||||||
if (ptr == 0) return;
|
if (ptr == 0) return;
|
||||||
observer_ptr o(new (ptr) direct_observer(algo, ep, (node_id::min)()));
|
observer_ptr o(new (ptr) direct_observer(algo, ep, (node_id::min)()));
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
o->m_in_constructor = false;
|
o->m_in_constructor = false;
|
||||||
#endif
|
#endif
|
||||||
m_rpc.invoke(e, ep, o);
|
m_rpc.invoke(e, ep, o);
|
||||||
|
@ -690,7 +690,7 @@ void node::send_single_refresh(udp::endpoint const& ep, int bucket
|
||||||
boost::intrusive_ptr<traversal_algorithm> algo(
|
boost::intrusive_ptr<traversal_algorithm> algo(
|
||||||
new traversal_algorithm(*this, (node_id::min)()));
|
new traversal_algorithm(*this, (node_id::min)()));
|
||||||
observer_ptr o(new (ptr) ping_observer(algo, ep, id));
|
observer_ptr o(new (ptr) ping_observer(algo, ep, id));
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
o->m_in_constructor = false;
|
o->m_in_constructor = false;
|
||||||
#endif
|
#endif
|
||||||
entry e;
|
entry e;
|
||||||
|
|
|
@ -66,7 +66,7 @@ void put_data::set_targets(std::vector<std::pair<node_entry, std::string> > cons
|
||||||
observer_ptr o(new (ptr) put_data_observer(this, i->first.ep()
|
observer_ptr o(new (ptr) put_data_observer(this, i->first.ep()
|
||||||
, i->first.id, i->second));
|
, i->first.id, i->second));
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
o->m_in_constructor = false;
|
o->m_in_constructor = false;
|
||||||
#endif
|
#endif
|
||||||
m_results.push_back(o);
|
m_results.push_back(o);
|
||||||
|
|
|
@ -45,7 +45,7 @@ observer_ptr bootstrap::new_observer(void* ptr
|
||||||
, udp::endpoint const& ep, node_id const& id)
|
, udp::endpoint const& ep, node_id const& id)
|
||||||
{
|
{
|
||||||
observer_ptr o(new (ptr) get_peers_observer(this, ep, id));
|
observer_ptr o(new (ptr) get_peers_observer(this, ep, id));
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
o->m_in_constructor = false;
|
o->m_in_constructor = false;
|
||||||
#endif
|
#endif
|
||||||
return o;
|
return o;
|
||||||
|
|
|
@ -130,7 +130,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(to_process == 0);
|
TORRENT_ASSERT(to_process == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
to_process = 0;
|
to_process = 0;
|
||||||
for (std::vector<boost::asio::mutable_buffer>::iterator i = iovec.begin();
|
for (std::vector<boost::asio::mutable_buffer>::iterator i = iovec.begin();
|
||||||
i != iovec.end(); ++i)
|
i != iovec.end(); ++i)
|
||||||
|
@ -154,7 +154,7 @@ namespace libtorrent
|
||||||
m_send_barriers.pop_front();
|
m_send_barriers.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
if (next_barrier != INT_MAX)
|
if (next_barrier != INT_MAX)
|
||||||
{
|
{
|
||||||
int overhead = 0;
|
int overhead = 0;
|
||||||
|
|
|
@ -58,7 +58,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/bt_peer_connection.hpp"
|
#include "libtorrent/bt_peer_connection.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
#include "libtorrent/socket_io.hpp" // for print_endpoint
|
#include "libtorrent/socket_io.hpp" // for print_endpoint
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -637,7 +637,7 @@ namespace libtorrent
|
||||||
bencode(std::back_inserter(buf), ses_state);
|
bencode(std::back_inserter(buf), ses_state);
|
||||||
bdecode_node e;
|
bdecode_node e;
|
||||||
error_code ec;
|
error_code ec;
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS || !defined BOOST_NO_EXCEPTIONS
|
#if TORRENT_USE_ASSERTS || !defined BOOST_NO_EXCEPTIONS
|
||||||
int ret =
|
int ret =
|
||||||
#endif
|
#endif
|
||||||
bdecode(&buf[0], &buf[0] + buf.size(), e, ec);
|
bdecode(&buf[0], &buf[0] + buf.size(), e, ec);
|
||||||
|
@ -664,7 +664,7 @@ namespace libtorrent
|
||||||
std::pair<char const*, int> buf = ses_state.data_section();
|
std::pair<char const*, int> buf = ses_state.data_section();
|
||||||
bdecode_node e;
|
bdecode_node e;
|
||||||
error_code ec;
|
error_code ec;
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS || !defined BOOST_NO_EXCEPTIONS
|
#if TORRENT_USE_ASSERTS || !defined BOOST_NO_EXCEPTIONS
|
||||||
int ret =
|
int ret =
|
||||||
#endif
|
#endif
|
||||||
bdecode(buf.first, buf.first + buf.second, e, ec);
|
bdecode(buf.first, buf.first + buf.second, e, ec);
|
||||||
|
|
|
@ -851,7 +851,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(m_abort);
|
TORRENT_ASSERT(m_abort);
|
||||||
TORRENT_ASSERT(prev == NULL && next == NULL);
|
TORRENT_ASSERT(prev == NULL && next == NULL);
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
for (int i = 0; i < aux::session_interface::num_torrent_lists; ++i)
|
for (int i = 0; i < aux::session_interface::num_torrent_lists; ++i)
|
||||||
{
|
{
|
||||||
if (!m_links[i].in_list()) continue;
|
if (!m_links[i].in_list()) continue;
|
||||||
|
@ -8115,7 +8115,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(m_info_hash == m_torrent_file->info_hash());
|
TORRENT_ASSERT(m_info_hash == m_torrent_file->info_hash());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
for (int i = 0; i < aux::session_interface::num_torrent_lists; ++i)
|
for (int i = 0; i < aux::session_interface::num_torrent_lists; ++i)
|
||||||
{
|
{
|
||||||
if (!m_links[i].in_list()) continue;
|
if (!m_links[i].in_list()) continue;
|
||||||
|
@ -11107,7 +11107,7 @@ namespace libtorrent
|
||||||
|
|
||||||
st->state = static_cast<torrent_status::state_t>(m_state);
|
st->state = static_cast<torrent_status::state_t>(m_state);
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
if (st->state == torrent_status::finished
|
if (st->state == torrent_status::finished
|
||||||
|| st->state == torrent_status::seeding)
|
|| st->state == torrent_status::seeding)
|
||||||
{
|
{
|
||||||
|
|
|
@ -563,7 +563,7 @@ namespace libtorrent
|
||||||
// info_hash
|
// info_hash
|
||||||
std::copy(tracker_req().info_hash.begin(), tracker_req().info_hash.end()
|
std::copy(tracker_req().info_hash.begin(), tracker_req().info_hash.end()
|
||||||
, view.data());
|
, view.data());
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
TORRENT_ASSERT(view.size() == 20);
|
TORRENT_ASSERT(view.size() == 20);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -102,10 +102,9 @@ LONG WINAPI seh_exception_handler(LPEXCEPTION_POINTERS p)
|
||||||
{
|
{
|
||||||
char stack_text[10000];
|
char stack_text[10000];
|
||||||
|
|
||||||
#if (defined TORRENT_DEBUG && TORRENT_USE_ASSERTS) \
|
#if TORRENT_USE_ASSERTS \
|
||||||
|| defined TORRENT_ASIO_DEBUGGING \
|
|| defined TORRENT_ASIO_DEBUGGING \
|
||||||
|| defined TORRENT_PROFILE_CALLS \
|
|| defined TORRENT_PROFILE_CALLS \
|
||||||
|| defined TORRENT_RELEASE_ASSERTS \
|
|
||||||
|| defined TORRENT_DEBUG_BUFFERS
|
|| defined TORRENT_DEBUG_BUFFERS
|
||||||
print_backtrace(stack_text, sizeof(stack_text), 30
|
print_backtrace(stack_text, sizeof(stack_text), 30
|
||||||
, p->ContextRecord);
|
, p->ContextRecord);
|
||||||
|
@ -159,10 +158,9 @@ void sig_handler(int sig)
|
||||||
{
|
{
|
||||||
char stack_text[10000];
|
char stack_text[10000];
|
||||||
|
|
||||||
#if (defined TORRENT_DEBUG && TORRENT_USE_ASSERTS) \
|
#if TORRENT_USE_ASSERTS \
|
||||||
|| defined TORRENT_ASIO_DEBUGGING \
|
|| defined TORRENT_ASIO_DEBUGGING \
|
||||||
|| defined TORRENT_PROFILE_CALLS \
|
|| defined TORRENT_PROFILE_CALLS \
|
||||||
|| defined TORRENT_RELEASE_ASSERTS \
|
|
||||||
|| defined TORRENT_DEBUG_BUFFERS
|
|| defined TORRENT_DEBUG_BUFFERS
|
||||||
print_backtrace(stack_text, sizeof(stack_text), 30);
|
print_backtrace(stack_text, sizeof(stack_text), 30);
|
||||||
#elif defined __FUNCTION__
|
#elif defined __FUNCTION__
|
||||||
|
|
|
@ -79,7 +79,7 @@ struct test_storage_impl : storage_interface
|
||||||
|
|
||||||
static void nop() {}
|
static void nop() {}
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
#define INITIALIZE_JOB(j) j.in_use = true;
|
#define INITIALIZE_JOB(j) j.in_use = true;
|
||||||
#else
|
#else
|
||||||
#define INITIALIZE_JOB(j)
|
#define INITIALIZE_JOB(j)
|
||||||
|
|
|
@ -2652,7 +2652,7 @@ TORRENT_TEST(rpc_invalid_error_msg)
|
||||||
node, node_id()));
|
node, node_id()));
|
||||||
|
|
||||||
observer_ptr o(new (rpc.allocate_observer()) null_observer(algo, source, node_id()));
|
observer_ptr o(new (rpc.allocate_observer()) null_observer(algo, source, node_id()));
|
||||||
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
o->m_in_constructor = false;
|
o->m_in_constructor = false;
|
||||||
#endif
|
#endif
|
||||||
rpc.invoke(req, source, o);
|
rpc.invoke(req, source, o);
|
||||||
|
|
Loading…
Reference in New Issue