fix potential bug (and warning on sunpro) in the send_buffer signature

This commit is contained in:
Arvid Norberg 2009-01-27 06:57:55 +00:00
parent 8030454c96
commit 37c48117b0
2 changed files with 3 additions and 3 deletions

View File

@ -275,7 +275,7 @@ public:
// these functions encrypt the send buffer if m_rc4_encrypted // these functions encrypt the send buffer if m_rc4_encrypted
// is true, otherwise it passes the call to the // is true, otherwise it passes the call to the
// peer_connection functions of the same names // peer_connection functions of the same names
void send_buffer(char* buf, int size, int flags = 0); void send_buffer(char const* buf, int size, int flags = 0);
buffer::interval allocate_send_buffer(int size); buffer::interval allocate_send_buffer(int size);
template <class Destructor> template <class Destructor>
void append_send_buffer(char* buffer, int size, Destructor const& destructor) void append_send_buffer(char* buffer, int size, Destructor const& destructor)

View File

@ -606,13 +606,13 @@ namespace libtorrent
#endif #endif
} }
void bt_peer_connection::send_buffer(char* buf, int size, int flags) void bt_peer_connection::send_buffer(char const* buf, int size, int flags)
{ {
TORRENT_ASSERT(buf); TORRENT_ASSERT(buf);
TORRENT_ASSERT(size > 0); TORRENT_ASSERT(size > 0);
if (m_encrypted && m_rc4_encrypted) if (m_encrypted && m_rc4_encrypted)
m_RC4_handler->encrypt(buf, size); m_RC4_handler->encrypt(const_cast<char*>(buf), size);
peer_connection::send_buffer(buf, size, flags); peer_connection::send_buffer(buf, size, flags);
} }