I use protobuf to serialize some data into an std::string. the actual length is about 46, but aftering serializing the string with Fast-CDR the length becomes 19.
I have found that there was a byte with '\0' inside the protobuf serialized string, which has caused the size mismatch (because Fast-CDR uses c_str() of the string to find the length):
|
Cdr& serialize(const std::string &string_t) {return serialize(string_t.c_str());} |
I think it is better to use the actual length of
std::string, and I have provided a temporary solution:
https://github.com/mjopenglsdl/Fast-CDR/commit/fef4d2f2a7d40b79a96cef66f3a67e823cafac3f
There might be a better way to do it.
I use protobuf to serialize some data into an std::string. the actual length is about 46, but aftering serializing the string with Fast-CDR the length becomes 19.
I have found that there was a byte with '\0' inside the protobuf serialized string, which has caused the size mismatch (because Fast-CDR uses c_str() of the string to find the length):
Fast-CDR/include/fastcdr/Cdr.h
Line 962 in 8496269
I think it is better to use the actual length of std::string, and I have provided a temporary solution:
https://github.com/mjopenglsdl/Fast-CDR/commit/fef4d2f2a7d40b79a96cef66f3a67e823cafac3f
There might be a better way to do it.