Allow zero length strings
This commit is contained in:
parent
7ae5e98c5a
commit
5f5f487967
|
@ -209,13 +209,13 @@ private:
|
|||
|
||||
// Writes the given string to the request as a sequence of bytes. Inserts a
|
||||
// format byte at the beginning of the string according to the its length,
|
||||
// as specified by the msgpack specification. String length must be greater
|
||||
// than 0.
|
||||
// as specified by the msgpack specification.
|
||||
inline void serialize_string(const std::string& str, TraceRequest& request) {
|
||||
int size = str.size();
|
||||
ASSERT(size > 0);
|
||||
|
||||
if (size <= 31) {
|
||||
// A size 0 string is ok. We still need to write a byte
|
||||
// identifiying the item as a string, but can set the size to 0.
|
||||
request.write_byte(static_cast<uint8_t>(size) | 0b10100000);
|
||||
} else if (size <= 255) {
|
||||
request.write_byte(0xd9);
|
||||
|
|
Loading…
Reference in New Issue