Fix Base128 utility function.

This commit is contained in:
/dev/urandom 2016-08-29 10:11:03 +02:00
parent 4d2d974ede
commit 3b9134422d
No known key found for this signature in database
GPG Key ID: 41322B973E0F295E

View File

@ -137,8 +137,14 @@ namespace Utils
auto encoder = new base128();
void* inbuffer = const_cast<char*>(input.data());
char* buffer = encoder->encode(inbuffer, input.size());
/*
Interesting to see that the buffer returned by the encoder is not a standalone string copy
but instead is a pointer to the internal "encoded" field of the encoder. So if you deinitialize
the encoder that string will probably become garbage.
*/
std::string retval(buffer);
delete encoder;
return std::string(buffer);
return retval;
}
// Generates a UUID and returns the string representation of it