13 memcpy(&size, state,
sizeof(size));
14 char* result =
new char[size + 5];
15 memcpy(result, state, size + 5);
23 const uint32_t size = len1 + (len2 ? (2 + len2) : 0);
24 char* result =
new char[size + 5];
25 memcpy(result, &size,
sizeof(size));
26 result[4] =
static_cast<char>(
code);
27 memcpy(result + 5, msg.
data(), len1);
29 result[5 + len1] =
':';
30 result[6 + len1] =
' ';
31 memcpy(result + 7 + len1, msg2.
data(), len2);
50 type =
"Corruption: ";
53 type =
"Not implemented: ";
56 type =
"Invalid argument: ";
62 snprintf(tmp,
sizeof(tmp),
"Unknown code(%d): ",
63 static_cast<int>(
code()));
67 std::string result(type);
69 memcpy(&length,
state_,
sizeof(length));
70 result.append(
state_ + 5, length);
const char * data() const
static const char * CopyState(const char *s)
std::string ToString() const