Fixing gcc problem with EncodeToBuf-function.
This commit is contained in:
@@ -83,7 +83,7 @@ public:
|
||||
virtual void AsyncSendNextPacket(boost::shared_ptr<SessionData> session);
|
||||
void AsyncSendNextPacket(boost::shared_ptr<boost::asio::ip::tcp::socket> socket);
|
||||
virtual void InternalStorePacket(boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet);
|
||||
int EncodeToBuf(boost::shared_ptr<SessionData> session, const void *data, size_t size);
|
||||
int EncodeToBuf(const void *data, size_t size);
|
||||
|
||||
virtual void HandleWrite(boost::shared_ptr<boost::asio::ip::tcp::socket> socket, const boost::system::error_code &error);
|
||||
|
||||
|
||||
@@ -105,12 +105,12 @@ AsioSendBuffer::InternalStorePacket(boost::shared_ptr<SessionData> session, boos
|
||||
google::protobuf::uint8 *buf = new google::protobuf::uint8[packetSize + NET_HEADER_SIZE];
|
||||
*((uint32_t *)buf) = htonl(packetSize);
|
||||
packet->GetMsg()->SerializeWithCachedSizesToArray(&buf[NET_HEADER_SIZE]);
|
||||
EncodeToBuf(session, buf, packetSize + NET_HEADER_SIZE);
|
||||
EncodeToBuf(buf, packetSize + NET_HEADER_SIZE);
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
int
|
||||
AsioSendBuffer::EncodeToBuf(boost::shared_ptr<SessionData> /*session*/, const void *data, size_t size)
|
||||
AsioSendBuffer::EncodeToBuf(const void *data, size_t size)
|
||||
{
|
||||
// Realloc buffer if necessary.
|
||||
while (GetSendBufLeft() < size) {
|
||||
|
||||
@@ -273,7 +273,7 @@ ChatCleanerManager::SendMessageToServer(ChatCleanerMessage &msg)
|
||||
google::protobuf::uint8 *buf = new google::protobuf::uint8[packetSize + CLEANER_NET_HEADER_SIZE];
|
||||
*((uint32_t *)buf) = htonl(packetSize);
|
||||
msg.SerializeWithCachedSizesToArray(&buf[CLEANER_NET_HEADER_SIZE]);
|
||||
m_sendManager->EncodeToBuf(NULL, buf, packetSize + CLEANER_NET_HEADER_SIZE);
|
||||
m_sendManager->EncodeToBuf(buf, packetSize + CLEANER_NET_HEADER_SIZE);
|
||||
delete[] buf;
|
||||
|
||||
m_sendManager->AsyncSendNextPacket(m_socket);
|
||||
|
||||
Reference in New Issue
Block a user