Protobuf 从未知大小的 char* 解析

Protobuf parse from char* with unknown size

在 C++ 中有什么方法可以仅从一个字符指针解析 Protobuf 对象吗?问题是序列化的字节可能包含 '[=10=]' 这使得无法确定数组的结尾。我从流式 API 中得到的唯一东西是一个指向序列化字节的字符指针,我无法更改 API.

The only thing I get from a streaming API is a char pointer to serialized bytes, I cannot change the API.

那你就进退两难了,这个API一直没用。

协议缓冲区文档明确指出消息中没有编码的帧信息。您必须提供自己的。