From a1c591dd5f2bad2aba07134fa6b9c2415abff318 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 24 Sep 2020 11:50:59 +0800 Subject: [PATCH] 1 --- cpp/protoutils.cc | 8 ++++---- cpp/protoutils.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cpp/protoutils.cc b/cpp/protoutils.cc index 00dd732..6c0cc3d 100644 --- a/cpp/protoutils.cc +++ b/cpp/protoutils.cc @@ -31,7 +31,7 @@ namespace f8 free((void*)hdr); } - int Net_GetMessageId(::google::protobuf::Message& msg) + int Net_GetMessageId(const ::google::protobuf::Message& msg) { std::string msgname; { @@ -111,7 +111,7 @@ namespace f8 } int Net_SendMsg(a8::TcpClient* tcp_client, unsigned seqid, unsigned short msgid, - ::google::protobuf::Message& msg) + const ::google::protobuf::Message& msg) { int packlen = msg.ByteSize(); @@ -145,7 +145,7 @@ namespace f8 } int Net_SendMsg(a8::AsyncTcpClient* tcp_client, unsigned seqid, unsigned short msgid, - ::google::protobuf::Message& msg) + const ::google::protobuf::Message& msg) { int packlen = msg.ByteSize(); assert(packlen < 1024 * 60); @@ -182,7 +182,7 @@ namespace f8 } int Net_SendMsg(a8::TcpListener* tcp_listener, unsigned short socket_handle, unsigned int seqid, - unsigned short msgid, ::google::protobuf::Message& msg) + unsigned short msgid, const ::google::protobuf::Message& msg) { int packlen = msg.ByteSize(); diff --git a/cpp/protoutils.h b/cpp/protoutils.h index 9902cc7..dab421c 100644 --- a/cpp/protoutils.h +++ b/cpp/protoutils.h @@ -103,22 +103,22 @@ namespace f8 const unsigned short MAGIC_CODE = (((unsigned short)'S') << 8) | ((unsigned short)'K'); #endif - int Net_GetMessageId(::google::protobuf::Message& msg); + int Net_GetMessageId(const ::google::protobuf::Message& msg); void Net_PackMsg(unsigned short msgid, ::google::protobuf::Message& msg, std::string& out); void Net_PackMsgOld(unsigned short msgid, ::google::protobuf::Message& msg, std::string& out); int Net_SendMsg(a8::TcpClient* tcp_client, unsigned int seqid, - unsigned short msgid, ::google::protobuf::Message& msg); + unsigned short msgid, const ::google::protobuf::Message& msg); int Net_SendMsgOld(a8::TcpClient* tcp_client, unsigned int seqid, unsigned short msgid, ::google::protobuf::Message& msg); int Net_SendMsg(a8::AsyncTcpClient* tcp_client, unsigned int seqid, - unsigned short msgid, ::google::protobuf::Message& msg); + unsigned short msgid, const ::google::protobuf::Message& msg); int Net_SendBigMsg(a8::TcpClient* tcp_client, unsigned int seqid, unsigned short msgid, ::google::protobuf::Message& msg); int Net_SendMsg(a8::TcpClient* tcp_client, unsigned int seqid, unsigned short msgid, const char* msgbody, int msgbody_len); int Net_SendMsg(a8::TcpListener* tcp_tlistener, unsigned short socket_handle, unsigned int seqid, - unsigned short msgid, ::google::protobuf::Message& msg); + unsigned short msgid, const ::google::protobuf::Message& msg); int Net_SendMsgOld(a8::TcpListener* tcp_tlistener, unsigned short socket_handle, unsigned int seqid, unsigned short msgid, ::google::protobuf::Message& msg); int Net_SendBigMsg(a8::TcpListener* tcp_tlistener, unsigned short socket_handle, unsigned int seqid,