mnode_nng_proto: fix warning
This commit is contained in:
parent
0eaa5aa942
commit
76d85e5c39
1 changed files with 5 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
#include <mesytec-mnode/mnode_nng_proto.h>
|
|
||||||
#include <mesytec-mnode/mnode_nng.h>
|
|
||||||
#include <mesytec-mnode/mnode_cpp_types.h>
|
#include <mesytec-mnode/mnode_cpp_types.h>
|
||||||
|
#include <mesytec-mnode/mnode_nng.h>
|
||||||
|
#include <mesytec-mnode/mnode_nng_proto.h>
|
||||||
|
|
||||||
namespace mesytec::mnode::nng
|
namespace mesytec::mnode::nng
|
||||||
{
|
{
|
||||||
|
@ -9,10 +9,11 @@ size_t serialize_proto_to_nng(const google::protobuf::MessageLite &message, nng_
|
||||||
{
|
{
|
||||||
auto messageSize = message.ByteSizeLong();
|
auto messageSize = message.ByteSizeLong();
|
||||||
|
|
||||||
if (auto res = nng_msg_realloc(msg, nng_msg_len(msg) + sizeof(u32) + messageSize))
|
if (nng_msg_realloc(msg, nng_msg_len(msg) + sizeof(u32) + messageSize))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
*reinterpret_cast<u32 *>(nng_msg_body(msg)) = messageSize;
|
*reinterpret_cast<u32 *>(nng_msg_body(msg)) = messageSize;
|
||||||
|
|
||||||
if (!message.SerializeToArray(reinterpret_cast<u8 *>(nng_msg_body(msg)) + sizeof(u32),
|
if (!message.SerializeToArray(reinterpret_cast<u8 *>(nng_msg_body(msg)) + sizeof(u32),
|
||||||
messageSize))
|
messageSize))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue