fix some clang warnings

This commit is contained in:
Arvid Norberg 2012-02-18 08:23:48 +00:00
parent cde80acbde
commit 5a23d04143
7 changed files with 19 additions and 12 deletions

View File

@ -294,7 +294,8 @@ public:
// is true, otherwise it passes the call to the
// peer_connection functions of the same names
virtual void append_const_send_buffer(char const* buffer, int size);
void send_buffer(char const* buf, int size, int flags = 0);
virtual void send_buffer(char const* begin, int size, int flags = 0
, void (*fun)(char*, int, void*) = 0, void* userdata = 0);
template <class Destructor>
void append_send_buffer(char* buffer, int size, Destructor const& destructor)
{

View File

@ -668,8 +668,11 @@ namespace libtorrent
rc4->encrypt(buf, len);
}
void bt_peer_connection::send_buffer(char const* buf, int size, int flags)
void bt_peer_connection::send_buffer(char const* buf, int size, int flags
, void (*f)(char*, int, void*), void* ud)
{
TORRENT_ASSERT(f == 0);
TORRENT_ASSERT(ud == 0);
TORRENT_ASSERT(buf);
TORRENT_ASSERT(size > 0);

View File

@ -140,7 +140,7 @@ namespace
return false;
}
virtual bool on_bitfield(std::vector<bool> const& bitfield)
virtual bool on_bitfield(bitfield const& bitfield_)
{
log_timestamp();
m_file << "<== BITFIELD\n";
@ -157,7 +157,7 @@ namespace
return false;
}
virtual bool on_piece(peer_request const& r, char const*)
virtual bool on_piece(peer_request const& r, disk_buffer_holder& data)
{
log_timestamp();
m_file << "<== PIECE [ piece: " << r.piece << " | s: " << r.start

View File

@ -127,6 +127,7 @@ namespace
a = b = c = d = e = 0;
}
#ifdef VERBOSE
void SHAPrintContext(SHA_CTX *context, char *msg)
{
using namespace std;
@ -139,6 +140,7 @@ namespace
, (unsigned int)context->state[3]
, (unsigned int)context->state[4]);
}
#endif
template <class BlkFun>
void internal_update(SHA_CTX* context, u8 const* data, u32 len)
@ -172,11 +174,13 @@ namespace
#endif
}
#if !defined __BIG_ENDIAN__ && !defined __LITTLE_ENDIAN__
bool is_big_endian()
{
u32 test = 1;
return *reinterpret_cast<u8*>(&test) == 0;
}
#endif
}
// SHA1Init - Initialize new context

View File

@ -394,14 +394,14 @@ namespace libtorrent
, m_need_save_resume_data(true)
, m_seeding_time(0)
, m_time_scaler(0)
, m_max_uploads(~0)
, m_max_uploads((1<<24)-1)
, m_deficit_counter(0)
, m_num_uploads(0)
, m_block_size_shift(root2(block_size))
, m_has_incoming(false)
, m_files_checked(false)
, m_queued_for_checking(false)
, m_max_connections(~0)
, m_max_connections((1<<24)-1)
, m_padding(0)
, m_complete(0xffffff)
, m_priority(0)
@ -6452,7 +6452,7 @@ namespace libtorrent
{
TORRENT_ASSERT(m_ses.is_network_thread());
TORRENT_ASSERT(limit >= -1);
if (limit <= 0) limit = (std::numeric_limits<int>::max)();
if (limit <= 0) limit = (1<<24)-1;
if (m_max_uploads != limit) state_updated();
m_max_uploads = limit;
}
@ -6461,7 +6461,7 @@ namespace libtorrent
{
TORRENT_ASSERT(m_ses.is_network_thread());
TORRENT_ASSERT(limit >= -1);
if (limit <= 0) limit = (std::numeric_limits<int>::max)();
if (limit <= 0) limit = (1<<24)-1;
if (m_max_connections != limit) state_updated();
m_max_connections = limit;
@ -8176,9 +8176,9 @@ namespace libtorrent
}
st->num_uploads = m_num_uploads;
st->uploads_limit = m_max_uploads;
st->uploads_limit = m_max_uploads == (1<<24)-1 ? -1 : m_max_uploads;
st->num_connections = int(m_connections.size());
st->connections_limit = m_max_connections;
st->connections_limit = m_max_connections == (1<<24)-1 ? -1 : m_max_connections;
// if we don't have any metadata, stop here
st->queue_position = queue_position();

View File

@ -335,7 +335,6 @@ setup_transfer(session* ses1, session* ses2, session* ses3
// they should not use the same save dir, because the
// file pool will complain if two torrents are trying to
// use the same files
sha1_hash info_hash = t->info_hash();
add_torrent_params param;
param.paused = false;
param.auto_managed = false;

View File

@ -18,7 +18,7 @@ int test_main()
char b[] = "d1:ai12453e1:b3:aaa1:c3:bbbe";
lazy_entry e;
error_code ec;
int ret = lazy_bdecode(b, b + sizeof(b)-1, e, ec);
lazy_bdecode(b, b + sizeof(b)-1, e, ec);
}
ptime stop(time_now());