From 37c48117b0b0bb0ac81f870512e33d88664fc142 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 27 Jan 2009 06:57:55 +0000 Subject: [PATCH] fix potential bug (and warning on sunpro) in the send_buffer signature --- include/libtorrent/bt_peer_connection.hpp | 2 +- src/bt_peer_connection.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/libtorrent/bt_peer_connection.hpp b/include/libtorrent/bt_peer_connection.hpp index da3b0fa27..5d3b9bc48 100644 --- a/include/libtorrent/bt_peer_connection.hpp +++ b/include/libtorrent/bt_peer_connection.hpp @@ -275,7 +275,7 @@ public: // these functions encrypt the send buffer if m_rc4_encrypted // is true, otherwise it passes the call to the // 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); template void append_send_buffer(char* buffer, int size, Destructor const& destructor) diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index 73746c6a2..6b712ba9b 100644 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -606,13 +606,13 @@ namespace libtorrent #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(size > 0); if (m_encrypted && m_rc4_encrypted) - m_RC4_handler->encrypt(buf, size); + m_RC4_handler->encrypt(const_cast(buf), size); peer_connection::send_buffer(buf, size, flags); }